If you are using a Linux PC with Ubuntu or Debian follow this article:
If you are using a Raspberry Pi board consider that the programs (gcc, g++, ...), required to compile the Linux Kernel, are already installed by default on Raspbian OS so probably you have to install just to add few programs more:
sudo apt update sudo apt install bc bison libssl-dev flex
It is possible to use the Raspberry Pi native gcc compiler so remove this parameter:
from the command provided below
Procedure tested on a Linux Ubuntu , Debian and on a Raspberry Pi 4 Raspbian Buster Lite.
Open a terminal on your Linux PC and download the Linux Kernel sources from the main stream repository:
Extract the Kernel sources from the compressed file by typing:
tar xvfJ linux-5.4.163.tar.xz
Move inside the new folder just created:
Download the Kernel configuration file for Roadrunner by typing:
wget https://www.acmesystems.it/www/roadrunner_compile_kernel_5_4/acme-roadrunner_defconfig -O arch/arm/configs/acme-roadrunner_defconfig
Then select from the following list the right Linux configuration for your board by typing one of these commands:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- acme-roadrunner_defconfig
Compile the Linux Kernel sources and generate the binary compressed image file to save in the first partition of microSD card.
make -j4 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage ... Image arch/arm/boot/zImage is ready
Download our example of device tree source by typing:
wget https://www.acmesystems.it/www/roadrunner_compile_kernel_5_4/acme-roadrunner.dts -O arch/arm/boot/dts/acme-roadrunner.dts
Now compile the device tree file requested by your board by selecting one of the following commands:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- acme-roadrunner.dtb
The image generated contains the Linux Kernel and all the built-in device drivers (option [*] in menuconfig) compiled with it.
Al the drivers compiled as external modules (option [M] in menuconfig)
need to be compiled and saved in the rootfs
/lib directory on the second
partition of the microSD. We didn't use any [M] flag in our defconfig so this procedure
is not requested but. in case you add something. these are the commands to use
to compile them:
make modules -j4 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make modules_install INSTALL_MOD_PATH=./modules ARCH=arm
Write the Linux Kernel image (zImage) and the device tree blob (acme-roadrunner.dtb) inside the first microSD partition:
sudo cp arch/arm/boot/dts/acme-roadrunner.dtb /media/$USER/boot sudo cp arch/arm/boot/zImage /media/$USER/boot
Write the Linux Kernel modules inside the second microSD partition:
sudo rsync -avc modules/lib/. /media/$USER/rootfs/lib/.
At the first access to the board command line update the module dependencies by typing this command:
If you need to customize the Kernel configuration or you just want to take a look around the Kernel setup type:
make ARCH=arm menuconfig
and navigate inside the Kernel configuration using the arrow keys and following the help provided by the menuconfig interface.
make ARCH=arm savedefconfig
defconfig contains your configuration. You could rename and copy it in
cp defconfig arch/arm/configs/my_defconfig