This page introduce how you can download and compile the Linux kernel for ODROID-HC4.

Installing required packages

You will need install required packages before you start to build Linux kernel on your Ubuntu desktop.

$ sudo apt-get update
$ sudo apt-get install git lzop build-essential gcc bc libncurses5-dev libc6-i386 lib32stdc++6 zlib1g:i386

Toolchain (6.3.1)

Click one of the site to download toolchain to build Linux kernel.

Once the download is done, extract the tarball to /opt/toolchains/.

$ sudo mkdir -p /opt/toolchains
$ sudo tar Jxvf gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu.tar.xz -C /opt/toolchains/

In order to add the toolchain path to PATH, paste below lines to $HOME/.bashrc.

export ARCH=arm64
export CROSS_COMPILE=aarch64-linux-gnu-
export PATH=/opt/toolchains/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu/bin/:$PATH

You can apply the change if you login again or import to apply this change, login again or evaluate $HOME/.bashrc with source command.

$ source ~/.bashrc

You can check if the toolchain installed above works properly while checking the version of toolchain. If you can find gcc version 6.3.1 20170109 at the end of the line, the toolchain is well installed.

$ aarch64-linux-gnu-gcc -v
Using built-in specs.
gcc version 6.3.1 20170109 (Linaro GCC 6.3-2017.02)


You can check out Linux kernel source tree from Hardkernel's Github, please note that we distribute the Linux kernel in different branches for Android and other Linux distributions.

$ git clone --depth 1 -b odroidg12-4.9.y
$ cd linux



$ make odroidg12_defconfig
$ make -j$(expr $(expr $(nproc) \* 6) \/ 5)

You have done to compile the Linux kernel (Image), the device tree file (.dtb) and kernel modules (.ko).


If you have some kernel drivers wish to include for your custom build, you can select the drivers easily in Linux kernel tree. make menuconfig will show you text-based menus help you to select kernel drivers.

$ make odroidg12_defconfig
$ make menuconfig

Once you are done selecting the drivers, exit from the menu screen. Then you can start kernel build with make again.

$ make -j$(expr $(expr $(nproc) \* 6) \/ 5)

When you exit from the kernel menu screen, you will have .config in the current directory what has changed for your custom build.


There are different instructions to install Linux kernel image and device tree for Android and Linux. Since Android loads both from a boot partition, we have to use fastboot to install into the dedicated partition. Please refer the partition table from here. In contrast, Linux boots by the instructions described in boot.ini the 1st FAT partition.

This explanation assume that your USB memory CARD reader is assigned at /dev/sdc. Be careful!

1. Plug the Boot-Device(SD) into the USB memory CARD reader and Connect the USB memory CARD reader to your HOST PC(Linux OS).

2. Copy the Image and DT(meson64_odroidhc4.dtb) to the FAT partition(1st partition) in the Boot-Device.

$ mkdir -p mount
$ sudo mount /dev/sdc1 ./mount
$ sudo cp arch/arm64/boot/Image.gz arch/arm64/boot/dts/amlogic/meson64_odroidhc4.dtb ./mount && sync && sudo umount ./mount

3. Copy the driver modules to the EXT4 partition(2nd partition) in the Boot-Device.

$ sudo mount /dev/sdn2 ./mount
$ sudo make modules_install ARCH=arm64 INSTALL_MOD_PATH=./mount && sync && sudo umount ./mount
$ rm -rf mount


  • 8GB SD card have not enough space to build kernel source. In order to do native compile, the 5GB of free space is required at least.

Installing required packages

You will need install required packages before you start to build Linux kernel on your Ubuntu ODROID-HC4.

odroid@odroid64:~$ sudo apt update
odroid@odroid64:~$ sudo apt install git


odroid@odroid64:~$ git clone --depth 1 -b odroidg12-4.9.y
odroid@odroid64:~$ cd linux

Compile & Installation

odroid@odroid64:~/linux$ make odroidg12_defconfig
You can edit .config file or run "make menuconfig" to add/remove Kernel drivers.
odroid@odroid64:~/linux$ make -j4
odroid@odroid64:~/linux$ sudo make modules_install
odroid@odroid64:~/linux$ sudo cp -f arch/arm64/boot/Image.gz arch/arm64/boot/dts/amlogic/meson64_odroidhc4.dtb /media/boot/
odroid@odroid64:~/linux$ sudo sync
odroid@odroid64:~/linux$ sudo reboot