Kernel
This page introduce how you can download and compile the Linux kernel for ODROID-GOU.
Cross Compile - HOST-PC/Ubuntu
Installing required packages
You will need install required packages before you start to build Linux kernel on your Ubuntu desktop.
- host
$ sudo apt-get update $ sudo apt-get install git lzop build-essential gcc bc libncurses5-dev libc6-i386 lib32stdc++6 zlib1g:i386
Toolchain (7.4.1)
Click one of the site to download toolchain to build Linux kernel.
Once the download is done, extract the tarball to /opt/toolchains/.
- host
$ 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.
- host
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.
- host
$ 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.
- host
$ aarch64-linux-gnu-gcc -v Using built-in specs. COLLECT_GCC=aarch64-linux-gnu-gcc COLLECT_LTO_WRAPPER=/opt/toolchains/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu/bin/../libexec/gcc/aarch64-linux-gnu/7.4.1/lto-wrapper ... gcc version 7.4.1 20181213 [linaro-7.4-2019.02 revision 56ec6f6b99cc167ff0c2f8e1a2eed33b1edc85d4] (Linaro GCC 7.4-2019.02)
Checkout
You can check out Linux kernel source tree from Hardkernel's Github
- host
$ git clone --depth 1 https://github.com/hardkernel/linux.git -b odroidgoU-4.9.y $ cd linux
Compile
Basic
- host
$ make odroidgou_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).
Custom
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.
- host
$ make odroidgou_defconfig $ make menuconfig
Once you are done selecting the drivers, exit from the menu screen. Then you can start kernel build with make again.
- host
$ 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.
Installation
Linux boots by the instructions described in boot.ini the 1st FAT partition.
This explanation assume that your OGU is assigned at /dev/sdc. Be careful!
1. Boot OGU into recovery mode and attach to USB host port of your desktop(Linux OS).
2. Copy the Image and device tree files to the FAT partition(1st partition) in the OGU emmc-Device.
- host
$ 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.
- host
$ sudo mount /dev/sdc2 ./mount $ sudo make modules_install ARCH=arm64 INSTALL_MOD_PATH=./mount && sync && sudo umount ./mount $ rm -rf mount