Cross compile Linux Kernel
You can cross compile software from your running x86 system to another CPU architecture. There are various ways to cross compile. One solution is to use a tool chain.
The advantages of cross compile are a stable host system in the background and fast compilation times.
Setup the cross compile tool chain
Download the ploplinux-src-4.3.3.tar.gz file to get the ARM cross compile tool chain and extract it. The tool chain is in the 99-ARM/cross-compile/tool-chain/ directory. You can also download each individual file from here.
git-tools: Download latest ARM cross compile tool chain.
shell.sh: Start a shell with correct environment variables.
tools.tar.gz: ARM cross compile tool chain.
Extract the file tools.tar.gz for the Cross Compile Tool Chain or start git-tools to download the latest version.
Start shell.sh to open a new shell with the correct environment variables. You will see the text CROSS COMPILE SHELL as info.
You can run the x86 programs of your operation system as usual.
To close the environment just type exit. You will see the info CROSS COMPILE END.
Example: Compile the Raspberry Pi Linux Kernel
Download the Raspberry Pi Linux Kernel Source Code: linux.tar.xz
Start shell.sh to open the cross compile shell.
Extract the Linux Kernel Source Code with tar xfJ linux.tar.xz
Change to the Linux Kernel Source directory linux/.
Either run make bcmrpi_defconfig to get a minimal Raspberry Pi Kernel configuration or copy the .config file to the Linux Source Code directory to get an already configured Kernel configuration with modules.
Run make menuconfig to open the Kernel configuration tool. You can add and remove Kernel features.
Run make to compile the Kernel and the Kernel modules.
Run make modules_install to install the modules to the ../kernel-modules/ directory.
You find the Linux Kernel file in arch/arm/boot/ directory. The file name is zImage.
© 2017 by Elmar Hanlhofer