Skip to content

Installation of kernel from deb package (Raspberry Pi OS)

Kevin Doren edited this page Oct 2, 2021 · 21 revisions

We'll need to first install the desired deb package using apt, then set the bash variable KERN to the release being installed. The instructions below are all run as root ("sudo su" to become root) In this example, KERN=5.10.59-rt51-v7l+

To install from 32-bit .deb package, first install the desired deb package file (change as appropriate:

apt install ./linux-image-5.10.59-rt51-v7l+_5.10.59-1_armhf.deb

Then set bash variable KERN to the release being installed (change as appropriate):

KERN=5.10.59-rt51-v7l+

Then run the following commands (copy and paste the entire block):

mkdir -p /boot/$KERN/overlays/
cp -d /usr/lib/linux-image-$KERN/overlays/* /boot/$KERN/overlays/
cp -dr /usr/lib/linux-image-$KERN/* /boot/$KERN/
[[ -d /usr/lib/linux-image-$KERN/broadcom ]] && cp -d /usr/lib/linux-image-$KERN/broadcom/* /boot/$KERN/
touch /boot/$KERN/overlays/README
mv /boot/vmlinuz-$KERN /boot/$KERN/
mv /boot/initrd.img-$KERN /boot/$KERN/
mv /boot/System.map-$KERN /boot/$KERN/
mv /boot/config-$KERN /boot/$KERN/
cat >> /boot/config.txt << EOF

[all]
kernel=vmlinuz-$KERN
# initramfs initrd.img-$KERN followkernel
os_prefix=$KERN/
overlay_prefix=overlays/$(if [[ "$KERN" =~ 'v8' ]]; then echo -e "\narm_64bit=1"; fi)
[all]
EOF

Then reboot.

$ uname -a
Linux jambox 5.10.59-rt51-v7l+ #1 SMP PREEMPT_RT Fri Aug 20 20:28:57 PDT 2021 armv7l GNU/Linux

multiple kernels, including both 32-bit and 64-bit can be installed on a 32-bit system. In that case, in config.txt, change [all] to [none] at beginning of config.txt section for all but the desired boot kernel.