Skip to content

Support for building RasperryPi kernels #33

Description

@petaflot

AFAIK genkernel doesn't know how to properly build and install kernels for RaspberryPi hardware. At te moment, I'm using one of these two scripts depending on the platform:

cat /usr/src/rpi4_kernel_build.sh
#!/bin/bash

# make and install kernel for RaspberryPi 4 hardware

KERNEL=kernel8

cd linux
# I like to clean manually iif required
#make clean
#make mrproper
make -j 4 bcm2711_defconfig && make prepare && make oldconfig && make menuconfig && make -j 4
make -j 4 modules dtbs
make modules_install

#cp -v arch/arm64/boot/Image /boot/kernel8-p4.img
cp -v arch/arm64/boot/Image /boot/kernel8.img
cp -v arch/arm64/boot/dts/broadcom/bcm2711-rpi-4-b.dtb /boot/

cp arch/arm64/boot/dts/broadcom/*.dtb /boot/
cp arch/arm64/boot/dts/overlays/*.dtb* /boot/overlays/
cp arch/arm64/boot/dts/overlays/README /boot/overlays/
naspi ~ # cat /usr/src/rpi_kernel_build.sh
#!/bin/bash

# make and install kernel for RaspberryPi <=3 hardware

# building rpi3 kernel (needed anyway AFAIK)
cd linux
make distclean
make bcmrpi3_defconfig

# options for Rpi3 kernel ; I usually do this by hand all the time
# make menuconfig

nice -n 19 make -j4 Image modules dtbs

# now as root
cp -v arch/arm64/boot/Image /boot/kernel8.img
cp -v arch/arm64/boot/dts/broadcom/bcm{2710,2837}-rpi-3-b.dtb /boot/
cp -v arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b-plus.dtb /boot/
cp -v arch/arm64/boot/dts/broadcom/bcm2710-rpi-cm3.dtb /boot/

cp -rv arch/arm64/boot/dts/overlays/ /boot/

make modules_install
sync

# now configure and build Rpi4 kernel
make distclean
make bcm2711_defconfig
make menuconfig

read -p "Make sure to set CONFIG_LOCALVERSION to something distinct (like "-2711") to ensure the release names of the two kernels are distinct - you don't want their modules getting co-mingled in /lib/modules/<kernel-release-name>/.... Make any other changes you want, then save and exit the configuration tool, and hit [enter]"

nice -n 19 make -j4 Image modules dtbs

cp -v arch/arm64/boot/Image /boot/kernel8-p4.img
cp -v arch/arm64/boot/dts/broadcom/bcm2711-rpi-4-b.dtb /boot/
make modules_install

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions