Raspberry Pi/Kernel Compilation

The Raspberry Pi Linux Kernel
The Raspberry Pi cannot run a vanilla Linux kernel. A patched version of the kernel is maintained by the Raspberry Pi Foundation and is available from their github https://github.com/raspberrypi

Install the Prerequisites
To compile a kernel, you require git to download the source code and genkernel to manage the build process.

Default Kernel
In this example the configuration options from the running kernel are used to compile the new kernel. This step will take about 6 hours to compile.

After the kernel has compiled it will be installed into the /boot/ folder.

Adding New Kernel to Bootloader
By default the Raspberry Pi looks for a kernel /boot/kernel.img, this is changed in the config /boot/config.txt to load the new kernel.

Now the Raspberry Pi can be rebooted and should make use of the new kernel. If for some reason the new kernel does not load or gives errors, the kernel entry in the /boot/config.txt can be removed. Then on the next reboot the default kernel.img will be loaded.