2025-04-25
Support for EFI Boot Stub was added in the 3.3x kernel series.
CONFIG_EFI_STUB must be enabled when the kernel is
compiled.
The kernel images shipped by Slackware include
CONFIG_EFI_STUB.
Copy the EFI Boot Stub enabled kernel to the ESP. If an initrd is
used, also copy this to the ESP. Rename the kernel copy on the ESP to
have a .efi extension.
Configure a UEFI profile for the new kernel. For a kernel only, no initrd image, booting /dev/sda1, something like this should work:
sudo efibootmgr -c -d /dev/sda -L "Slackware Linux" -l '\EFI\Linux\vmlinuz-6.14.3.efi' -u 'root=/dev/sda1 ro'
To boot with initrd from a LUKS encrypted LVM root:
sudo efibootmgr -c -d /dev/sda -L "Slackware Linux" -l '\EFI\Linux\vmlinuz-6.14.3.efi' -u 'cryptdevice=/dev/sda2:luks:allow-discards root=/dev/mapper/cryptvg-root resume=/dev/mapper/cryptvg-swap ro initrd=EFI/Linux/initrd-6.14.3.img'
/boot/efi/EFI/Linux/vmlinuz-generic-A.efi
/boot/efi/EFI/Linux/vmlinuz-generic-B.efi
/boot/efi/EFI/Linux/initrd-generic-A.img
/boot/efi/EFI/Linux/initrd-generic-B.img
sudo efibootmgr -c -d /dev/sda -L "Linux A" -l '\EFI\Linux\vmlinuz-generic-A.efi' -u 'cryptdevice=/dev/sda2:luks:allow-discards root=/dev/mapper/cryptvg-root resume=/dev/mapper/cryptvg-swap ro initrd=EFI/Linux/initrd-generic-A.img'
sudo efibootmgr -c -d /dev/sda -L "Linux B" -l '\EFI\Linux\vmlinuz-generic-B.efi' -u 'cryptdevice=/dev/sda2:luks:allow-discards root=/dev/mapper/cryptvg-root resume=/dev/mapper/cryptvg-swap ro initrd=EFI/Linux/initrd-generic-B.img'
sudo cp /boot/vmlinuz-generic /boot/efi/EFI/Linux
sudo /usr/share/mkinitrd/mkinitrd_command_generator.sh -k <NEW_KERNEL_VERSION>
sudo /sbin/mkinitrd [...] -o /boot/efi/EFI/Linux/initrd-generic.img
Steps 2-4 can be completed using efi-boot-update.sh.
Determine which kernel is currently booted (A or B).
Copy the new vmlinuz-generic and generated initird-generic.img over the not-booted kernel and initrd images.
Set the not-booted EFI profile as the next boot option.
If the system doesn't boot, reboot into the BIOS to select the previously working kernel.