Skip to main content

Build kernel


Toolchain

Download: https://www.linaro.org/downloads/

export PATH=/<path to toolchain>/bin:$PATH
export CROSS_COMPILE=<prefix>-
export ARCH=<architecture>

Building Linux kernel

If a customized repository exists for the board, clone or download it.

Download:

git clone https://github.com/torvalds/linux.git -b <tag or branch> --single-branch
cd linux
make distclean
make <board>_defconfig
tip

If the above command fails, check arch/<arch>/configs. If not in arch/<arch>/configs, get a config file using zcat /proc/config.gz > <board>_defconfig from the kernel installed on the desired board.

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

/lib/modules

sudo make modules_install ARCH=<architecture> INSTALL_MOD_PATH=/<path to>/rootfs && sync

BOOT

sudo cp arch/<architecture>/boot/<image> arch/<architecture>/boot/dts/<board>.dtb /<path to>/BOOT && sync