I created this guide for me to keep track of what I’m doing and I’m sure it can be of some help to some people.
At this time, I didn’t find an up to date image of Ubuntu server 14.04.2 with WIFI on forums or downloads of Hardkernel site. I decided to create my own. Here is how…

If you don’t want to go through all this procedure, just download the ready to use image below:
ubuntu-server-14.04.2-STFB.img

You can also check the MD5sum:
md5sum

Setting up the environment

Just so you know, all the steps from this guide are typed being root. If not, please use sudo.

Preparing the system

Downloading all the needed stuff

Pre-Built bootloaders

Kernel Sources

Toolchain for Crossbuild

Ubuntu’s rootfs

 U-Boot tools

Building and Putting things on Place

Emptying your card

Be aware it can take some time…

Installing bootloaders

Create Partitions

We will use two partitions, one for kernel and one for rootfs.
The kernel partition is a fat32 type. The rootfs is a ext4 partition with no journaling (to not wear the non mechanical drive) and no atime as mount option (the number of writes to a disk for relatime mount is close to double relative to a noatime mount).

Please assure that the first partition starts at least 3072 sectors away from the 1st sector as we need to reserve space for the bootloader.

Follow those steps to create partitions:

after all this, lets call partprobe to get our new partitions read by the kernel

Format and mount our partitions

Partitions are now formatted. Lets change the UUID of the ext4 partition.

Lets disable journaling to prevent excessive wear of your card

We copy all rootfs files to the card:

Building the kernel

First lets decompress our toolchain, then modify some options with menuconfig.

Activate the CONFIG_DEVTMPFS option in the kernel to auto mount /dev at boot.
Go to:
“Device Drivers —> ”
“Generic Driver Options —> ”
and select:
“Automount devtmpfs at /dev, after the kernel mounted the rootfs “

Then exit and compile:

I use -j8 because my computer is a quad-core with hyper-threading so 8 threads are available. You can configure it to match your computer.

Install the kernel and modules that we just built

Voila ! Kernel installed !

Create a initial Boot Script for our first boot

We need to create a boot.scr for the first boot.
We will create the boot.txt and the boot.scr from the boot.txt. The mkimage line is the one that creates the boot.scr

Add a user

We’ll create a user under a already running linux and copy what we find in /etc/passwd + /etc/shadow on the very same files on the rootfs partition.
We’ll add an odroid user (pwd is odroid)
Add this on /etc/passwd (/mnt/roofs/etc..)

And this to /etc/shadow (/mnt/roofs/etc/shadow)

And the odroid user to this groups for him to be able to do sudos (/etc/group)
adm:x:4:syslog:odroid
cdrom:x:24:odroid
sudo:x:27:odroid

And add this group:
odroid:x:1000:

Create home for our user

Add the .bashrc file in odroid user home:

Add this in this file:

Then add the .profile file which gets the .bashrc to be executed:

Don’t forget to update the rights:

Networking

We also need to create some files for your network to be managed (appear if you do ifconfig and get ip addresses automaticaly). Add those 2 files (you can do a ifconfig -a on the booted device to check which interfaces are available)

In /mnt/rootfs/etc/network/interfaces.d add a “eth0” file containing:

Do the same for the WIFI interface (if needed):

Now we must configure our Odroid to get the WIFI

The following steps are for the WiFi Module 4 (MediaTek, formerly Ralink, RT5572N chipset). I don’t know if it will work with the module 3. If you have an other type of chipset, I’ll create a post relative to drivers later.

Download the RT2870 firmware here:
http://www.mediatek.com/en/downloads/     (get the RT2870_Firmware_V22.zip file)

Extract and copy the file to the firmware lib:

Add this to rc.local to:
– improve performance of WIFI chipset
– to remove those messages in syslog “rt2800usb_entry_txstatus_timeout: Warning – TX status timeout for entry 8 in queue 0”

wlan0 config with DHCP

wlan0 config with static IP

If you don’t have a WIFI dongle installed, just move the wlan0 config file out of /etc/network/interface.d and save it to odroid user home dir like this:

This to avoid some waiting time at boot.

Adding the Samsung hardware decoder firmware

Get the S5MFC-Firmware.zip file here and unzip it in /mnt/rootfs/lib/firmware.

Configuring FSTAB

(to know uuid of partitions just use blkid)

Adding Odroid utility

This is usefull to resize the root partition without unmounting it.
Get the axel package from https://launchpad.net/ubuntu/trusty/armhf/axel/2.4-1
You will install it later once booted.
You will also install the odroid utility after boot.

Umount and be ready to boot!

First boot and Configurations

Now, we are ready to do our first boot and do final configuration.
Remove the card from your computer and connect to your board.
login with the odroid user (password is odroid).

First we’ll update and add some necessary things like the ssh server so that we can connect remotely via SSH and some wireless tools (for those using WIFI):

Then install the odroid utility:

You can then execute the odroid-utility to resize the root partition.

Et voila! Now you can shutdown and save this ubuntu server you just have finished to create! 🙂

Save this created disk image

How to dd only used part and not entire empty zone of the disk.
First of all we need to know the partition sizes:

This is my result of this command:

2nd partition ends at 1158143.
So, I can backup everything up to the end which in MB will be:
1158143  * 512 / 1024 / 1024 = 566MB
I’ll add some extra caution, we’ll go for 570MB.

So command to backup will be:

If you want to backup the whole disk:

Here is how to restore an image to the card:
Copy disk image to EMMC/SD card:

Hope that helps ! 😉