I am trying to compile and build a kernel image for Raspberry Pi.

I build my customized cross compiler tool-chain for Raspberry Pi using Buildroot. Successfully I got all tools which I needed. I found a Linux header 4.1.5 in dl directory of Buildroot.

Now I want to compile the kernel image using this toolchain. I downloaded Linux-4.1.5 kernel source and I am verifying kernel support for Raspberry Pi board by entering in linux-4.1.5/arch/arm/configs but there is no any config file related to Raspberry Pi.

My doubt is: is linux-4.1.5 supported by Raspberry Pi or not? How can I know which kernels versions are supported by Raspberry Pi?


I made a buildroot-image some days ago, and this image are using "linux version 4.4.36-v7".

I used the "recipe": https://github.com/gamaral/rpi-buildroot.

The only thing not working (as I can see today), are the Touchscreen (official RPi 7" display).


For whatever reason,1 the kernel predominantly used on the Pi is compiled from sources that aren't integrated into the mainline Linux kernel, so don't use that.

The Pi fork is available via the Foundation's github repo:


Beware the default branch on the web interface currently seems to be 4.4, but if you look in the "branch" pulldown on the side there are ones for every minor version from 3.8 up to 4.9 (there's 3.2 and 3.6 as well). If you are going to download a zip, you'll have to choose which you want. The one used by Raspbian right now is 4.8.y.

However, if you git it:

git clone https://github.com/raspberrypi/linux

You can then

git fetch
git branch -a 

And checkout/pull whichever one you want.

It's the same source regardless of whether you are building the ARMv6 or ARMv7 version, but you must configure for one or the other. To get the default, I believe for ARMv6

make bcm2835_defconfig

And for v7:

make bcm2709_defconfig

1. The fact that you can download the source and compile it implies it isn't really a licensing issue (although perhaps it is). The fact that Fedora now have a version of their ARMv7 distribution specialized for the Pi but using, AFAICT, the official Linux kernel, and that this kernel still doesn't support things like the SoC's soundsystem, implies some stuff may have been integrated into it from the Raspberry Pi Foundation kernel, and the claim there that getting this "supported in the upstream kernel...is one of the big items on the ToDo list" (who's?) further implies somebody is making an active effort to do that.

I suspect the major reason is a lack of desire, and keeping it separate may be a good thing. But this is all just conjecture and not anything I've investigated. In any case, unlike various other similar ARM boards, The Foundation's kernel source is at least available and kept pretty up-to-date.


Use the rpi-source tool from https://github.com/notro/rpi-source to get the kernel source that matches the kernel installed on your Raspbian system.


Note: this answer is similar to @goldilocks's answer.

The Raspberry Pi kernel documentation explains why the Raspberry Pi Foundation distributes the Linux sources separately. In any case, the kernel headers must be the same version or be older than the running kernel (backward compatibility).

The following documentation may be of interest.

You may use this Git command to retrieve a particular branch or kernel version.

git clone --depth=1 --branch rpi-4.1.y https://github.com/raspberrypi/linux

Note: the RPi kernel is already patched.

  • Not that it matters much to the actual question, but "The Raspberry Pi kernel documentation explains why the Raspberry Pi Foundation distributes the Linux sources separately" -> Where? Not on the page you linked. They explain a bit of how it is kept separate, but not why.
    – goldilocks
    Oct 4 '19 at 9:57
  • @goldilocks: "The main Linux kernel is continuously updating; we take long-term releases of the kernel, which are mentioned on the front page, and integrate the changes into the Raspberry Pi kernel. We then create a 'next' branch which contains an unstable port of the kernel; after extensive testing and discussion, we push this to the main branch."
    – user109777
    Oct 4 '19 at 10:27
  • That's what I meant by how, and it is not incompatible with how the vanilla kernel itself is developed and released (or for that matter, software in general). I'm only nitpicking because I loathe the idea of another pi community meme spreading whereby people claim, "the pi kernel isn't mainlined because...". I don't think any reason beyond "it's easier for us that way" is required, but I suspect there are some more concrete reasons as well (not secret or anything, just not particularly interesting or necessary to most readers of the docs).
    – goldilocks
    Oct 4 '19 at 13:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.