Raspberry Pi - Upgrade kernel from repos

From Alpine Linux

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 1B+, 512M 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.

1. Generate boot files, including the new kernel in sys mode.

2. 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.