Raspberry Pi/Mainline Kernel
This guide is intended as a supplement to Install Guide and an alternative to Raspberry Pi Kernel.
This guide is accurate as of kernel 4.13 and newer, and tested on the Raspberry Pi 2 and newer.
Build tools
root #
emerge --ask sys-apps/dtc
Fetch sources
root #
emerge --ask sys-kernel/vanilla-sources
For the rest of this example, I will be assuming vanilla-sources-4.14.21.
root #
cd /usr/src/linux-4.14.21
Configure the kernel
Raspberry Pi 2
root #
make multi_v7_defconfig
Note: multi_v7_defconfig will enable more than you need, but it is currently the most appropriate included defconfig to choose from.
Raspberry Pi 3 (32 bit)
root #
make multi_v7_defconfig
Note: multi_v7_defconfig will enable more than you need, but it is currently the most appropriate included defconfig to choose from.
Build the kernel
If you're not building this on an armv7 machine / VM see cross build environment and adjust the instructions as necessary.
Ensure you've mounted your /boot partition before running the install phase.
root #
make
root #
make zinstall modules_install dtbs_install
Configuring bootloader
Contrary to popular belief, you don't need u-boot to boot the mainline kernel, just populate the appropriate required files:
Raspberry Pi 2
kernel=vmlinuz-4.14.21
device_tree=dtbs/4.14.21/bcm2836-rpi-2-b.dtb
avoid_warnings=2
root=/dev/mmcblk0p3 rw rootwait elevator=noop cma=256M@512M
You can specify the root as a device or via PARTUUID, just ensure it's accurate for your system.
Raspberry Pi 3 (32 bit)
kernel=vmlinuz-4.14.21
device_tree=dtbs/4.14.21/bcm2837-rpi-3-b.dtb
avoid_warnings=2
root=/dev/mmcblk0p3 rw rootwait elevator=noop cma=256M@512M
You can specify the root as a device or via PARTUUID, just ensure it's accurate for your system.
Installing firmware
Finally, until rpi-open-firmware is ready, you'll need to copy the following binary blobs from raspberrypi-firmware to your /boot partition.
- bootcode.bin
- start.elf
- fixup_*.dat
- start_*.bin