Linux Kernel 3.1.9 for Raspberry Pi Released & Build Instructions
Raspberry Pi has just announced the release of a fork a linux kernel 3.1.9. The source code with patches is available at https://github.com/raspberrypi/linux.
If you just want to download the patch, I’ve created one: r-pi_linux_3.1.9.patch.gz
The code related to Broadcom BCM2835 processor is referred as bcm2708 in the kernel and I can see committed related to the watchdog timer, the framebuffer, the VCHIQ driver (the driver sending messages to the GPU) and general commits for bcm2708.
For those interested in the messages used to communicate between userspace and the GPU, the VCHIQ driver code is located at drivers/misc/vc04_services in the tree. I haven’t studied it yet, but as the platform should support graphics standards such as OpenGL and OpenMAX IL, most people should not really care about this interface as I suppose the OpenGL library (Mesa?) uses this driver.
Here are the build instructions for Raspberry Pi kernel. I cross-compiled it in Debian Squeeze with the Emdebian armel toolchain.
- In a terminal window, get the source code with git (Update: Added –depth=1 to speed up checkout following Dave Higham comment):
Shell1git clone git://github.com/raspberrypi/linux.git --depth=1
- Configure the kernel for the Raspberry Pi:
Shell123cd linuxmake ARCH=arm bcmrpi_cutdown_defconfigmake ARCH=arm menuconfig
go to “General Setup —>Cross-compiler tool prefix” to set your compiler prefix. I used “arm-linux-gnueabi-” with the Emdebian toolchain. Then exit and save.
- Build the kernel:
- Build the kernel modules:
Shell12mkdir ../modulesmake ARCH=arm INSTALL_MOD_PATH=../modules modules_install
Update: Thanks to commenters and some research with Google, I found out that the Raspberry Pi boots with a file called kernel.img generated with imagetool-uncompressed.py tool. Here’s how to generate it.
- Download imagetool-uncompressed.py tool:
- Extract it in the directory where you ran git clone above:
Shell1tar xjvf rpi_tools.tar.bz2
- Run imagetool-uncompressed.py:
Shell12cd toolspython imagetool-uncompressed.py
Now you should get 2 new files:
kernel.img is a concatenation of first32k.bin (first 32KB) and linux/arch/arm/boot/Image.