Notes on booting Slackware using Linux's EFI boot stub

2025-04-25

Kernel Configuration

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.

EFI Setup

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.

UEFI Profile

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'

Production Setup on clockwork

/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'

Upgrade

General upgrade process

  1. Copy the new kernel image to the ESP.

sudo cp /boot/vmlinuz-generic /boot/efi/EFI/Linux

  1. Run mkinitrd, copy the initrd image to the ESP
sudo /usr/share/mkinitrd/mkinitrd_command_generator.sh -k <NEW_KERNEL_VERSION>
sudo /sbin/mkinitrd [...] -o /boot/efi/EFI/Linux/initrd-generic.img
  1. If the filenames of the kernel or initrd images have changed, run efibootmgr to add a new profile with the new kernel and initrd.

Production Upgrade on clockwork

  1. Upgrade the installed kernel-generic Slackware package.

Steps 2-4 can be completed using efi-boot-update.sh.

  1. Determine which kernel is currently booted (A or B).

  2. Copy the new vmlinuz-generic and generated initird-generic.img over the not-booted kernel and initrd images.

  3. Set the not-booted EFI profile as the next boot option.

  4. If the system doesn't boot, reboot into the BIOS to select the previously working kernel.