The purpose of this article is to inform the user about necessary kernel options for booting from UEFI, and some info about how ELILO and perhaps other EFI bootloaders work, as this is currently difficult to find and understand online.
The following options are required for booting a kernel from UEFI. These are already set in the stock Slackware kernels.
as it is deprecated in favor of CONFIG_EFIVAR_FS, because it has a 1024-byte variable size limit, and because it can cause data inconsistency issues.
However, if you do disable this, you will need a fork of the efibootmgr
program that supports the new EFI Variable filesystem.
In order to use the new EFI variable filesystem interface, you need to remove the old efibootmgr
program and replace it with a new one that supports the EFI variable filesystem.
modprobe efivarfs mount -t efivarfs efivarfs /sys/firmware/efi/efivars efibootmgr
In order to boot from UEFI you need to create an EFI System Partition (ESP) using gdisk
or cgdisk
instead of the old fdisk
and cfdisk
. The Slackware README_UEFI.TXT recommends a size of 100M, which is also the minimum partition size (except for 4K native drives, where it is 260M). You also need to set the partition hex code to EF00
, which identifies it as the ESP.
During the install procedure of Slackware 14.1 or above for ELILO (the eliloconfig
script), the following happens and is required for booting from UEFI using ELILO.
/boot/efi
. This is a special FAT partition that is basically the UEFI firmware replacement of what the MBR was for BIOS. However, it can not only hold a bootloader (all the MBR was capable of), but also config files, the kernel, and other things you might want to access using the UEFI firmware./boot/efi/EFI/Slackware
. These include:elilo.efi
elilo.conf
vmlinuz
efibootmgr
. The exact command that is run is EFIDISK=$(df /boot/efi/ |awk 'END{printf("%s\n",$1)}') EFI_DEVICE=$(sed 's%[0-9]\+$%%;s%\([0-9]\)p%\1%' <<< $EFIDISK) EFI_PARTITION=$(sed 's%.*[a-z]\([0-9]\+\)$%\1%' <<< $EFIDISK) efibootmgr -q -c -d $EFI_DEVICE -p $EFI_PARTITION -l "\\EFI\\Slackware\\elilo.efi" -L "Slackware"
so if mount
outputs
/dev/sda1 on /boot/efi type vfat (rw)
EFI_DEVICE would be /dev/sda
and EFI_PARTITION would be 1
, each components of /dev/sda1
, which is the ESP.
/EFI/boot/bootx64.efi
. This special location allows the UEFI firmware to run the bootloader without any boot entry.
This task is now much easier than it used to be. All you really need to do is copy vmlinuz
onto the ESP on top of the old kernel. No need to edit any configs or add any boot entries, unless you want to. Note that you can edit the config in place and ELILO will pick up the changes on next boot, no need to run any commands like with the old lilo.
As all UEFI firmware has a flashing utility built-in, it is now much easier to update the firmware. All you have to do is copy the new firmware onto the ESP and the UEFI firmware should recognize it when you go to the flashing utility menu. However, remember that flashing the firmware can still potentially brick the system, especially if it is interrupted during the flashing process.
This can happen either after updating the UEFI firmware or after replacing the CMOS battery. There are three main ways to fix it:
elilo.efi
→ /EFI/boot/bootx64.efi
elilo.conf
→ /EFI/boot/elilo.conf
vmlinuz
→ /EFI/boot/vmlinuz
/
NOT /EFI
).bcfg boot add 0 fs0:\EFI\Slackware\elilo.efi Slackware