10.5. Using Systemd-boot to Set Up the Boot Process

[Note]

Note

If your system has UEFI support and you wish to boot LFS with UEFI, you need to prepare 4 additional packages from the BLFS Book https://www.linuxfromscratch.org/blfs/view/systemd/postlfs/dosfstools.html , https://www.linuxfromscratch.org/blfs/view/systemd/postlfs/popt.html , https://www.linuxfromscratch.org/blfs/view/systemd/postlfs/efivars.html and https://www.linuxfromscratch.org/blfs/view/systemd/postlfs/efibootmgr.html.

10.5.1. Installing Systemd-boot

Setup some helpful bash variables

ROOT=$(blkid -o value -s UUID /dev/sda3)
ROOTPART=$(blkid -o value -s PARTUUID /dev/sda3)

Mount the EFI System Partition (esp) and system firmware, by issuing the following commands:

mountpoint /sys/firmware/efi/efivars || mount -v -t efivarfs efivarfs /sys/firmware/efi/efivars
mount --mkdir -v -t vfat /dev/sda1 -o codepage=437,iocharset=iso8859-1 /boot/efi

Install the Systemd-boot files into /boot/efi and set up the boot track:

bootctl install
cp -iv /boot/vmlinuz-7.1.7-lfs-r13-178-systemd /boot/efi/vmlinuz-7.1.7

10.5.2. Creating the Systemd-boot Configuration File

Generate /boot/efi/loader/entries/lfs.conf:

mkdir -pv /boot/efi/loader/entries
cat > /boot/efi/loader/entries/lfs.conf << EOF
title Zirconium Linux From Scratch
linux   /vmlinuz-7.1.7
options root=PARTUUID=$ROOTPART rw
EOF

Checking the configuration setup:

bootctl status

efibootmgr | cut -f 1