Recently I have been working with more and more Raspberry Pi single board computers and as a person who likes the Linux Gentoo distribution I got the urge to make a bare minimum kernel. These are basically some notes based on what I have learned trying to build a bare-bones custom kernel for the Raspberry Pi.
If you find issues with this kernel config, or find something I missed, please let me know in a comment so I can take a look into it and update information.
I am not going to go quite into detail how to build a kernel and such, this guide is just a reference to what drivers I found are necessary for a bare bones kernel, without any extra drivers. The only extra things I think I added is for some USB-Serial drivers, since they are required for my application, they can be safely removed.
This is using the Raspberry Pi kernel sources sys-kernel/raspberrypi-sources-4.19.9999, emerge or update this before proceeding. Also to note, this is for a 32-bit kernel. I have not been able to get this to work on the new Raspberry Pi 4 yet, it just won’t boot… I will try to figure out why at a later date.
The version that I have installed now is 4.19.86, and this configuration is for that version. You should be able to use this with newer kernel versions, just use make oldconfig before using make menuconfig.
I started with a minimum kernel with almost no drivers included, and slowly added the drivers necessary to obtain the functionality required, trying to get drivers for all the hardware on the board. This process of building, checking, rebuilding took several full days and I would like to document what I found out is the minimum install necessary.
I am not quite confident the sound drivers are correct yet, but will hopefully get a chance to test this in the future.
This kernel config posted here works with the following hardware, since it is what I had on hand to test with:
+ Raspberry Pi Zero W
+ Raspberry Pi Zero WH
+ Raspberry Pi 3 Model B
+ Raspberry Pi 3 Model B Plus
In order to get the display to work right on the Raspberry Pi Zero W I had to edit the config.txt file on the boot partition and uncomment this line at the bottom… not sure why yet… only the Raspberry Pi Zero W appears to need it.
I started working with a Raspberry Pi 3 Model B, then after that was working moved onto testing on the Zero W and 3 Model B Plus. Below is some detail of things I found to be specific to a specific platform…
Device Drivers – Network Device Support – USB Network Adapters – Multi-purpose USB Networking Framework – SMSC LAN95XX based USB 2.0 10/100 ethernet devices
+ Wired ethernet for Raspberry Pi 3B
Device Drivers – USB support – Synopsis DWC host support
+ USB for Raspberry Pi Zero W
Device Drivers – Network Device Support – USB Network Adapters – Microchip LAN78XX Based USB Ethernet Adapters
+ Wired ethernet for Raspberry Pi 3B Plus
Device Drivers – Network Device Support – Wireless LAN – Broadcom devices – Broadcom FullMAC WLAN driver
+ Wireless LAN driver
Device Drivers – Network Device Support – Wireless LAN – Broadcom devices – SDIO bus interface support for FullMAC driver
+ Wireless LAN driver support