This is a step towards supporting unified kernel images (UKI) in Grub. Add a new module named bli, which provides a command with the same name. It implements a small but quite useful part of the Boot Loader Interface [0]. This interface uses EFI variables for communication between the boot loader and the operating system.
This module sets two EFI variables under the vendor GUID 4a67b082-0a4c-41cf-b6c7-440b29bb8c4f: - LoaderInfo: contains GRUB + <version number>. This allows the running operating system to identify the boot loader used during boot. - LoaderDevicePartUUID: contains the partition UUID of the EFI System Partition (ESP). This is used by systemd-gpt-auto-generator [1] to find the root partitions (and others too), via partition type IDs [2]. This is especially useful for UKIs, where the kernel command line is fixed and usually does not contain any information about the root partition. This module is only available on EFI platforms. [0] https://systemd.io/BOOT_LOADER_INTERFACE/ [1] https://www.freedesktop.org/software/systemd/man/systemd-gpt-auto-generator.html [2] https://uapi-group.org/specifications/specs/discoverable_partitions_specification/ v2: - Addressed comments from Daniel - Added a print function for gpt guids - Added integer overflow check in UTF16 conversion - Added config drop-in file that loads the module on EFI v1: https://mail.gnu.org/archive/html/grub-devel/2023-01/msg00104.html Oliver Steffen (7): efi: add grub_efi_set_variable_with_attributes efi: check for integer overflow in string conversion Add a module for the Boot Loader Interface util/grub.d: activate bli module on EFI partmap/gpt: add print function for guids commands/probe: use grub_gpt_part_guid_snprint commands/bli: use grub_gpt_part_guid_snprint grub-core/Makefile.core.def | 6 + grub-core/commands/bli.c | 209 ++++++++++++++++++++++++ grub-core/commands/probe.c | 11 +- grub-core/kern/efi/efi.c | 25 ++- grub-core/partmap/gpt.c | 13 ++ include/grub/efi/api.h | 5 + include/grub/efi/efi.h | 6 + include/grub/gpt_partition.h | 6 + util/grub.d/25_boot_loader_interface.in | 34 ++++ 9 files changed, 300 insertions(+), 15 deletions(-) create mode 100644 grub-core/commands/bli.c create mode 100644 util/grub.d/25_boot_loader_interface.in -- 2.39.2 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel