Kernel

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 libncurses5-dev libc6-i386 lib32stdc++6 zlib1g:i386

And libssl should be installed.

$ sudo apt-get install libssl-dev

If not so, you can meet this build error.

scripts/extract-cert.c:21:25: fatal error: openssl/bio.h: No such file or directory
 #include <openssl/bio.h>

Toolchain

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

$ sudo mkdir -p /opt/toolchains
$ sudo tar xvf gcc-linaro-6.3.1-2017.05-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=aarch64
export CROSS_COMPILE=aarch64-linux-gnu-
export PATH=/opt/toolchains/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/:$PATH

env script example

#!/bin/bash
export ARCH=aarch64
export CROSS_COMPILE=aarch64-linux-gnu-
 
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
export PATH=/opt/toolchains/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/:$PATH

Download and Build (1) - Android

git clone https://github.com/hardkernel/linux -b odroidn1-4.4.y-android
make odroidn1_defconfig
make Image dtbs  -j12

Download and Build (2) - Linux

$ git clone https://github.com/hardkernel/linux -b odroidn1-4.4.y
$ make distclean
$ make odroidn1_defconfig
$ make Image dtbs -j12

If the newly built kernel has some added/changed modules, you should install the modules too.
Assume that the device name of the OS installed memory card is /dev/sdc. Change it to yours.

$ sudo make modules_install ARCH=arm64 INSTALL_MOD_PATH=/media/<USER_ID>/<ROOTFS_PARTITION_NAME> && sync && umount /dev/sdc?