Home > Linux, Linux 3.0 > Linux Kernel 3.1.9 for Raspberry Pi Released & Build Instructions

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.

  1. In a terminal window, get the source code with git (Update: Added –depth=1 to speed up checkout following Dave Higham comment):
  2. Configure the kernel for the Raspberry Pi:

    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.
  3. Build the kernel:
  4. Build the kernel modules:

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.

  1. Download imagetool-uncompressed.py tool:
  2. Extract it in the directory where you ran git clone above:
  3. Run imagetool-uncompressed.py:

Now you should get 2 new files:

  • first32k.bin
  • kernel.img

kernel.img is a concatenation of first32k.bin (first 32KB) and linux/arch/arm/boot/Image.

  1. January 22nd, 2012 at 10:31 | #1

    Thanks for the tips.

    Alterations for Ubuntu Lucid:
    # before you get started
    sudo add-apt-repository ppa:linaro-maintainers/toolchain
    sudo apt-get update
    sudu apt-get install gcc-arm-linux-gnueabi

  2. Sander
    January 22nd, 2012 at 15:25 | #2

    Just checking: is it correct that the git clone command will process more than 1GB of data? See the quote below:

    “Receiving objects: 25% (577464/2274574), 280.50 MiB | 1.56 MiB/s”

  3. January 22nd, 2012 at 16:17 | #3

    It could be yes, the checkout took a few minutes.

  4. Dave Higham
    January 23rd, 2012 at 18:55 | #4

    git clone https://github.com/raspberrypi/linux.git –depth 1
    Cloning into ‘linux’…
    remote: Counting objects: 52569, done.
    remote: Compressing objects: 100% (44465/44465), done.
    remote: Total 52569 (delta 14187), reused 26753 (delta 7504)
    Receiving objects: 100% (52569/52569), 120.83 MiB | 755 KiB/s, done.
    Resolving deltas: 100% (14187/14187), done.

    I usually like to run these, just in case compiled uploaded
    make clean
    make mrproper
    make bcmrpi_cutdown_defconfigmake
    make uImage modules

    Then there is the python tool to create kernel.img out of uImage

  5. Benny
    February 9th, 2012 at 22:22 | #7

    Any chance to make this 3.1.9 kernel run under Qemu (as you describe it in another post with the 3.0.4 kernel)?

    Since the 3.1.9 kernel is not configured for the Versatile Family but for the Broadcom BCM2708 (System type -> ARM system type -> …) the config dependencies don’t allow to enable PCI and the PCI-SCSI adapter (SYM53C8XX).

    Any help is appreciated.

  6. February 9th, 2012 at 22:52 | #8

    @ Benny
    To use this kernel in qemu, you would have to configure it for versatile (not BCM2708).
    I suppose there is very little (nothing?) to gain from using this specific kernel in qemu. You could also use the default kernel 3.1.9 release instead of 3.0.4, apply the same patch and using the same config as in the previous post.

  7. Benny
    February 10th, 2012 at 02:45 | #9

    Small typo: Instead of “make ARCH=arm bcmrpi_cutdown_defconfigmake” it should read “make ARCH=arm bcmrpi_cutdown_defconfig”.

  8. February 10th, 2012 at 08:29 | #10

    @ Benny
    Thanks. Typo corrected.

  1. May 24th, 2012 at 10:55 | #1
  2. July 16th, 2012 at 20:28 | #2
  3. September 28th, 2012 at 04:42 | #3