HOWTO: Custom kernel and linux distro for ODROID-C

Prepare the environment

In this example i used a old gcc version, you can try the newer 4.8

mkdir -p $HOME/Apps/toolchains
tar -xf gcc-linaro-arm-linux-gnueabihf-4.7-2013.04-20130415_linux.tar.bz2 -C $HOME/Apps/toolchains/

Next you must prepare the environment variables:

echo 'export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-
export PATH=/home/capi_x/Apps/toolchains/gcc-linaro-arm-linux-gnueabihf-4.7-2013.04-20130415_linux/bin:$PATH' > $HOME/Apps/

chmod a+x $HOME/Apps/

And load it in every session what you want cross-compile

. $HOME/Apps/

Also we need the u-boot tools

apt-get install u-boot-tools

Now we will make a temporal folder.

mkdir -p /tmp/odroidc/boot
mkdir -p /tmp/odroidc/root

Next download the linux 3.10.x based kernel for odroidc (or check if we have a new odroidc-xxx branch)

git clone -b odroidc-3.10.y

And compile it!

Prepare the image

cd linux
make odroidc_defconfig
make uImage -j8
make dtbs

And the kernel modules for the root file system.

make ARCH=arm INSTALL_MOD_PATH=/tmp/odroidc/root modules_install

And copy the compiled elements to the boot temporal folder.

cp ./arch/arm/boot/uImage                  /tmp/odroidc/boot
cp ./arch/arm/boot/dts/meson8b_odroidc.dtb /tmp/odroidc/boot

For prepare the initrd we can use other valid initrd image (e.g. from the default ubuntu img)

# fdisk ubuntu-14.04.1lts-lubuntu-odroid-c1-20150102.img

Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Command (m for help): p
Disk ubuntu-14.04.1lts-lubuntu-odroid-c1-20150102.img: 4.6 GiB, 4930404352 bytes, 9629696 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x000cde21

Device                                            Boot  Start     End Sectors   Size Id Type
ubuntu-14.04.1lts-lubuntu-odroid-c1-20150102.img1        3072  266239  263168 128.5M  6 FAT16
ubuntu-14.04.1lts-lubuntu-odroid-c1-20150102.img2      266240 9629695 9363456   4.5G 83 Linux

Command (m for help): q

# mount -o loop,offset=1572864 ubuntu-14.04.1lts-lubuntu-odroid-c1-20150102.img /mnt/loop

The last files on boot...

cp /mnt/loop/boot.ini /tmp/odroidc/boot/
mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 -n initramfs -d /mnt/loop/uInitrd /tmp/odroidc/boot/uInitrd

In this point you have all files to make a custom linux distribution for ODROID-C.

For example, you can take the ubuntu img, mount the boot (FAT16) and replace the files with the content of "/tmp/odroidc/boot/" and modify the boot.ini to have other root.

$ cat boot.ini 

# Possible screen resolutions
# Uncomment only a single Line! The line with setenv written.
# At least one mode must be selected.

# setenv m "vga"          # VGA 640x480
# setenv m "480p"         # 480p 720x480
# setenv m "576p"         # 576p 720x576
# setenv m "800x480p60hz" # WVGA 800x480
# setenv m "720p"         # 720p 1280x720
# setenv m "800p"         # 800p(WXGA) 1280x800
# setenv m "sxga"         # SXGA 1280x1024
setenv m "1080p"          # 1080P 1920x1080
# setenv m "1920x1200"    # 1920x1200

# HDMI/DVI Mode Configuration
setenv vout_mode "hdmi"
# setenv vout_mode "dvi"

setenv m_bpp "32"
# setenv m_bpp "16"

# UHS Card Configuration
# Uncomment the line below to __DISABLE__ UHS-1 MicroSD support
# This might break boot for some brand/models of cards.
setenv disableuhs "disableuhs"

setenv bootargs "console=ttyS0,115200n8 root=/dev/sda3 rootfstype=ext4 rootwait ro no_console_suspend vdaccfg=0xa000 logo=osd1,loaded,0x7900000,720p,full dmfc=3 cvbsmode=576cvbs hdmimode=${m} m_bpp=${m_bpp} vout=${vout_mode} ${disableuhs}"
setenv bootcmd "fatload mmc 0:1 0x21000000 uImage; fatload mmc 0:1 0x22000000 uInitrd; fatload mmc 0:1 0x21800000 meson8b_odroidc.dtb; bootm 0x21000000 0x22000000 0x21800000"
run bootcmd

For example, if you have the root in the mmc partition 2 you can use the root=/dev/mmcblk0p2

Later you can put a root image (e.g. debian armhf image, arch linux ARMv7, etc.) as a partition in the img file mount it and copy the contents of /tmp/odroidc/root on it.

To write the image, you can use the micro-sd adapter from Kingston (some are saying bullshit about that it's wrong on forums... fuck off!) Kingston MicroSD adapter

And i recommend to write the image to the microSD card using dd on byte by byte copy mode.

Serial port

If something goes wrong or you need the boot output or have an a shell, you can use the serial port. ODROID-C board

Ok this is the pin set. (Hardkernel, don't piss me off and label the fucking pins the next time)

|   |
| * | 4. GND
| * | 3. RX
| * | 2. TX
| * | 1. VCC

It uses 3v3 and you can use a cheap ebay usb to serial and remember to not wire the VCC between adapter and board.

OT. The board design and the soldering work are very good quality. Hardkernel, good work! :-)

P.S. You can download my custom image (only boot). (12MB)