'ODROID-N2' on this page refers to the ODROID-N2 series (N2, N2+, N2L).


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

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

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-7.4.1-2019.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-7.4.1-2019.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 7.4.1 20181213 at the end of the line, the toolchain is well installed.

$ aarch64-linux-gnu-gcc -v
Using built-in specs.
gcc version 7.4.1 20181213 [linaro-7.4-2019.02 revision 56ec6f6b99cc167ff0c2f8e1a2eed33b1edc85d4] (Linaro GCC 7.4-2019.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 https://github.com/hardkernel/linux.git -b odroidg12-4.9.y
$ cd linux



$ git clone --depth 1 https://github.com/hardkernel/linux.git -b odroidg12-4.9.y-android
$ cd linux


  • If you want to download & build only Android Linux kernel source code without another Android BSP, you face the error message as below:
    • drivers/amlogic/wifi/Kconfig:26: can't open file “../hardware/wifi/realtek/drivers/8192cu/rtl8xxx_CU/Kconfig”
  • Please delete the last line as below in 'drivers/amlogic/wifi/Kconfig' file if you will build only Android Linux kernel.
    • source “../hardware/wifi/realtek/drivers/8192cu/rtl8xxx_CU/Kconfig”


$ 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(eMMC or 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 device tree files 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_odroid*.dtb ./mount && sync && sudo umount ./mount

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

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


This is the instruction to install kernel image, Image, to the boot card.
You should build boot image via android repo because boot image consist of root ramdisk and kernel image.
On the android build root directory.

$ make bootimage

This is to install boot image that include kernel image.

$ fastboot flash boot out/target/product/odroidn2/boot.img

This is to install a device tree file, meson64_odroidn2.dtb.

$ fastboot flash dtb <path/of/your/meson64_odroidn2.dtb>


  • 8GB eMMC/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.

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

odroid@odroid64:~$ sudo apt update
odroid@odroid64:~$ sudo apt install git
odroid@odroid64:~$ git clone --depth 1 https://github.com/hardkernel/linux.git -b odroidg12-4.9.y
odroid@odroid64:~$ cd linux
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_odroidn2.dtb /media/boot/
odroid@odroid64:~/linux$ sudo sync
odroid@odroid64:~/linux$ sudo reboot
  • odroid-n2/software/building_kernel.txt
  • Last modified: 2022/11/10 08:28
  • by luke.go