Raspberry Pi - Upgrade kernel from repos
In diskless setups the kernel upgrade is not part of the regular upgrade process. To do that, one can get the new kernel from the latest release tarball.
However, if you need a newer kernel that is available in the repositories but is not yet part of a release, you might consider using the update-kernel
script.
The catch is, on a Raspberry Pi 3, 1GB of RAM is not enough to successfully run it.
Also, the script doesn't work in diskless mode because of the read-only modloop mount.
There is a workaround, though.
- Generate boot files, including the new kernel in sys mode.
- Transfer boot files to the target diskless mode microSD card.
Generate boot files
Grab a fresh microSD card and install Alpine Linux on it.
Boot it on a Raspberry Pi, install the system in sys mode by running setup-disks
and reboot.
Log in as root, then run update-kernel as follows.
This will take a while.
mkdir /root/tmp mkdir /root/boot TMPDIR=/root/tmp update-kernel -a armhf -f rpi -M /root/boot
All files necessary to boot the newest kernel available in repos are now in /root/boot.
Transfer boot files
Copy all files from /root/boot to the target microSD card's root. The Pi should be able to boot from this card and the kernel should now be upgraded.
Adding kernel modules and firmware
You can also add modules by using the -p
switch, followed by the package name.
For example, if you wanted to include the ZFS kernel module, you would change the above update-kernel
command line to the following:
TMPDIR=/root/tmp update-kernel -a armhf -f rpi -p zfs-rpi -M /root/boot
This will add the specified modules into the modloop
volume.