Systemd-boot

systemd-boot, formerly called gummiboot, is Article description::a minimal UEFI boot manager which loads EFI executables.

Features

 * No extra package installation (with systemd profile).
 * Integration with systemd with the command.
 * Ability to select next boot.
 * Easy and simple configuration files which can be generated automatically.
 * Auto add Windows and BIOS setup entries.
 * Change timeout, default entry, edit command line options on the fly from boot menu.

Kernel Configuration
Because systemd-boot can only load EFI executables, the desired kernel must support EFI stub (CONFIG_EFI_STUB=y):

Installation
Since systemd 220 systemd-boot is included in package.

OpenRC
Install the package:

systemd
(Re)emerge with  :

Installation to ESP (EFI system partition)
First make sure the system booted in UEFI mode. If following command gives error, then reboot in UEFI mode.

To dual boot with Windows, make sure to use same ESP for both Windows & Linux.

In this case there are two ESPs, administrator knows sdX1 is Windows' and sdX5 is Linux's ESP. To dual-boot, install systemd-boot to Windows' ESP.

Last command will install necessary files into ESP and move systemd-boot to top in boot order.

Configuration
Overview:


 * Main configuration for systemd-boot is done in
 * Boot menu entries are generated for each file ending with  located in
 * EFI executable files (Kernel) and initramfs files can be placed anywhere in ESP.

loader.conf
File is located in. Although it is well documented in, here is the example:

The name of the default entry is the file name of the menu entry file, as created in the next section, without the suffix.

Menu entry files
These files needs to be located in with  extension. Boot menu will show entry for each file.

Following is an example menu entry file named "gentoo-sources-kernel" where the kernel and initramfs are at and  respectively:

For more options please refer Bootloader Specification

Automatically generate entries
Manually writing menu entry files every time the kernel is updated can be quite troublesome. There's a way to automatically generate menu entry files just after installing a kernel. For that, first install. Now, when installing a kernel it'll generate menu entry .conf file.

As this package uses command in backend, refer to  for further customize this automation.

Configuration in boot menu
The default entry, increase/decrease timeout, edit command line options, and change resolution are accessible right from boot menu. Refer to ’s KEY-BINDINGS section for keyboard shortcuts.

Setting a password
A project called systemd-boot-password exists in order to set a password on the systemd-boot menu. This is to prevent unauthorized changes to the kernel command-line and/or other boot parameters, which could compromise controls around system security. As of 2022-12-13, systemd-boot-password is not available in the ::gentoo ebuild repository, and must be manually installed.

Other secondary bootloaders such as GRUB have password protection features as well.

Updating process
Even though package is handled by Portage, necessary files in ESP should be updated every time package is updated. To set this up easily with Portage, create following file:

Solve low space with extended boot
Placing multiple kernel, initramfs files alongside with Windows files on same partition (if dual-booting) can cause lack of space and result in errors while installing kernel.

Solution is to separate "Extended Boot Loader Partition" (XBOOTLDR) from ESP. So XBOOTLDR will have relatively big kernel and initramfs along with menu entry files, while and small necessary files for systemd-boot will be on ESP.

XBOOTLDR partition is same as ESP (with FAT filesystem), just a different partition GUID of  needs to be used.

External resources

 * Systemd Boot Loader Specification
 * ArchWiki systemd-boot