Final Report: UEFI Support in LCFG (410)

UEFI boot mode has been supported by most of our hardware for a long time but legacy mode has also worked perfectly well so we have not felt any pressure to add support for UEFI mode. A number of factors combined recently to make this fairly urgent - machines which have an nvme-based SSD for the primary disk can only be booted using UEFI, some machines with very large disks do not boot in legacy mode and also the next SelectPC model is expected to only support UEFI.

The Work

The work broke down into 3 main areas:

1. Filesystem

UEFI requires a FAT32 partition (often referred to as the "esp" partition) which is mounted as /boot/efi and has to be flagged as bootable. Although the LCFG fstab component already has support for creating FAT partitions this is badly hobbled by legacy features. This led to the decision that it would be easier to add support for a new "esp" partition type which does exactly what is required. The mkparts tool used by the installer was modified to recognise the new partition type and set the boot flag.

2. Bootloader

Quite a bit of time was spent on getting the LCFG grub2 component to manage the EFI bootloader before I realised that this was normally unnecessary. Once the various grub2-efi packages are installed only the configuration file should ever be modified, there's no need to rebuild any of the bootloader binaries. So this mostly needed tweaks to the component to stop it changing things in ways that are necessary in legacy boot mode.

3. Installer

There was no work required on the LCFG installer itself but quite a bit of effort was spent on updating the PXE boot service to support UEFI. The latest version of syslinux had to be packaged as the version supplied in SL7 is ancient. For reasons which are unclear when PXE booting in UEFI mode the kernel and initramfs files could not be reliably fetched using TFTP so support had to be added for fetching via HTTP. This has the additional benefit of being much faster and more reliable in legacy mode.

Future Work

The LCFG installer ISO can only be booted in legacy mode. If we want support for UEFI booting the ISO, for example from a USB device, we will need to rework the scripts that generate the ISO to create the necessary partition scheme. This isn't currently a problem as the only time we need to boot the ISO is for testing with VMs - both KVM and virtualbox support legacy boot mode.

Currently UEFI boot can be enabled on a per-profile basis by defining USE_UEFI at the top of the profile. The default is to boot in legacy mode, at some point, probably when we upgrade to RHEL8/SL8 we will need to swap the default to being UEFI boot. This will require BIOS tweaks and repartitioning of the primary disk.

Effort

This project took 36 hours.

-- StephenQuinney - 09 Aug 2018

Topic revision: r2 - 10 Aug 2018 - 08:30:59 - StephenQuinney
 
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback
This Wiki uses Cookies