Skip to content

Add basic Boot Loader Interface support

Oliver Steffen grub-devel 9 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v9 Latest11 patches 46 repliesIn review
  2. v810 patches 1 replySuperseded
  3. v710 patches 2 repliesSuperseded
Earlier versions · 6
VersionPostedPatchesRepliesStatus
v69 patches0 repliesSuperseded
v58 patches10 repliesSuperseded
v48 patches0 repliesSuperseded
v310 patches7 repliesSuperseded
v27 patches7 repliesSuperseded
v12 patches7 repliesSuperseded

Changes in v9 from the cover letter

- Rebase to latest master branch
- Fix error handling in bli.c: get_part_uuid()
And with that fix the NULL pointer issue discovered by Coverity
- Add NULL checks to grub_device_close() and grub_disk_close() These are not strictly needed anymore with the changed error handling in get_part_uuid().
I leave the fate of this patch at the maintainer's discretion.

Patches in v9 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11efi: Add grub_efi_set_variable_with_attributes()grub-core/kern/efi/efi.c include/grub/efi/efi.h+19 -70 replies
2/11Unify GUID typesgrub-core/commands/acpi.c grub-core/commands/efi/efifwsetup.c grub-core/commands/efi/loadbios.c +34 more+130 -14845 replies
3/11kern/misc: Add a format specifier GUIDsgrub-core/kern/misc.c+60 -210 replies
4/11grub-core: Make use of guid printf format specifiergrub-core/commands/efi/lsefi.c grub-core/commands/efi/lsefisystab.c grub-core/commands/probe.c +2 more+10 -580 replies
5/11types.h: Add GRUB_SSIZE_MAXinclude/grub/types.h+2 -00 replies
6/11kern/misc, kern/efi: Extract UTF-8 to UTF-16 codegrub-core/kern/efi/efi.c grub-core/kern/misc.c include/grub/misc.h+41 -150 replies
7/11efi: Add grub_efi_set_variable_to_string()grub-core/kern/efi/efi.c include/grub/efi/efi.h+25 -00 replies
8/11docs: Reword section headingsdocs/grub.texi+10 -100 replies
9/11kern: check for NULL when closing devices and disksgrub-core/kern/device.c grub-core/kern/disk.c+7 -00 replies
10/11Add a module for the Boot Loader Interfacedocs/grub.texi grub-core/Makefile.core.def grub-core/commands/bli.c +1 more+156 -00 replies
11/11util/grub.d: Activate bli module on EFIMakefile.util.def util/grub.d/25_bli.in+30 -00 replies

Reviews trailers per patch

9 of 11 patches have a Reviewed-by or Acked-by.

PatchDaniel Kiper
1/11R-b
2/11R-b
3/11R-b
4/11R-b
5/11R-b
6/11R-b
7/11R-b
8/11R-b
9/11
10/11
11/11R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v9 thread

Cover letter [PATCH v9 00/11] Add basic Boot Loader Interface support

This is a step towards supporting unified kernel images (UKI) in Grub.

Add a new module named bli. 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.

This series also unifies the GUID implementations and introduces a printf format specifier for them: %pG.

[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/

v9:
- Rebase to latest master branch
- Fix error handling in bli.c: get_part_uuid()
And with that fix the NULL pointer issue discovered by Coverity
- Add NULL checks to grub_device_close() and grub_disk_close() These are not strictly needed anymore with the changed error handling in get_part_uuid().
I leave the fate of this patch at the maintainer's discretion.

v8:
- https://mail.gnu.org/archive/html/grub-devel/2023-05/msg00128.html
- Rebase to latest master branch
- Fix the documentation build (I hope)
- Fix build on arm
- Make more grub_guid instances 'static'
- Move endian conversion back out of the grub_guid printf code

v7:
- https://mail.gnu.org/archive/html/grub-devel/2023-05/msg00005.html
- Add a "Modules" chapter to the documentation and describe the bli module there
- Reword some section headings in the documentation

v6:
- https://mail.gnu.org/archive/html/grub-devel/2023-04/msg00068.html
- Initialize the Boot Loader Interface on module load and remove the bli command.
- Extract code for grub_efi_set_variable_to_string()
- Improve error messages in the bli module
- Improve GUID printing code

v5:
- https://mail.gnu.org/archive/html/grub-devel/2023-03/msg00120.html
- Replace more grub_*_guid with the new grub_guid struct

v4:
- https://mail.gnu.org/archive/html/grub-devel/2023-03/msg00058.html
- Place grub_utf8_to_utf16_alloc() in kern/misc.c and use it in kern/efi.c
- bli: rework partition GUID code, improve error reporting
- Add documentation for the bli module
- Address other comments

v3:
- https://mail.gnu.org/archive/html/grub-devel/2023-03/msg00008.html
- Unify GUID implementations for GPT and EFI
- Add printf format specifier for GUIDs, drop guid print function from v2.
- WIP/Please comment: Started extracting utf8->utf16 code. Where should this go?
- Address other comments

v2:
- https://mail.gnu.org/archive/html/grub-devel/2023-02/msg00099.html
- 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 (11):
efi: Add grub_efi_set_variable_with_attributes() Unify GUID types
kern/misc: Add a format specifier GUIDs
grub-core: Make use of guid printf format specifier types.h: Add GRUB_SSIZE_MAX
kern/misc, kern/efi: Extract UTF-8 to UTF-16 code
efi: Add grub_efi_set_variable_to_string()
docs: Reword section headings
kern: check for NULL when closing devices and disks Add a module for the Boot Loader Interface util/grub.d: Activate bli module on EFI

 Makefile.util.def                    |   6 ++
 docs/grub.texi                       |  43 +++++++---
 grub-core/Makefile.core.def          |   6 ++
 grub-core/commands/acpi.c            |   4 +-
 grub-core/commands/bli.c             | 122 +++++++++++++++++++++++++++
 grub-core/commands/efi/efifwsetup.c  |   4 +-
 grub-core/commands/efi/loadbios.c    |  14 +--
 grub-core/commands/efi/lsefi.c       |  17 +---
 grub-core/commands/efi/lsefisystab.c |  10 +--
 grub-core/commands/efi/lssal.c       |   4 +-
 grub-core/commands/efi/smbios.c      |  12 +--
 grub-core/commands/efi/tpm.c         |   6 +-
 grub-core/commands/probe.c           |  14 ++-
 grub-core/disk/efi/efidisk.c         |   4 +-
 grub-core/disk/ldm.c                 |   2 +-
 grub-core/efiemu/i386/pc/cfgtables.c |   6 +-
 grub-core/efiemu/main.c              |   4 +-
 grub-core/efiemu/runtime/efiemu.c    |  14 +--
 grub-core/kern/device.c              |   3 +
 grub-core/kern/disk.c                |   4 +
 grub-core/kern/efi/acpi.c            |  12 +--
 grub-core/kern/efi/efi.c             | 109 ++++++++++++------------
 grub-core/kern/efi/fdt.c             |   2 +-
 grub-core/kern/efi/init.c            |   2 +-
 grub-core/kern/efi/sb.c              |   4 +-
 grub-core/kern/misc.c                | 113 ++++++++++++++++++++-----
 grub-core/loader/efi/fdt.c           |   2 +-
 grub-core/loader/efi/linux.c         |   4 +-
 grub-core/loader/i386/xnu.c          |  13 +--
 grub-core/loader/ia64/efi/linux.c    |   2 +-
 grub-core/net/drivers/efi/efinet.c   |   4 +-
 grub-core/partmap/gpt.c              |   4 +-
 grub-core/term/efi/console.c         |   2 +-
 grub-core/term/efi/serial.c          |   2 +-
 grub-core/video/efi_gop.c            |   8 +-
 grub-core/video/efi_uga.c            |   2 +-
 include/grub/efi/api.h               |  69 ++++++---------
 include/grub/efi/efi.h               |  23 +++--
 include/grub/efiemu/efiemu.h         |  10 +--
 include/grub/efiemu/runtime.h        |   2 +-
 include/grub/gpt_partition.h         |  13 +--
 include/grub/misc.h                  |   3 +
 include/grub/types.h                 |  11 +++
 util/grub-install.c                  |   2 +-
 util/grub-probe.c                    |   2 +-
 util/grub.d/25_bli.in                |  24 ++++++
 46 files changed, 487 insertions(+), 256 deletions(-)
 create mode 100644 grub-core/commands/bli.c
 create mode 100644 util/grub.d/25_bli.in
Signature · 1 line
2.40.1