Skip to content

Installation of kernel from deb package (Ubuntu)

Kevin Doren edited this page Oct 2, 2021 · 12 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 .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). This will replace the entire file config.txt, for installing an alternate kernel on stock Ubuntu system. For installing a 2nd alternate kernel, hand editing of config.txt will be required.

mkdir -p /boot/firmware/$KERN/overlays/
cp -d /usr/lib/linux-image-$KERN/overlays/* /boot/firmware/$KERN/overlays/
cp -dr /usr/lib/linux-image-$KERN/* /boot/firmware/$KERN/
[[ -d /usr/lib/linux-image-$KERN/broadcom ]] && cp -d /usr/lib/linux-image-$KERN/broadcom/* /boot/firmware/$KERN/
touch /boot/firmware/$KERN/overlays/README
cp /boot/vmlinuz-$KERN /boot/firmware/$KERN/
cp /boot/System.map-$KERN /boot/firmware/$KERN/
cp /boot/config-$KERN /boot/firmware/$KERN/
cp /boot/initrd.img-$KERN /boot/firmware/$KERN/
cp /boot/firmware/config.txt{,.bak}
cat > /boot/firmware/config.txt << EOF
[pi4]
max_framebuffers=2

[all]
cmdline=cmdline.txt

# Enable the audio output, I2C and SPI interfaces on the GPIO header
dtparam=audio=on
dtparam=i2c_arm=on
dtparam=spi=on

# Enable the serial pins
enable_uart=1

# Comment out the following line if the edges of the desktop appear outside
# the edges of your display
disable_overscan=1

# If you have issues with audio, you may try uncommenting the following line
# which forces the HDMI output into HDMI mode instead of DVI (which doesn't
# support audio output)
#hdmi_drive=2

# If you have a CM4, uncomment the following line to enable the USB2 outputs
# on the IO board (assuming your CM4 is plugged into such a board)
#dtoverlay=dwc2,dr_mode=host

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

EOF

Then reboot.

$ uname -a
Linux ubuntu 5.10.59-rt51-v7l+ #1 SMP PREEMPT_RT Fri Aug 20 20:28:57 PDT 2021 armv7l armv7l 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.

Clone this wiki locally