1

I noticed that when we compile a new kernel following the official documentation we use the linux fork from the raspberry foundation. Could I use the mainline kernel maintained by linus? Or is there some sort of  important difference between the 2? I don't really understand why the raspberry foundation maintains its own fork

3 Answers 3

1

If you use the mainline kernel, you will miss all the Pi-specific patches which fix the issues unique for the Pi hardware. Some devices may not be initialized properly, or you may experience quirks if you try to use them.

You may also have to include all VideoCore-related steps in your build process, which is of no interest to Linux in general since VideoCore is proprietary.

0

When you compile the linux kernel for an specific platform, you must provide the architecture configuration (or configure entirely by yourself), located at arch/<architecture_name>/configs.

Providing this configuration, the kernel will be preconfigured for an specific board (eg. arm/imx_v6_v7_defconfig) and it will be faster and easier to compile the kernel because the major board configuration is done, and you only need to change some options based in your hardware/requeriments.

For example, the official documentation of Raspberry Pi says that for configuring the kernel you must use:

32-bit configs:

  • RPi1, Pi Zero, Pi Zero W or Compute Module use bcmrpi_defconfig

  • RPi2, Pi3, Pi3+ or Compute Module 3 uses bcm2709_defconfig

  • RPi4 uses bcm2711_defconfig

64-bit configs:

  • RPi3, Pi3+ or Compute Module 3 uses bcmrpi3_defconfig

  • RPi4 uses bcm2711_defconfig

If you want to compile your own mainline based kernel, you could start by taking a look at these configs.

Therefore, the main reason why you use the RaspberryPi fork it's because all is preconfigured and optimised to this specific board (eg. type of processor, buses, GPIO, memories, etc...).

Could you use the mainline kernel?

Yes, but you will have to configure the kernel entirely by yourself using make ARCH=<arm or arm64> CROSS_COMPILE=<arm-linux-gnueabihf- or aarch64-linux-gnu-> menuconfig, and as Dmitry Grigoryev answer states you will miss some specific Raspberry pi patches.

You can find more documentation about patching the Linux kernel in the Raspberry Pi official docs.

3
  • Use the Raspberry Pi fork at: github.com/raspberrypi/linux
    – Dougie
    Aug 30, 2021 at 18:57
  • Please provide additional details in your answer. As it's currently written, it's hard to understand your solution.
    – Community Bot
    Aug 30, 2021 at 18:58
  • I've added some details about the question, now I think it will be more clear! Aug 31, 2021 at 7:30
0

Yes, you can. Here is a regularly updated list of what currently works with the latest mainline Kernel: https://github.com/lategoodbye/rpi-zero/issues/43

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.