Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for building RasperryPi kernels #33

Open
petaflot opened this issue Dec 27, 2022 · 0 comments
Open

Support for building RasperryPi kernels #33

petaflot opened this issue Dec 27, 2022 · 0 comments

Comments

@petaflot
Copy link

petaflot commented Dec 27, 2022

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant