All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 00/10] Add basic Boot Loader Interface support
@ 2023-03-02 18:20 Oliver Steffen
  2023-03-02 18:20 ` [PATCH v3 01/10] efi: Add grub_efi_set_variable_with_attributes Oliver Steffen
                   ` (9 more replies)
  0 siblings, 10 replies; 18+ messages in thread
From: Oliver Steffen @ 2023-03-02 18:20 UTC (permalink / raw)
  To: grub-devel
  Cc: Daniel Kiper, Gerd Hoffmann, Javier Martinez Canillas, Oliver Steffen

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

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


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

Some comments from v2 where not fully addressed, see "commands/bli:
Extract uft8 to utf16 conversion" patch.

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

v3:
- 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 (10):
  efi: Add grub_efi_set_variable_with_attributes
  efi: Check for integer overflow in string conversion
  Unify GUID types
  kern/misc: Add a format specifier GUIDs.
  grub-core: Make use of guid printf format specifier
  Add a module for the Boot Loader Interface
  grub-core/kern/efi: Remove redundant null-termination
  types.h: Add GRUB_SSIZE_MAX
  commands/bli: Extract uft8 to utf16 conversion
  util/grub.d: Activate bli module on EFI

 grub-core/Makefile.core.def             |   6 +
 grub-core/commands/acpi.c               |   4 +-
 grub-core/commands/bli.c                | 222 ++++++++++++++++++++++++
 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              |   9 +-
 grub-core/disk/efi/efidisk.c            |   4 +-
 grub-core/efiemu/i386/pc/cfgtables.c    |   6 +-
 grub-core/efiemu/main.c                 |   4 +-
 grub-core/efiemu/runtime/efiemu.c       |  14 +-
 grub-core/kern/efi/acpi.c               |  12 +-
 grub-core/kern/efi/efi.c                |  73 ++++----
 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                   |  86 ++++++---
 grub-core/loader/arm64/linux.c          |   4 +-
 grub-core/loader/efi/fdt.c              |   2 +-
 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/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                  |  20 ++-
 include/grub/efiemu/efiemu.h            |  10 +-
 include/grub/efiemu/runtime.h           |   2 +-
 include/grub/types.h                    |  11 ++
 util/grub.d/25_boot_loader_interface.in |  34 ++++
 36 files changed, 485 insertions(+), 215 deletions(-)
 create mode 100644 grub-core/commands/bli.c
 create mode 100644 util/grub.d/25_boot_loader_interface.in

-- 
2.39.2



^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v3 01/10] efi: Add grub_efi_set_variable_with_attributes
  2023-03-02 18:20 [PATCH v3 00/10] Add basic Boot Loader Interface support Oliver Steffen
@ 2023-03-02 18:20 ` Oliver Steffen
  2023-03-02 18:20 ` [PATCH v3 02/10] efi: Check for integer overflow in string conversion Oliver Steffen
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 18+ messages in thread
From: Oliver Steffen @ 2023-03-02 18:20 UTC (permalink / raw)
  To: grub-devel
  Cc: Daniel Kiper, Gerd Hoffmann, Javier Martinez Canillas,
	Oliver Steffen, Daniel Kiper

Add a function to the EFI module that allows setting EFI variables
with specific attributes.

This is useful for marking variables as volatile, for example.

Signed-off-by: Oliver Steffen <osteffen@redhat.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
---
 grub-core/kern/efi/efi.c | 19 +++++++++++++------
 include/grub/efi/efi.h   |  6 ++++++
 2 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
index cf49d6357..03abf5531 100644
--- a/grub-core/kern/efi/efi.c
+++ b/grub-core/kern/efi/efi.c
@@ -201,8 +201,8 @@ grub_efi_set_virtual_address_map (grub_efi_uintn_t memory_map_size,
 }
 
 grub_err_t
-grub_efi_set_variable(const char *var, const grub_efi_guid_t *guid,
-		      void *data, grub_size_t datasize)
+grub_efi_set_variable_with_attributes (const char *var, const grub_efi_guid_t *guid,
+		      void *data, grub_size_t datasize, grub_efi_uint32_t attributes)
 {
   grub_efi_status_t status;
   grub_efi_runtime_services_t *r;
@@ -219,10 +219,7 @@ grub_efi_set_variable(const char *var, const grub_efi_guid_t *guid,
 
   r = grub_efi_system_table->runtime_services;
 
-  status = efi_call_5 (r->set_variable, var16, guid,
-		       (GRUB_EFI_VARIABLE_NON_VOLATILE
-			| GRUB_EFI_VARIABLE_BOOTSERVICE_ACCESS
-			| GRUB_EFI_VARIABLE_RUNTIME_ACCESS),
+  status = efi_call_5 (r->set_variable, var16, guid, attributes,
 		       datasize, data);
   grub_free (var16);
   if (status == GRUB_EFI_SUCCESS)
@@ -231,6 +228,16 @@ grub_efi_set_variable(const char *var, const grub_efi_guid_t *guid,
   return grub_error (GRUB_ERR_IO, "could not set EFI variable `%s'", var);
 }
 
+grub_err_t
+grub_efi_set_variable (const char *var, const grub_efi_guid_t *guid,
+		      void *data, grub_size_t datasize)
+{
+  return grub_efi_set_variable_with_attributes (var, guid, data, datasize, 
+			GRUB_EFI_VARIABLE_NON_VOLATILE
+			| GRUB_EFI_VARIABLE_BOOTSERVICE_ACCESS
+			| GRUB_EFI_VARIABLE_RUNTIME_ACCESS);
+}
+
 grub_efi_status_t
 grub_efi_get_variable_with_attributes (const char *var,
 				       const grub_efi_guid_t *guid,
diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
index e61272de5..8e9a905a4 100644
--- a/include/grub/efi/efi.h
+++ b/include/grub/efi/efi.h
@@ -86,6 +86,12 @@ grub_efi_status_t EXPORT_FUNC (grub_efi_get_variable) (const char *variable,
 						       grub_size_t *datasize_out,
 						       void **data_out);
 grub_err_t
+EXPORT_FUNC (grub_efi_set_variable_with_attributes) (const char *var,
+				     const grub_efi_guid_t *guid,
+				     void *data,
+				     grub_size_t datasize,
+				     grub_efi_uint32_t attributes);
+grub_err_t
 EXPORT_FUNC (grub_efi_set_variable) (const char *var,
 				     const grub_efi_guid_t *guid,
 				     void *data,
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 02/10] efi: Check for integer overflow in string conversion
  2023-03-02 18:20 [PATCH v3 00/10] Add basic Boot Loader Interface support Oliver Steffen
  2023-03-02 18:20 ` [PATCH v3 01/10] efi: Add grub_efi_set_variable_with_attributes Oliver Steffen
@ 2023-03-02 18:20 ` Oliver Steffen
  2023-03-02 18:20 ` [PATCH v3 03/10] Unify GUID types Oliver Steffen
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 18+ messages in thread
From: Oliver Steffen @ 2023-03-02 18:20 UTC (permalink / raw)
  To: grub-devel
  Cc: Daniel Kiper, Gerd Hoffmann, Javier Martinez Canillas,
	Oliver Steffen, Daniel Kiper

Check for integer overflow when converting the name of the
EFI variable to UTF16 in grub_efi_set_variable_with_attributes().

Signed-off-by: Oliver Steffen <osteffen@redhat.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
---
 grub-core/kern/efi/efi.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
index 03abf5531..a23c80a21 100644
--- a/grub-core/kern/efi/efi.c
+++ b/grub-core/kern/efi/efi.c
@@ -25,6 +25,7 @@
 #include <grub/efi/pe32.h>
 #include <grub/time.h>
 #include <grub/term.h>
+#include <grub/types.h>
 #include <grub/kernel.h>
 #include <grub/mm.h>
 #include <grub/loader.h>
@@ -210,6 +211,11 @@ grub_efi_set_variable_with_attributes (const char *var, const grub_efi_guid_t *g
   grub_size_t len, len16;
 
   len = grub_strlen (var);
+
+  /* Check for integer overflow */
+  if (len > GRUB_SIZE_MAX / GRUB_MAX_UTF16_PER_UTF8 - 1)
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("variable name too long"));
+
   len16 = len * GRUB_MAX_UTF16_PER_UTF8;
   var16 = grub_calloc (len16 + 1, sizeof (var16[0]));
   if (!var16)
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 03/10] Unify GUID types
  2023-03-02 18:20 [PATCH v3 00/10] Add basic Boot Loader Interface support Oliver Steffen
  2023-03-02 18:20 ` [PATCH v3 01/10] efi: Add grub_efi_set_variable_with_attributes Oliver Steffen
  2023-03-02 18:20 ` [PATCH v3 02/10] efi: Check for integer overflow in string conversion Oliver Steffen
@ 2023-03-02 18:20 ` Oliver Steffen
  2023-03-08 14:02   ` Daniel Kiper
  2023-03-02 18:20 ` [PATCH v3 04/10] kern/misc: Add a format specifier GUIDs Oliver Steffen
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 18+ messages in thread
From: Oliver Steffen @ 2023-03-02 18:20 UTC (permalink / raw)
  To: grub-devel
  Cc: Daniel Kiper, Gerd Hoffmann, Javier Martinez Canillas, Oliver Steffen

There are 3 implementations of a GUID in Grub. Replace them with a
common one, placed in types.h.

It uses the "packed" flavor of the GUID structs, the alignment attribute
is dropped, since it is not required.

Signed-off-by: Oliver Steffen <osteffen@redhat.com>
---
 grub-core/commands/acpi.c            |  4 +-
 grub-core/commands/efi/efifwsetup.c  |  4 +-
 grub-core/commands/efi/loadbios.c    | 14 +++---
 grub-core/commands/efi/lsefi.c       |  4 +-
 grub-core/commands/efi/lsefisystab.c |  4 +-
 grub-core/commands/efi/lssal.c       |  4 +-
 grub-core/commands/efi/smbios.c      | 12 +++---
 grub-core/commands/efi/tpm.c         |  6 +--
 grub-core/disk/efi/efidisk.c         |  4 +-
 grub-core/efiemu/i386/pc/cfgtables.c |  6 +--
 grub-core/efiemu/main.c              |  4 +-
 grub-core/efiemu/runtime/efiemu.c    | 14 +++---
 grub-core/kern/efi/acpi.c            | 12 +++---
 grub-core/kern/efi/efi.c             | 22 +++++-----
 grub-core/kern/efi/fdt.c             |  2 +-
 grub-core/kern/efi/init.c            |  2 +-
 grub-core/kern/efi/sb.c              |  4 +-
 grub-core/loader/arm64/linux.c       |  4 +-
 grub-core/loader/efi/fdt.c           |  2 +-
 grub-core/loader/i386/xnu.c          |  4 +-
 grub-core/loader/ia64/efi/linux.c    |  2 +-
 grub-core/net/drivers/efi/efinet.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               | 64 ++++++++++------------------
 include/grub/efi/efi.h               | 16 +++----
 include/grub/efiemu/efiemu.h         | 10 ++---
 include/grub/efiemu/runtime.h        |  2 +-
 include/grub/types.h                 |  9 ++++
 31 files changed, 122 insertions(+), 131 deletions(-)

diff --git a/grub-core/commands/acpi.c b/grub-core/commands/acpi.c
index fda62f4ea..4f8af86f2 100644
--- a/grub-core/commands/acpi.c
+++ b/grub-core/commands/acpi.c
@@ -759,8 +759,8 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
 
 #ifdef GRUB_MACHINE_EFI
   {
-    struct grub_efi_guid acpi = GRUB_EFI_ACPI_TABLE_GUID;
-    struct grub_efi_guid acpi20 = GRUB_EFI_ACPI_20_TABLE_GUID;
+    struct grub_guid acpi = GRUB_EFI_ACPI_TABLE_GUID;
+    struct grub_guid acpi20 = GRUB_EFI_ACPI_20_TABLE_GUID;
 
     efi_call_2 (grub_efi_system_table->boot_services->install_configuration_table,
       &acpi20, grub_acpi_get_rsdpv2 ());
diff --git a/grub-core/commands/efi/efifwsetup.c b/grub-core/commands/efi/efifwsetup.c
index de66c3035..704f9d352 100644
--- a/grub-core/commands/efi/efifwsetup.c
+++ b/grub-core/commands/efi/efifwsetup.c
@@ -38,7 +38,7 @@ grub_cmd_fwsetup (grub_command_t cmd __attribute__ ((unused)),
   grub_efi_uint64_t os_indications = GRUB_EFI_OS_INDICATIONS_BOOT_TO_FW_UI;
   grub_err_t status;
   grub_size_t oi_size;
-  static grub_efi_guid_t global = GRUB_EFI_GLOBAL_VARIABLE_GUID;
+  static grub_guid_t global = GRUB_EFI_GLOBAL_VARIABLE_GUID;
 
   if (argc >= 1 && grub_strcmp(args[0], "--is-supported") == 0)
     return !efifwsetup_is_supported ();
@@ -72,7 +72,7 @@ efifwsetup_is_supported (void)
 {
   grub_efi_uint64_t *os_indications_supported = NULL;
   grub_size_t oi_size = 0;
-  static grub_efi_guid_t global = GRUB_EFI_GLOBAL_VARIABLE_GUID;
+  static grub_guid_t global = GRUB_EFI_GLOBAL_VARIABLE_GUID;
   grub_efi_boolean_t ret = 0;
 
   grub_efi_get_variable ("OsIndicationsSupported", &global, &oi_size,
diff --git a/grub-core/commands/efi/loadbios.c b/grub-core/commands/efi/loadbios.c
index 574e41046..8f6b0ecfc 100644
--- a/grub-core/commands/efi/loadbios.c
+++ b/grub-core/commands/efi/loadbios.c
@@ -27,9 +27,9 @@
 
 GRUB_MOD_LICENSE ("GPLv3+");
 
-static grub_efi_guid_t acpi_guid = GRUB_EFI_ACPI_TABLE_GUID;
-static grub_efi_guid_t acpi2_guid = GRUB_EFI_ACPI_20_TABLE_GUID;
-static grub_efi_guid_t smbios_guid = GRUB_EFI_SMBIOS_TABLE_GUID;
+static grub_guid_t acpi_guid = GRUB_EFI_ACPI_TABLE_GUID;
+static grub_guid_t acpi2_guid = GRUB_EFI_ACPI_20_TABLE_GUID;
+static grub_guid_t smbios_guid = GRUB_EFI_SMBIOS_TABLE_GUID;
 
 #define EBDA_SEG_ADDR	0x40e
 #define LOW_MEM_ADDR	0x413
@@ -105,15 +105,15 @@ fake_bios_data (int use_rom)
   smbios = 0;
   for (i = 0; i < grub_efi_system_table->num_table_entries; i++)
     {
-      grub_efi_packed_guid_t *guid =
+      grub_guid_t *guid =
 	&grub_efi_system_table->configuration_table[i].vendor_guid;
 
-      if (! grub_memcmp (guid, &acpi2_guid, sizeof (grub_efi_guid_t)))
+      if (! grub_memcmp (guid, &acpi2_guid, sizeof (grub_guid_t)))
 	{
 	  acpi = grub_efi_system_table->configuration_table[i].vendor_table;
 	  grub_dprintf ("efi", "ACPI2: %p\n", acpi);
 	}
-      else if (! grub_memcmp (guid, &acpi_guid, sizeof (grub_efi_guid_t)))
+      else if (! grub_memcmp (guid, &acpi_guid, sizeof (grub_guid_t)))
 	{
 	  void *t;
 
@@ -122,7 +122,7 @@ fake_bios_data (int use_rom)
 	    acpi = t;
 	  grub_dprintf ("efi", "ACPI: %p\n", t);
 	}
-      else if (! grub_memcmp (guid, &smbios_guid, sizeof (grub_efi_guid_t)))
+      else if (! grub_memcmp (guid, &smbios_guid, sizeof (grub_guid_t)))
 	{
 	  smbios = grub_efi_system_table->configuration_table[i].vendor_table;
 	  grub_dprintf ("efi", "SMBIOS: %p\n", smbios);
diff --git a/grub-core/commands/efi/lsefi.c b/grub-core/commands/efi/lsefi.c
index c304d25cc..ff3e71a91 100644
--- a/grub-core/commands/efi/lsefi.c
+++ b/grub-core/commands/efi/lsefi.c
@@ -31,7 +31,7 @@ GRUB_MOD_LICENSE ("GPLv3+");
 
 struct known_protocol
 {
-  grub_efi_guid_t guid;
+  grub_guid_t guid;
   const char *name;
 } known_protocols[] =
   {
@@ -96,7 +96,7 @@ grub_cmd_lsefi (grub_command_t cmd __attribute__ ((unused)),
       grub_efi_handle_t handle = handles[i];
       grub_efi_status_t status;
       grub_efi_uintn_t num_protocols;
-      grub_efi_packed_guid_t **protocols;
+      grub_guid_t **protocols;
       grub_efi_device_path_t *dp;
 
       grub_printf ("Handle %p\n", handle);
diff --git a/grub-core/commands/efi/lsefisystab.c b/grub-core/commands/efi/lsefisystab.c
index ac3299b7f..eff8c41f3 100644
--- a/grub-core/commands/efi/lsefisystab.c
+++ b/grub-core/commands/efi/lsefisystab.c
@@ -29,7 +29,7 @@ GRUB_MOD_LICENSE ("GPLv3+");
 
 struct guid_mapping
 {
-  grub_efi_guid_t guid;
+  grub_guid_t guid;
   const char *name;
 };
 
@@ -104,7 +104,7 @@ grub_cmd_lsefisystab (struct grub_command *cmd __attribute__ ((unused)),
 
       for (j = 0; j < ARRAY_SIZE (guid_mappings); j++)
 	if (grub_memcmp (&guid_mappings[j].guid, &t->vendor_guid,
-			 sizeof (grub_efi_guid_t)) == 0)
+			 sizeof (grub_guid_t)) == 0)
 	  grub_printf ("   %s", guid_mappings[j].name);
 
       grub_printf ("\n");
diff --git a/grub-core/commands/efi/lssal.c b/grub-core/commands/efi/lssal.c
index 5084ddd8b..7b683dc62 100644
--- a/grub-core/commands/efi/lssal.c
+++ b/grub-core/commands/efi/lssal.c
@@ -139,12 +139,12 @@ grub_cmd_lssal (struct grub_command *cmd __attribute__ ((unused)),
   const grub_efi_system_table_t *st = grub_efi_system_table;
   grub_efi_configuration_table_t *t = st->configuration_table;
   unsigned int i;
-  grub_efi_packed_guid_t guid = GRUB_EFI_SAL_TABLE_GUID;
+  grub_guid_t guid = GRUB_EFI_SAL_TABLE_GUID;
 
   for (i = 0; i < st->num_table_entries; i++)
     {
       if (grub_memcmp (&guid, &t->vendor_guid,
-		       sizeof (grub_efi_packed_guid_t)) == 0)
+		       sizeof (grub_guid_t)) == 0)
 	{
 	  disp_sal (t->vendor_table);
 	  return GRUB_ERR_NONE;
diff --git a/grub-core/commands/efi/smbios.c b/grub-core/commands/efi/smbios.c
index 75202d5aa..d77239732 100644
--- a/grub-core/commands/efi/smbios.c
+++ b/grub-core/commands/efi/smbios.c
@@ -26,14 +26,14 @@ struct grub_smbios_eps *
 grub_machine_smbios_get_eps (void)
 {
   unsigned i;
-  static grub_efi_packed_guid_t smbios_guid = GRUB_EFI_SMBIOS_TABLE_GUID;
+  static grub_guid_t smbios_guid = GRUB_EFI_SMBIOS_TABLE_GUID;
 
   for (i = 0; i < grub_efi_system_table->num_table_entries; i++)
     {
-      grub_efi_packed_guid_t *guid =
+      grub_guid_t *guid =
 	&grub_efi_system_table->configuration_table[i].vendor_guid;
 
-      if (! grub_memcmp (guid, &smbios_guid, sizeof (grub_efi_packed_guid_t)))
+      if (! grub_memcmp (guid, &smbios_guid, sizeof (grub_guid_t)))
 	return (struct grub_smbios_eps *)
 	  grub_efi_system_table->configuration_table[i].vendor_table;
     }
@@ -45,14 +45,14 @@ struct grub_smbios_eps3 *
 grub_machine_smbios_get_eps3 (void)
 {
   unsigned i;
-  static grub_efi_packed_guid_t smbios3_guid = GRUB_EFI_SMBIOS3_TABLE_GUID;
+  static grub_guid_t smbios3_guid = GRUB_EFI_SMBIOS3_TABLE_GUID;
 
   for (i = 0; i < grub_efi_system_table->num_table_entries; i++)
     {
-      grub_efi_packed_guid_t *guid =
+      grub_guid_t *guid =
 	&grub_efi_system_table->configuration_table[i].vendor_guid;
 
-      if (! grub_memcmp (guid, &smbios3_guid, sizeof (grub_efi_packed_guid_t)))
+      if (! grub_memcmp (guid, &smbios3_guid, sizeof (grub_guid_t)))
 	return (struct grub_smbios_eps3 *)
 	  grub_efi_system_table->configuration_table[i].vendor_table;
     }
diff --git a/grub-core/commands/efi/tpm.c b/grub-core/commands/efi/tpm.c
index ae09c1bf8..f3d142452 100644
--- a/grub-core/commands/efi/tpm.c
+++ b/grub-core/commands/efi/tpm.c
@@ -30,9 +30,9 @@
 
 typedef TCG_PCR_EVENT grub_tpm_event_t;
 
-static grub_efi_guid_t tpm_guid = EFI_TPM_GUID;
-static grub_efi_guid_t tpm2_guid = EFI_TPM2_GUID;
-static grub_efi_guid_t cc_measurement_guid = GRUB_EFI_CC_MEASUREMENT_PROTOCOL_GUID;
+static grub_guid_t tpm_guid = EFI_TPM_GUID;
+static grub_guid_t tpm2_guid = EFI_TPM2_GUID;
+static grub_guid_t cc_measurement_guid = GRUB_EFI_CC_MEASUREMENT_PROTOCOL_GUID;
 
 static grub_efi_handle_t *grub_tpm_handle;
 static grub_uint8_t grub_tpm_version;
diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c
index d7540040e..7697bea14 100644
--- a/grub-core/disk/efi/efidisk.c
+++ b/grub-core/disk/efi/efidisk.c
@@ -37,7 +37,7 @@ struct grub_efidisk_data
 };
 
 /* GUID.  */
-static grub_efi_guid_t block_io_guid = GRUB_EFI_BLOCK_IO_GUID;
+static grub_guid_t block_io_guid = GRUB_EFI_BLOCK_IO_GUID;
 
 static struct grub_efidisk_data *fd_devices;
 static struct grub_efidisk_data *hd_devices;
@@ -319,7 +319,7 @@ name_devices (struct grub_efidisk_data *devices)
 	  == GRUB_EFI_VENDOR_MEDIA_DEVICE_PATH_SUBTYPE)
 	{
 	  grub_efi_vendor_device_path_t *vendor = (grub_efi_vendor_device_path_t *) dp;
-	  const struct grub_efi_guid apple = GRUB_EFI_VENDOR_APPLE_GUID;
+	  const struct grub_guid apple = GRUB_EFI_VENDOR_APPLE_GUID;
 
 	  if (vendor->header.length == sizeof (*vendor)
 	      && grub_memcmp (&vendor->vendor_guid, &apple,
diff --git a/grub-core/efiemu/i386/pc/cfgtables.c b/grub-core/efiemu/i386/pc/cfgtables.c
index 1098f0b79..056ec0bc9 100644
--- a/grub-core/efiemu/i386/pc/cfgtables.c
+++ b/grub-core/efiemu/i386/pc/cfgtables.c
@@ -29,9 +29,9 @@ grub_machine_efiemu_init_tables (void)
 {
   void *table;
   grub_err_t err;
-  static grub_efi_guid_t smbios = GRUB_EFI_SMBIOS_TABLE_GUID;
-  static grub_efi_guid_t acpi20 = GRUB_EFI_ACPI_20_TABLE_GUID;
-  static grub_efi_guid_t acpi = GRUB_EFI_ACPI_TABLE_GUID;
+  static grub_guid_t smbios = GRUB_EFI_SMBIOS_TABLE_GUID;
+  static grub_guid_t acpi20 = GRUB_EFI_ACPI_20_TABLE_GUID;
+  static grub_guid_t acpi = GRUB_EFI_ACPI_TABLE_GUID;
 
   err = grub_efiemu_unregister_configuration_table (smbios);
   if (err)
diff --git a/grub-core/efiemu/main.c b/grub-core/efiemu/main.c
index a81934725..e7037f4ed 100644
--- a/grub-core/efiemu/main.c
+++ b/grub-core/efiemu/main.c
@@ -80,7 +80,7 @@ grub_efiemu_unload (void)
 
 /* Remove previously registered table from the list */
 grub_err_t
-grub_efiemu_unregister_configuration_table (grub_efi_guid_t guid)
+grub_efiemu_unregister_configuration_table (grub_guid_t guid)
 {
   struct grub_efiemu_configuration_table *cur, *prev;
 
@@ -136,7 +136,7 @@ grub_efiemu_register_prepare_hook (grub_err_t (*hook) (void *data),
    or with a hook
 */
 grub_err_t
-grub_efiemu_register_configuration_table (grub_efi_guid_t guid,
+grub_efiemu_register_configuration_table (grub_guid_t guid,
 					  void * (*get_table) (void *data),
 					  void (*unload) (void *data),
 					  void *data)
diff --git a/grub-core/efiemu/runtime/efiemu.c b/grub-core/efiemu/runtime/efiemu.c
index 5db1f347b..63c09da78 100644
--- a/grub-core/efiemu/runtime/efiemu.c
+++ b/grub-core/efiemu/runtime/efiemu.c
@@ -66,7 +66,7 @@ efiemu_convert_pointer (grub_efi_uintn_t debug_disposition,
 
 grub_efi_status_t
 efiemu_get_variable (grub_efi_char16_t *variable_name,
-		     const grub_efi_guid_t *vendor_guid,
+		     const grub_guid_t *vendor_guid,
 		     grub_efi_uint32_t *attributes,
 		     grub_efi_uintn_t *data_size,
 		     void *data);
@@ -74,11 +74,11 @@ efiemu_get_variable (grub_efi_char16_t *variable_name,
 grub_efi_status_t
 efiemu_get_next_variable_name (grub_efi_uintn_t *variable_name_size,
 			       grub_efi_char16_t *variable_name,
-			       grub_efi_guid_t *vendor_guid);
+			       grub_guid_t *vendor_guid);
 
 grub_efi_status_t
 efiemu_set_variable (grub_efi_char16_t *variable_name,
-		     const grub_efi_guid_t *vendor_guid,
+		     const grub_guid_t *vendor_guid,
 		     grub_efi_uint32_t attributes,
 		     grub_efi_uintn_t data_size,
 		     void *data);
@@ -416,7 +416,7 @@ EFI_FUNC (efiemu_convert_pointer) (grub_efi_uintn_t debug_disposition,
 
 /* Find variable by name and GUID. */
 static struct efi_variable *
-find_variable (const grub_efi_guid_t *vendor_guid,
+find_variable (const grub_guid_t *vendor_guid,
 	       grub_efi_char16_t *variable_name)
 {
   grub_uint8_t *ptr;
@@ -438,7 +438,7 @@ find_variable (const grub_efi_guid_t *vendor_guid,
 
 grub_efi_status_t
 EFI_FUNC (efiemu_get_variable) (grub_efi_char16_t *variable_name,
-				const grub_efi_guid_t *vendor_guid,
+				const grub_guid_t *vendor_guid,
 				grub_efi_uint32_t *attributes,
 				grub_efi_uintn_t *data_size,
 				void *data)
@@ -464,7 +464,7 @@ EFI_FUNC (efiemu_get_variable) (grub_efi_char16_t *variable_name,
 grub_efi_status_t EFI_FUNC
 (efiemu_get_next_variable_name) (grub_efi_uintn_t *variable_name_size,
 				 grub_efi_char16_t *variable_name,
-				 grub_efi_guid_t *vendor_guid)
+				 grub_guid_t *vendor_guid)
 {
   struct efi_variable *efivar;
   LOG ('l');
@@ -503,7 +503,7 @@ grub_efi_status_t EFI_FUNC
 
 grub_efi_status_t
 EFI_FUNC (efiemu_set_variable) (grub_efi_char16_t *variable_name,
-				const grub_efi_guid_t *vendor_guid,
+				const grub_guid_t *vendor_guid,
 				grub_efi_uint32_t attributes,
 				grub_efi_uintn_t data_size,
 				void *data)
diff --git a/grub-core/kern/efi/acpi.c b/grub-core/kern/efi/acpi.c
index 74f8cd1a9..461c77c33 100644
--- a/grub-core/kern/efi/acpi.c
+++ b/grub-core/kern/efi/acpi.c
@@ -26,14 +26,14 @@ struct grub_acpi_rsdp_v10 *
 grub_machine_acpi_get_rsdpv1 (void)
 {
   unsigned i;
-  static grub_efi_packed_guid_t acpi_guid = GRUB_EFI_ACPI_TABLE_GUID;
+  static grub_guid_t acpi_guid = GRUB_EFI_ACPI_TABLE_GUID;
 
   for (i = 0; i < grub_efi_system_table->num_table_entries; i++)
     {
-      grub_efi_packed_guid_t *guid =
+      grub_guid_t *guid =
 	&grub_efi_system_table->configuration_table[i].vendor_guid;
 
-      if (! grub_memcmp (guid, &acpi_guid, sizeof (grub_efi_packed_guid_t)))
+      if (! grub_memcmp (guid, &acpi_guid, sizeof (grub_guid_t)))
 	return (struct grub_acpi_rsdp_v10 *)
 	  grub_efi_system_table->configuration_table[i].vendor_table;
     }
@@ -44,14 +44,14 @@ struct grub_acpi_rsdp_v20 *
 grub_machine_acpi_get_rsdpv2 (void)
 {
   unsigned i;
-  static grub_efi_packed_guid_t acpi20_guid = GRUB_EFI_ACPI_20_TABLE_GUID;
+  static grub_guid_t acpi20_guid = GRUB_EFI_ACPI_20_TABLE_GUID;
 
   for (i = 0; i < grub_efi_system_table->num_table_entries; i++)
     {
-      grub_efi_packed_guid_t *guid =
+      grub_guid_t *guid =
 	&grub_efi_system_table->configuration_table[i].vendor_guid;
 
-      if (! grub_memcmp (guid, &acpi20_guid, sizeof (grub_efi_packed_guid_t)))
+      if (! grub_memcmp (guid, &acpi20_guid, sizeof (grub_guid_t)))
 	return (struct grub_acpi_rsdp_v20 *)
 	  grub_efi_system_table->configuration_table[i].vendor_table;
     }
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
index a23c80a21..cd73b0fbf 100644
--- a/grub-core/kern/efi/efi.c
+++ b/grub-core/kern/efi/efi.c
@@ -36,12 +36,12 @@ grub_efi_handle_t grub_efi_image_handle;
 /* The pointer to a system table. Filled in by the startup code.  */
 grub_efi_system_table_t *grub_efi_system_table;
 
-static grub_efi_guid_t console_control_guid = GRUB_EFI_CONSOLE_CONTROL_GUID;
-static grub_efi_guid_t loaded_image_guid = GRUB_EFI_LOADED_IMAGE_GUID;
-static grub_efi_guid_t device_path_guid = GRUB_EFI_DEVICE_PATH_GUID;
+static grub_guid_t console_control_guid = GRUB_EFI_CONSOLE_CONTROL_GUID;
+static grub_guid_t loaded_image_guid = GRUB_EFI_LOADED_IMAGE_GUID;
+static grub_guid_t device_path_guid = GRUB_EFI_DEVICE_PATH_GUID;
 
 void *
-grub_efi_locate_protocol (grub_efi_guid_t *protocol, void *registration)
+grub_efi_locate_protocol (grub_guid_t *protocol, void *registration)
 {
   void *interface;
   grub_efi_status_t status;
@@ -59,7 +59,7 @@ grub_efi_locate_protocol (grub_efi_guid_t *protocol, void *registration)
    from the heap.  */
 grub_efi_handle_t *
 grub_efi_locate_handle (grub_efi_locate_search_type_t search_type,
-			grub_efi_guid_t *protocol,
+			grub_guid_t *protocol,
 			void *search_key,
 			grub_efi_uintn_t *num_handles)
 {
@@ -98,7 +98,7 @@ grub_efi_locate_handle (grub_efi_locate_search_type_t search_type,
 
 void *
 grub_efi_open_protocol (grub_efi_handle_t handle,
-			grub_efi_guid_t *protocol,
+			grub_guid_t *protocol,
 			grub_efi_uint32_t attributes)
 {
   grub_efi_boot_services_t *b;
@@ -119,7 +119,7 @@ grub_efi_open_protocol (grub_efi_handle_t handle,
 }
 
 grub_efi_status_t
-grub_efi_close_protocol (grub_efi_handle_t handle, grub_efi_guid_t *protocol)
+grub_efi_close_protocol (grub_efi_handle_t handle, grub_guid_t *protocol)
 {
   grub_efi_boot_services_t *b = grub_efi_system_table->boot_services;
 
@@ -202,7 +202,7 @@ grub_efi_set_virtual_address_map (grub_efi_uintn_t memory_map_size,
 }
 
 grub_err_t
-grub_efi_set_variable_with_attributes (const char *var, const grub_efi_guid_t *guid,
+grub_efi_set_variable_with_attributes (const char *var, const grub_guid_t *guid,
 		      void *data, grub_size_t datasize, grub_efi_uint32_t attributes)
 {
   grub_efi_status_t status;
@@ -235,7 +235,7 @@ grub_efi_set_variable_with_attributes (const char *var, const grub_efi_guid_t *g
 }
 
 grub_err_t
-grub_efi_set_variable (const char *var, const grub_efi_guid_t *guid,
+grub_efi_set_variable (const char *var, const grub_guid_t *guid,
 		      void *data, grub_size_t datasize)
 {
   return grub_efi_set_variable_with_attributes (var, guid, data, datasize, 
@@ -246,7 +246,7 @@ grub_efi_set_variable (const char *var, const grub_efi_guid_t *guid,
 
 grub_efi_status_t
 grub_efi_get_variable_with_attributes (const char *var,
-				       const grub_efi_guid_t *guid,
+				       const grub_guid_t *guid,
 				       grub_size_t *datasize_out,
 				       void **data_out,
 				       grub_efi_uint32_t *attributes)
@@ -301,7 +301,7 @@ grub_efi_get_variable_with_attributes (const char *var,
 }
 
 grub_efi_status_t
-grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid,
+grub_efi_get_variable (const char *var, const grub_guid_t *guid,
 		       grub_size_t *datasize_out, void **data_out)
 {
   return grub_efi_get_variable_with_attributes (var, guid, datasize_out, data_out, NULL);
diff --git a/grub-core/kern/efi/fdt.c b/grub-core/kern/efi/fdt.c
index 24f955289..8fcf43f1b 100644
--- a/grub-core/kern/efi/fdt.c
+++ b/grub-core/kern/efi/fdt.c
@@ -24,7 +24,7 @@ void *
 grub_efi_get_firmware_fdt (void)
 {
   grub_efi_configuration_table_t *tables;
-  static grub_efi_guid_t fdt_guid = GRUB_EFI_DEVICE_TREE_GUID;
+  static grub_guid_t fdt_guid = GRUB_EFI_DEVICE_TREE_GUID;
   void *firmware_fdt = NULL;
   unsigned int i;
 
diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c
index b67bc73a1..6ac017754 100644
--- a/grub-core/kern/efi/init.c
+++ b/grub-core/kern/efi/init.c
@@ -36,7 +36,7 @@ static grub_efi_char16_t stack_chk_fail_msg[] =
   L"* GRUB: ABORTED!!! *\r\n"
   L"* GRUB: REBOOTING IN 5 SECONDS... *\r\n";
 
-static grub_efi_guid_t rng_protocol_guid = GRUB_EFI_RNG_PROTOCOL_GUID;
+static grub_guid_t rng_protocol_guid = GRUB_EFI_RNG_PROTOCOL_GUID;
 
 /*
  * Don't put this on grub_efi_init()'s local stack to avoid it
diff --git a/grub-core/kern/efi/sb.c b/grub-core/kern/efi/sb.c
index db42c2539..80cfa0888 100644
--- a/grub-core/kern/efi/sb.c
+++ b/grub-core/kern/efi/sb.c
@@ -30,7 +30,7 @@
 #include <grub/types.h>
 #include <grub/verify.h>
 
-static grub_efi_guid_t shim_lock_guid = GRUB_EFI_SHIM_LOCK_GUID;
+static grub_guid_t shim_lock_guid = GRUB_EFI_SHIM_LOCK_GUID;
 
 /*
  * Determine whether we're in secure boot mode.
@@ -41,7 +41,7 @@ static grub_efi_guid_t shim_lock_guid = GRUB_EFI_SHIM_LOCK_GUID;
 grub_uint8_t
 grub_efi_get_secureboot (void)
 {
-  static grub_efi_guid_t efi_variable_guid = GRUB_EFI_GLOBAL_VARIABLE_GUID;
+  static grub_guid_t efi_variable_guid = GRUB_EFI_GLOBAL_VARIABLE_GUID;
   grub_efi_status_t status;
   grub_efi_uint32_t attr = 0;
   grub_size_t size = 0;
diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c
index 48ab34a25..b3951b2c2 100644
--- a/grub-core/loader/arm64/linux.c
+++ b/grub-core/loader/arm64/linux.c
@@ -52,8 +52,8 @@ static struct grub_linux_initrd_context initrd_ctx = {0, 0, 0};
 static grub_efi_handle_t initrd_lf2_handle = NULL;
 static bool initrd_use_loadfile2 = false;
 
-static grub_efi_guid_t load_file2_guid = GRUB_EFI_LOAD_FILE2_PROTOCOL_GUID;
-static grub_efi_guid_t device_path_guid = GRUB_EFI_DEVICE_PATH_GUID;
+static grub_guid_t load_file2_guid = GRUB_EFI_LOAD_FILE2_PROTOCOL_GUID;
+static grub_guid_t device_path_guid = GRUB_EFI_DEVICE_PATH_GUID;
 
 static initrd_media_device_path_t initrd_lf2_device_path = {
   {
diff --git a/grub-core/loader/efi/fdt.c b/grub-core/loader/efi/fdt.c
index 35a3be2e5..439964b9c 100644
--- a/grub-core/loader/efi/fdt.c
+++ b/grub-core/loader/efi/fdt.c
@@ -86,7 +86,7 @@ grub_err_t
 grub_fdt_install (void)
 {
   grub_efi_boot_services_t *b;
-  static grub_efi_guid_t fdt_guid = GRUB_EFI_DEVICE_TREE_GUID;
+  static grub_guid_t fdt_guid = GRUB_EFI_DEVICE_TREE_GUID;
   grub_efi_status_t status;
 
   if (fdt == NULL && loaded_fdt == NULL)
diff --git a/grub-core/loader/i386/xnu.c b/grub-core/loader/i386/xnu.c
index 4c88ce5e0..93ba4476d 100644
--- a/grub-core/loader/i386/xnu.c
+++ b/grub-core/loader/i386/xnu.c
@@ -48,7 +48,7 @@ grub_uint32_t grub_xnu_entry_point, grub_xnu_arg1, grub_xnu_stack;
 /* Aliases set for some tables. */
 struct tbl_alias
 {
-  grub_efi_guid_t guid;
+  grub_guid_t guid;
   const char *name;
 };
 
@@ -694,7 +694,7 @@ grub_cpu_xnu_fill_devicetree (grub_uint64_t *fsbfreq_out)
     {
       void *ptr;
       struct grub_xnu_devtree_key *curkey;
-      grub_efi_packed_guid_t guid;
+      grub_guid_t guid;
       char guidbuf[64];
 
       /* Retrieve current key. */
diff --git a/grub-core/loader/ia64/efi/linux.c b/grub-core/loader/ia64/efi/linux.c
index fb9b961f7..3dd2e8236 100644
--- a/grub-core/loader/ia64/efi/linux.c
+++ b/grub-core/loader/ia64/efi/linux.c
@@ -106,7 +106,7 @@ query_fpswa (void)
   grub_efi_boot_services_t *bs;
   grub_efi_status_t status;
   grub_efi_uintn_t size;
-  static const grub_efi_guid_t fpswa_protocol =
+  static const grub_guid_t fpswa_protocol =
     { 0xc41b6531, 0x97b9, 0x11d3,
       {0x9a, 0x29, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} };
 
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
index 5adf5f40f..e1955ce90 100644
--- a/grub-core/net/drivers/efi/efinet.c
+++ b/grub-core/net/drivers/efi/efinet.c
@@ -27,8 +27,8 @@
 GRUB_MOD_LICENSE ("GPLv3+");
 
 /* GUID.  */
-static grub_efi_guid_t net_io_guid = GRUB_EFI_SIMPLE_NETWORK_GUID;
-static grub_efi_guid_t pxe_io_guid = GRUB_EFI_PXE_GUID;
+static grub_guid_t net_io_guid = GRUB_EFI_SIMPLE_NETWORK_GUID;
+static grub_guid_t pxe_io_guid = GRUB_EFI_PXE_GUID;
 
 static grub_err_t
 send_card_buffer (struct grub_net_card *dev,
diff --git a/grub-core/term/efi/console.c b/grub-core/term/efi/console.c
index 532948a8e..53c33872b 100644
--- a/grub-core/term/efi/console.c
+++ b/grub-core/term/efi/console.c
@@ -353,7 +353,7 @@ grub_console_getkeystatus (struct grub_term_input *term)
 static grub_err_t
 grub_efi_console_input_init (struct grub_term_input *term)
 {
-  static grub_efi_guid_t text_input_ex_guid =
+  static grub_guid_t text_input_ex_guid =
     GRUB_EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID;
 
   if (grub_efi_is_finished)
diff --git a/grub-core/term/efi/serial.c b/grub-core/term/efi/serial.c
index 4c94723c5..b0fa73634 100644
--- a/grub-core/term/efi/serial.c
+++ b/grub-core/term/efi/serial.c
@@ -31,7 +31,7 @@
 #include <grub/i18n.h>
 
 /* GUID.  */
-static grub_efi_guid_t serial_io_guid = GRUB_EFI_SERIAL_IO_GUID;
+static grub_guid_t serial_io_guid = GRUB_EFI_SERIAL_IO_GUID;
 
 static void
 do_real_config (struct grub_serial_port *port)
diff --git a/grub-core/video/efi_gop.c b/grub-core/video/efi_gop.c
index 7a5054631..86e21d7df 100644
--- a/grub-core/video/efi_gop.c
+++ b/grub-core/video/efi_gop.c
@@ -32,10 +32,10 @@
 
 GRUB_MOD_LICENSE ("GPLv3+");
 
-static grub_efi_guid_t graphics_output_guid = GRUB_EFI_GOP_GUID;
-static grub_efi_guid_t active_edid_guid = GRUB_EFI_EDID_ACTIVE_GUID;
-static grub_efi_guid_t discovered_edid_guid = GRUB_EFI_EDID_DISCOVERED_GUID;
-static grub_efi_guid_t efi_var_guid = GRUB_EFI_GLOBAL_VARIABLE_GUID;
+static grub_guid_t graphics_output_guid = GRUB_EFI_GOP_GUID;
+static grub_guid_t active_edid_guid = GRUB_EFI_EDID_ACTIVE_GUID;
+static grub_guid_t discovered_edid_guid = GRUB_EFI_EDID_DISCOVERED_GUID;
+static grub_guid_t efi_var_guid = GRUB_EFI_GLOBAL_VARIABLE_GUID;
 static struct grub_efi_gop *gop;
 static unsigned old_mode;
 static int restore_needed;
diff --git a/grub-core/video/efi_uga.c b/grub-core/video/efi_uga.c
index e74d6c235..a931eecfb 100644
--- a/grub-core/video/efi_uga.c
+++ b/grub-core/video/efi_uga.c
@@ -32,7 +32,7 @@
 
 GRUB_MOD_LICENSE ("GPLv3+");
 
-static grub_efi_guid_t uga_draw_guid = GRUB_EFI_UGA_DRAW_GUID;
+static grub_guid_t uga_draw_guid = GRUB_EFI_UGA_DRAW_GUID;
 static struct grub_efi_uga_draw_protocol *uga;
 static grub_uint64_t uga_fb;
 static grub_uint32_t uga_pitch;
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
index ad2680341..a6bd74b96 100644
--- a/include/grub/efi/api.h
+++ b/include/grub/efi/api.h
@@ -639,24 +639,6 @@ typedef grub_uint8_t grub_efi_ip_address_t[8] __attribute__ ((aligned(4)));
 typedef grub_efi_uint64_t grub_efi_physical_address_t;
 typedef grub_efi_uint64_t grub_efi_virtual_address_t;
 
-struct grub_efi_guid
-{
-  grub_uint32_t data1;
-  grub_uint16_t data2;
-  grub_uint16_t data3;
-  grub_uint8_t data4[8];
-} __attribute__ ((aligned(8)));
-typedef struct grub_efi_guid grub_efi_guid_t;
-
-struct grub_efi_packed_guid
-{
-  grub_uint32_t data1;
-  grub_uint16_t data2;
-  grub_uint16_t data3;
-  grub_uint8_t data4[8];
-} GRUB_PACKED;
-typedef struct grub_efi_packed_guid grub_efi_packed_guid_t;
-
 /* XXX although the spec does not specify the padding, this actually
    must have the padding!  */
 struct grub_efi_memory_descriptor
@@ -743,7 +725,7 @@ typedef struct grub_efi_memory_mapped_device_path grub_efi_memory_mapped_device_
 struct grub_efi_vendor_device_path
 {
   grub_efi_device_path_t header;
-  grub_efi_packed_guid_t vendor_guid;
+  grub_guid_t vendor_guid;
   grub_efi_uint8_t vendor_defined_data[0];
 } GRUB_PACKED;
 typedef struct grub_efi_vendor_device_path grub_efi_vendor_device_path_t;
@@ -987,7 +969,7 @@ typedef struct grub_efi_cdrom_device_path grub_efi_cdrom_device_path_t;
 struct grub_efi_vendor_media_device_path
 {
   grub_efi_device_path_t header;
-  grub_efi_packed_guid_t vendor_guid;
+  grub_guid_t vendor_guid;
   grub_efi_uint8_t vendor_defined_data[0];
 } GRUB_PACKED;
 typedef struct grub_efi_vendor_media_device_path grub_efi_vendor_media_device_path_t;
@@ -1006,7 +988,7 @@ typedef struct grub_efi_file_path_device_path grub_efi_file_path_device_path_t;
 struct grub_efi_protocol_device_path
 {
   grub_efi_device_path_t header;
-  grub_efi_packed_guid_t guid;
+  grub_guid_t guid;
 } GRUB_PACKED;
 typedef struct grub_efi_protocol_device_path grub_efi_protocol_device_path_t;
 
@@ -1015,7 +997,7 @@ typedef struct grub_efi_protocol_device_path grub_efi_protocol_device_path_t;
 struct grub_efi_piwg_device_path
 {
   grub_efi_device_path_t header;
-  grub_efi_packed_guid_t guid;
+  grub_guid_t guid;
 } GRUB_PACKED;
 typedef struct grub_efi_piwg_device_path grub_efi_piwg_device_path_t;
 
@@ -1186,47 +1168,47 @@ struct grub_efi_boot_services
 
   grub_efi_status_t
   (*install_protocol_interface) (grub_efi_handle_t *handle,
-				 grub_efi_guid_t *protocol,
+				 grub_guid_t *protocol,
 				 grub_efi_interface_type_t protocol_interface_type,
 				 void *protocol_interface);
 
   grub_efi_status_t
   (*reinstall_protocol_interface) (grub_efi_handle_t handle,
-				   grub_efi_guid_t *protocol,
+				   grub_guid_t *protocol,
 				   void *old_interface,
 				   void *new_interface);
 
   grub_efi_status_t
   (*uninstall_protocol_interface) (grub_efi_handle_t handle,
-				   grub_efi_guid_t *protocol,
+				   grub_guid_t *protocol,
 				   void *protocol_interface);
 
   grub_efi_status_t
   (*handle_protocol) (grub_efi_handle_t handle,
-		      grub_efi_guid_t *protocol,
+		      grub_guid_t *protocol,
 		      void **protocol_interface);
 
   void *reserved;
 
   grub_efi_status_t
-  (*register_protocol_notify) (grub_efi_guid_t *protocol,
+  (*register_protocol_notify) (grub_guid_t *protocol,
 			       grub_efi_event_t event,
 			       void **registration);
 
   grub_efi_status_t
   (*locate_handle) (grub_efi_locate_search_type_t search_type,
-		    grub_efi_guid_t *protocol,
+		    grub_guid_t *protocol,
 		    void *search_key,
 		    grub_efi_uintn_t *buffer_size,
 		    grub_efi_handle_t *buffer);
 
   grub_efi_status_t
-  (*locate_device_path) (grub_efi_guid_t *protocol,
+  (*locate_device_path) (grub_guid_t *protocol,
 			 grub_efi_device_path_t **device_path,
 			 grub_efi_handle_t *device);
 
   grub_efi_status_t
-  (*install_configuration_table) (grub_efi_guid_t *guid, void *table);
+  (*install_configuration_table) (grub_guid_t *guid, void *table);
 
   grub_efi_status_t
   (*load_image) (grub_efi_boolean_t boot_policy,
@@ -1279,7 +1261,7 @@ struct grub_efi_boot_services
 
   grub_efi_status_t
   (*open_protocol) (grub_efi_handle_t handle,
-		    grub_efi_guid_t *protocol,
+		    grub_guid_t *protocol,
 		    void **protocol_interface,
 		    grub_efi_handle_t agent_handle,
 		    grub_efi_handle_t controller_handle,
@@ -1287,30 +1269,30 @@ struct grub_efi_boot_services
 
   grub_efi_status_t
   (*close_protocol) (grub_efi_handle_t handle,
-		     grub_efi_guid_t *protocol,
+		     grub_guid_t *protocol,
 		     grub_efi_handle_t agent_handle,
 		     grub_efi_handle_t controller_handle);
 
   grub_efi_status_t
   (*open_protocol_information) (grub_efi_handle_t handle,
-				grub_efi_guid_t *protocol,
+				grub_guid_t *protocol,
 				grub_efi_open_protocol_information_entry_t **entry_buffer,
 				grub_efi_uintn_t *entry_count);
 
   grub_efi_status_t
   (*protocols_per_handle) (grub_efi_handle_t handle,
-			   grub_efi_packed_guid_t ***protocol_buffer,
+			   grub_guid_t ***protocol_buffer,
 			   grub_efi_uintn_t *protocol_buffer_count);
 
   grub_efi_status_t
   (*locate_handle_buffer) (grub_efi_locate_search_type_t search_type,
-			   grub_efi_guid_t *protocol,
+			   grub_guid_t *protocol,
 			   void *search_key,
 			   grub_efi_uintn_t *no_handles,
 			   grub_efi_handle_t **buffer);
 
   grub_efi_status_t
-  (*locate_protocol) (grub_efi_guid_t *protocol,
+  (*locate_protocol) (grub_guid_t *protocol,
 		      void *registration,
 		      void **protocol_interface);
 
@@ -1368,7 +1350,7 @@ struct grub_efi_runtime_services
 
   grub_efi_status_t
   (*get_variable) (grub_efi_char16_t *variable_name,
-		   const grub_efi_guid_t *vendor_guid,
+		   const grub_guid_t *vendor_guid,
 		   grub_efi_uint32_t *attributes,
 		   grub_efi_uintn_t *data_size,
 		   void *data);
@@ -1376,11 +1358,11 @@ struct grub_efi_runtime_services
   grub_efi_status_t
   (*get_next_variable_name) (grub_efi_uintn_t *variable_name_size,
 			     grub_efi_char16_t *variable_name,
-			     grub_efi_guid_t *vendor_guid);
+			     grub_guid_t *vendor_guid);
 
   grub_efi_status_t
   (*set_variable) (grub_efi_char16_t *variable_name,
-		   const grub_efi_guid_t *vendor_guid,
+		   const grub_guid_t *vendor_guid,
 		   grub_efi_uint32_t attributes,
 		   grub_efi_uintn_t data_size,
 		   void *data);
@@ -1398,7 +1380,7 @@ typedef struct grub_efi_runtime_services grub_efi_runtime_services_t;
 
 struct grub_efi_configuration_table
 {
-  grub_efi_packed_guid_t vendor_guid;
+  grub_guid_t vendor_guid;
   void *vendor_table;
 } GRUB_PACKED;
 typedef struct grub_efi_configuration_table grub_efi_configuration_table_t;
@@ -1765,7 +1747,7 @@ struct grub_efi_shim_lock_protocol
 };
 typedef struct grub_efi_shim_lock_protocol grub_efi_shim_lock_protocol_t;
 
-typedef grub_efi_guid_t grub_efi_rng_algorithm_t;
+typedef grub_guid_t grub_efi_rng_algorithm_t;
 
 struct grub_efi_rng_protocol
 {
diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
index 8e9a905a4..466ac3867 100644
--- a/include/grub/efi/efi.h
+++ b/include/grub/efi/efi.h
@@ -25,18 +25,18 @@
 #include <grub/efi/api.h>
 
 /* Functions.  */
-void *EXPORT_FUNC(grub_efi_locate_protocol) (grub_efi_guid_t *protocol,
+void *EXPORT_FUNC(grub_efi_locate_protocol) (grub_guid_t *protocol,
 					     void *registration);
 grub_efi_handle_t *
 EXPORT_FUNC(grub_efi_locate_handle) (grub_efi_locate_search_type_t search_type,
-				     grub_efi_guid_t *protocol,
+				     grub_guid_t *protocol,
 				     void *search_key,
 				     grub_efi_uintn_t *num_handles);
 void *EXPORT_FUNC(grub_efi_open_protocol) (grub_efi_handle_t handle,
-					   grub_efi_guid_t *protocol,
+					   grub_guid_t *protocol,
 					   grub_efi_uint32_t attributes);
 grub_efi_status_t
-EXPORT_FUNC(grub_efi_close_protocol) (grub_efi_handle_t handle, grub_efi_guid_t *protocol);
+EXPORT_FUNC(grub_efi_close_protocol) (grub_efi_handle_t handle, grub_guid_t *protocol);
 int EXPORT_FUNC(grub_efi_set_text_mode) (int on);
 void EXPORT_FUNC(grub_efi_stall) (grub_efi_uintn_t microseconds);
 void *
@@ -77,23 +77,23 @@ grub_err_t EXPORT_FUNC (grub_efi_set_virtual_address_map) (grub_efi_uintn_t memo
 							   grub_efi_uint32_t descriptor_version,
 							   grub_efi_memory_descriptor_t *virtual_map);
 grub_efi_status_t EXPORT_FUNC (grub_efi_get_variable_with_attributes) (const char *variable,
-								       const grub_efi_guid_t *guid,
+								       const grub_guid_t *guid,
 								       grub_size_t *datasize_out,
 								       void **data_out,
 								       grub_efi_uint32_t *attributes);
 grub_efi_status_t EXPORT_FUNC (grub_efi_get_variable) (const char *variable,
-						       const grub_efi_guid_t *guid,
+						       const grub_guid_t *guid,
 						       grub_size_t *datasize_out,
 						       void **data_out);
 grub_err_t
 EXPORT_FUNC (grub_efi_set_variable_with_attributes) (const char *var,
-				     const grub_efi_guid_t *guid,
+				     const grub_guid_t *guid,
 				     void *data,
 				     grub_size_t datasize,
 				     grub_efi_uint32_t attributes);
 grub_err_t
 EXPORT_FUNC (grub_efi_set_variable) (const char *var,
-				     const grub_efi_guid_t *guid,
+				     const grub_guid_t *guid,
 				     void *data,
 				     grub_size_t datasize);
 int
diff --git a/include/grub/efiemu/efiemu.h b/include/grub/efiemu/efiemu.h
index 5325e5839..caf0b505f 100644
--- a/include/grub/efiemu/efiemu.h
+++ b/include/grub/efiemu/efiemu.h
@@ -176,26 +176,26 @@ grub_err_t grub_efiemu_loadcore_load (void);
 struct grub_efiemu_configuration_table
 {
   struct grub_efiemu_configuration_table *next;
-  grub_efi_guid_t guid;
+  grub_guid_t guid;
   void * (*get_table) (void *data);
   void (*unload) (void *data);
   void *data;
 };
 struct grub_efiemu_configuration_table32
 {
-  grub_efi_packed_guid_t vendor_guid;
+  grub_guid_t vendor_guid;
   grub_efi_uint32_t vendor_table;
 } GRUB_PACKED;
 typedef struct grub_efiemu_configuration_table32 grub_efiemu_configuration_table32_t;
 struct grub_efiemu_configuration_table64
 {
-  grub_efi_packed_guid_t vendor_guid;
+  grub_guid_t vendor_guid;
   grub_efi_uint64_t vendor_table;
 } GRUB_PACKED;
 typedef struct grub_efiemu_configuration_table64 grub_efiemu_configuration_table64_t;
-grub_err_t grub_efiemu_unregister_configuration_table (grub_efi_guid_t guid);
+grub_err_t grub_efiemu_unregister_configuration_table (grub_guid_t guid);
 grub_err_t
-grub_efiemu_register_configuration_table (grub_efi_guid_t guid,
+grub_efiemu_register_configuration_table (grub_guid_t guid,
 					  void * (*get_table) (void *data),
 					  void (*unload) (void *data),
 					  void *data);
diff --git a/include/grub/efiemu/runtime.h b/include/grub/efiemu/runtime.h
index 36d2dedf4..c9ad9fdfa 100644
--- a/include/grub/efiemu/runtime.h
+++ b/include/grub/efiemu/runtime.h
@@ -29,7 +29,7 @@ struct grub_efiemu_ptv_rel
 
 struct efi_variable
 {
-  grub_efi_packed_guid_t guid;
+  grub_guid_t guid;
   grub_uint32_t namelen;
   grub_uint32_t size;
   grub_efi_uint32_t attributes;
diff --git a/include/grub/types.h b/include/grub/types.h
index 6d5dc5cda..c56ce9820 100644
--- a/include/grub/types.h
+++ b/include/grub/types.h
@@ -365,4 +365,13 @@ static inline void grub_set_unaligned64 (void *ptr, grub_uint64_t val)
 # define grub_absolute_pointer(val) ((void *) (val))
 #endif
 
+struct grub_guid
+{
+  grub_uint32_t data1;
+  grub_uint16_t data2;
+  grub_uint16_t data3;
+  grub_uint8_t data4[8];
+} GRUB_PACKED;
+typedef struct grub_guid grub_guid_t;
+
 #endif /* ! GRUB_TYPES_HEADER */
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 04/10] kern/misc: Add a format specifier GUIDs.
  2023-03-02 18:20 [PATCH v3 00/10] Add basic Boot Loader Interface support Oliver Steffen
                   ` (2 preceding siblings ...)
  2023-03-02 18:20 ` [PATCH v3 03/10] Unify GUID types Oliver Steffen
@ 2023-03-02 18:20 ` Oliver Steffen
  2023-03-02 18:20 ` [PATCH v3 05/10] grub-core: Make use of guid printf format specifier Oliver Steffen
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 18+ messages in thread
From: Oliver Steffen @ 2023-03-02 18:20 UTC (permalink / raw)
  To: grub-devel
  Cc: Daniel Kiper, Gerd Hoffmann, Javier Martinez Canillas, Oliver Steffen

Extend the printf format specifier for pointers (%p) to accept a suffix
specifier G to print GUIDs: %pG can be used to print grub_guid structs.
This does not interfere with the -Wformat checking of gcc.  Note that
the data type is not checked though (%p accepts void*).
---
 grub-core/kern/misc.c | 86 ++++++++++++++++++++++++++++++++-----------
 1 file changed, 65 insertions(+), 21 deletions(-)

diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
index dfae4f9d7..1a8aff543 100644
--- a/grub-core/kern/misc.c
+++ b/grub-core/kern/misc.c
@@ -24,6 +24,7 @@
 #include <grub/term.h>
 #include <grub/env.h>
 #include <grub/i18n.h>
+#include <grub/types.h>
 
 union printf_arg
 {
@@ -34,7 +35,8 @@ union printf_arg
     {
       INT, LONG, LONGLONG,
       UNSIGNED_INT = 3, UNSIGNED_LONG, UNSIGNED_LONGLONG,
-      STRING
+      STRING,
+      GUID
     } type;
   long long ll;
 };
@@ -772,6 +774,9 @@ parse_printf_arg_fmt (const char *fmt0, struct printf_args *args,
       switch (c)
 	{
 	case 'p':
+	  if (*(fmt) == 'G')
+	    ++fmt;
+	  /* Fall through. */
 	case 'x':
 	case 'X':
 	case 'u':
@@ -885,6 +890,10 @@ parse_printf_arg_fmt (const char *fmt0, struct printf_args *args,
 	    args->ptr[curn].type = UNSIGNED_LONGLONG;
 	  else
 	    args->ptr[curn].type = UNSIGNED_INT;
+	  if (*(fmt) == 'G') {
+	    args->ptr[curn].type = GUID;
+	    ++fmt;
+	  }
 	  break;
 	case 's':
 	  args->ptr[curn].type = STRING;
@@ -931,6 +940,12 @@ parse_printf_args (const char *fmt0, struct printf_args *args, va_list args_in)
 	else
 	  args->ptr[n].ll = va_arg (args_in, unsigned int);
 	break;
+      case GUID:
+	if (sizeof (void *) == sizeof (long long))
+	  args->ptr[n].ll = va_arg (args_in, long long);
+	else
+	  args->ptr[n].ll = va_arg (args_in, unsigned int);
+	break;
       }
 }
 
@@ -943,6 +958,27 @@ write_char (char *str, grub_size_t *count, grub_size_t max_len, unsigned char ch
   (*count)++;
 }
 
+static void
+write_number (char *str, grub_size_t *count, grub_size_t max_len, grub_size_t format1,
+	     char rightfill, char zerofill, char c, long long value)
+{
+  char tmp[32];
+  const char *p = tmp;
+  grub_size_t len;
+  grub_size_t fill;
+
+  len = grub_lltoa (tmp, c, value) - tmp;
+  fill = len < format1 ? format1 - len : 0;
+  if (! rightfill)
+    while (fill--)
+      write_char (str, count, max_len, zerofill);
+  while (*p)
+    write_char (str, count, max_len, *p++);
+  if (rightfill)
+    while (fill--)
+      write_char (str, count, max_len, zerofill);
+}
+
 static int
 grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0,
 		     struct printf_args *args)
@@ -1025,31 +1061,39 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0,
       switch (c)
 	{
 	case 'p':
-	  write_char (str, &count, max_len, '0');
-	  write_char (str, &count, max_len, 'x');
-	  c = 'x';
+	  if (*(fmt) == 'G')
+	    {
+	      ++fmt;
+	      grub_guid_t *guid = (grub_guid_t *) curarg;
+	      write_number (str, &count, max_len, 8, 0, '0', 'x', grub_le_to_cpu32 (guid->data1));
+	      write_char (str, &count, max_len, '-');
+	      write_number (str, &count, max_len, 4, 0, '0', 'x', grub_le_to_cpu16 (guid->data2));
+	      write_char (str, &count, max_len, '-');
+	      write_number (str, &count, max_len, 4, 0, '0', 'x', grub_le_to_cpu16 (guid->data3));
+	      write_char (str, &count, max_len, '-');
+	      write_number (str, &count, max_len, 2, 0, '0', 'x', guid->data4[0]);
+	      write_number (str, &count, max_len, 2, 0, '0', 'x', guid->data4[1]);
+	      write_char (str, &count, max_len, '-');
+	      write_number (str, &count, max_len, 2, 0, '0', 'x', guid->data4[2]);
+	      write_number (str, &count, max_len, 2, 0, '0', 'x', guid->data4[3]);
+	      write_number (str, &count, max_len, 2, 0, '0', 'x', guid->data4[4]);
+	      write_number (str, &count, max_len, 2, 0, '0', 'x', guid->data4[5]);
+	      write_number (str, &count, max_len, 2, 0, '0', 'x', guid->data4[6]);
+	      write_number (str, &count, max_len, 2, 0, '0', 'x', guid->data4[7]);
+	      break;
+	    }
+	  else
+	    {
+	      write_char (str, &count, max_len, '0');
+	      write_char (str, &count, max_len, 'x');
+	      c = 'x';
+	    }
 	  /* Fall through. */
 	case 'x':
 	case 'X':
 	case 'u':
 	case 'd':
-	  {
-	    char tmp[32];
-	    const char *p = tmp;
-	    grub_size_t len;
-	    grub_size_t fill;
-
-	    len = grub_lltoa (tmp, c, curarg) - tmp;
-	    fill = len < format1 ? format1 - len : 0;
-	    if (! rightfill)
-	      while (fill--)
-		write_char (str, &count, max_len, zerofill);
-	    while (*p)
-	      write_char (str, &count, max_len, *p++);
-	    if (rightfill)
-	      while (fill--)
-		write_char (str, &count, max_len, zerofill);
-	  }
+	  write_number (str, &count, max_len, format1, rightfill, zerofill, c, curarg);
 	  break;
 
 	case 'c':
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 05/10] grub-core: Make use of guid printf format specifier
  2023-03-02 18:20 [PATCH v3 00/10] Add basic Boot Loader Interface support Oliver Steffen
                   ` (3 preceding siblings ...)
  2023-03-02 18:20 ` [PATCH v3 04/10] kern/misc: Add a format specifier GUIDs Oliver Steffen
@ 2023-03-02 18:20 ` Oliver Steffen
  2023-03-08 14:16   ` Daniel Kiper
  2023-03-02 18:20 ` [PATCH v3 06/10] Add a module for the Boot Loader Interface Oliver Steffen
                   ` (4 subsequent siblings)
  9 siblings, 1 reply; 18+ messages in thread
From: Oliver Steffen @ 2023-03-02 18:20 UTC (permalink / raw)
  To: grub-devel
  Cc: Daniel Kiper, Gerd Hoffmann, Javier Martinez Canillas, Oliver Steffen

Use the new printf format specifier %pG.

Fixes the text representation of GUIDs in the output of the lsefisystab
command.

Signed-off-by: Oliver Steffen <osteffen@redhat.com>
---
 grub-core/commands/efi/lsefi.c       | 13 +------------
 grub-core/commands/efi/lsefisystab.c |  6 +-----
 grub-core/commands/probe.c           |  9 +--------
 grub-core/kern/efi/efi.c             | 28 ++--------------------------
 grub-core/loader/i386/xnu.c          |  9 ++-------
 5 files changed, 7 insertions(+), 58 deletions(-)

diff --git a/grub-core/commands/efi/lsefi.c b/grub-core/commands/efi/lsefi.c
index ff3e71a91..f9c18df2b 100644
--- a/grub-core/commands/efi/lsefi.c
+++ b/grub-core/commands/efi/lsefi.c
@@ -123,18 +123,7 @@ grub_cmd_lsefi (grub_command_t cmd __attribute__ ((unused)),
 	  if (k < ARRAY_SIZE (known_protocols))
 	    grub_printf ("  %s\n", known_protocols[k].name);
 	  else
-	    grub_printf ("  %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x\n",
-			 protocols[j]->data1,
-			 protocols[j]->data2,
-			 protocols[j]->data3,
-			 (unsigned) protocols[j]->data4[0],
-			 (unsigned) protocols[j]->data4[1],
-			 (unsigned) protocols[j]->data4[2],
-			 (unsigned) protocols[j]->data4[3],
-			 (unsigned) protocols[j]->data4[4],
-			 (unsigned) protocols[j]->data4[5],
-			 (unsigned) protocols[j]->data4[6],
-			 (unsigned) protocols[j]->data4[7]);
+	    grub_printf ("  %pG\n", protocols[j]);
 	}
 
     }
diff --git a/grub-core/commands/efi/lsefisystab.c b/grub-core/commands/efi/lsefisystab.c
index eff8c41f3..79ccee12a 100644
--- a/grub-core/commands/efi/lsefisystab.c
+++ b/grub-core/commands/efi/lsefisystab.c
@@ -96,11 +96,7 @@ grub_cmd_lsefisystab (struct grub_command *cmd __attribute__ ((unused)),
 
       grub_printf ("%p  ", t->vendor_table);
 
-      grub_printf ("%08x-%04x-%04x-",
-		   t->vendor_guid.data1, t->vendor_guid.data2,
-		   t->vendor_guid.data3);
-      for (j = 0; j < 8; j++)
-	grub_printf ("%02x", t->vendor_guid.data4[j]);
+      grub_printf ("%pG", &t->vendor_guid);
 
       for (j = 0; j < ARRAY_SIZE (guid_mappings); j++)
 	if (grub_memcmp (&guid_mappings[j].guid, &t->vendor_guid,
diff --git a/grub-core/commands/probe.c b/grub-core/commands/probe.c
index 9a80ea54f..4eee8f5ac 100644
--- a/grub-core/commands/probe.c
+++ b/grub-core/commands/probe.c
@@ -130,14 +130,7 @@ grub_cmd_probe (grub_extcmd_context_t ctxt, int argc, char **args)
 		  return grub_errno;
 		}
 	      guid = &entry.guid;
-	      grub_snprintf (val, sizeof(val),
-			     "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
-			     grub_le_to_cpu32 (guid->data1),
-			     grub_le_to_cpu16 (guid->data2),
-			     grub_le_to_cpu16 (guid->data3),
-			     guid->data4[0], guid->data4[1], guid->data4[2],
-			     guid->data4[3], guid->data4[4], guid->data4[5],
-			     guid->data4[6], guid->data4[7]);
+	      grub_snprintf (val, sizeof(val), "%pG", guid);
 	    }
 	  else if (grub_strcmp(dev->disk->partition->partmap->name, "msdos") == 0)
 	    {
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
index cd73b0fbf..91aa5d644 100644
--- a/grub-core/kern/efi/efi.c
+++ b/grub-core/kern/efi/efi.c
@@ -550,20 +550,7 @@ static void
 dump_vendor_path (const char *type, grub_efi_vendor_device_path_t *vendor)
 {
   grub_uint32_t vendor_data_len = vendor->header.length - sizeof (*vendor);
-  grub_printf ("/%sVendor(%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x)[%x: ",
-	       type,
-	       (unsigned) vendor->vendor_guid.data1,
-	       (unsigned) vendor->vendor_guid.data2,
-	       (unsigned) vendor->vendor_guid.data3,
-	       (unsigned) vendor->vendor_guid.data4[0],
-	       (unsigned) vendor->vendor_guid.data4[1],
-	       (unsigned) vendor->vendor_guid.data4[2],
-	       (unsigned) vendor->vendor_guid.data4[3],
-	       (unsigned) vendor->vendor_guid.data4[4],
-	       (unsigned) vendor->vendor_guid.data4[5],
-	       (unsigned) vendor->vendor_guid.data4[6],
-	       (unsigned) vendor->vendor_guid.data4[7],
-	       vendor_data_len);
+  grub_printf ("/%sVendor(%pG)[%x: ", type, &vendor->vendor_guid, vendor_data_len);
   if (vendor->header.length > sizeof (*vendor))
     {
       grub_uint32_t i;
@@ -934,18 +921,7 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
 	      {
 		grub_efi_protocol_device_path_t *proto
 		  = (grub_efi_protocol_device_path_t *) dp;
-		grub_printf ("/Protocol(%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x)",
-			     (unsigned) proto->guid.data1,
-			     (unsigned) proto->guid.data2,
-			     (unsigned) proto->guid.data3,
-			     (unsigned) proto->guid.data4[0],
-			     (unsigned) proto->guid.data4[1],
-			     (unsigned) proto->guid.data4[2],
-			     (unsigned) proto->guid.data4[3],
-			     (unsigned) proto->guid.data4[4],
-			     (unsigned) proto->guid.data4[5],
-			     (unsigned) proto->guid.data4[6],
-			     (unsigned) proto->guid.data4[7]);
+		grub_printf ("/Protocol(%pG)",&proto->guid);
 	      }
 	      break;
 	    default:
diff --git a/grub-core/loader/i386/xnu.c b/grub-core/loader/i386/xnu.c
index 93ba4476d..4e31ce99a 100644
--- a/grub-core/loader/i386/xnu.c
+++ b/grub-core/loader/i386/xnu.c
@@ -726,13 +726,8 @@ grub_cpu_xnu_fill_devicetree (grub_uint64_t *fsbfreq_out)
 #endif
 
       /* The name of key for new table. */
-      grub_snprintf (guidbuf, sizeof (guidbuf), "%08x-%04x-%04x-%02x%02x-",
-		     guid.data1, guid.data2, guid.data3, guid.data4[0],
-		     guid.data4[1]);
-      for (j = 2; j < 8; j++)
-	grub_snprintf (guidbuf + grub_strlen (guidbuf),
-		       sizeof (guidbuf) - grub_strlen (guidbuf),
-		       "%02x", guid.data4[j]);
+      grub_snprintf (guidbuf, sizeof (guidbuf), "%pG", &guid);
+
       /* For some reason GUID has to be in uppercase. */
       for (j = 0; guidbuf[j] ; j++)
 	if (guidbuf[j] >= 'a' && guidbuf[j] <= 'f')
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 06/10] Add a module for the Boot Loader Interface
  2023-03-02 18:20 [PATCH v3 00/10] Add basic Boot Loader Interface support Oliver Steffen
                   ` (4 preceding siblings ...)
  2023-03-02 18:20 ` [PATCH v3 05/10] grub-core: Make use of guid printf format specifier Oliver Steffen
@ 2023-03-02 18:20 ` Oliver Steffen
  2023-03-08 15:01   ` Daniel Kiper
  2023-03-02 18:20 ` [PATCH v3 07/10] grub-core/kern/efi: Remove redundant null-termination Oliver Steffen
                   ` (3 subsequent siblings)
  9 siblings, 1 reply; 18+ messages in thread
From: Oliver Steffen @ 2023-03-02 18:20 UTC (permalink / raw)
  To: grub-devel
  Cc: Daniel Kiper, Gerd Hoffmann, Javier Martinez Canillas, Oliver Steffen

Add a new module named boot_loader_interface, 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 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/

Signed-off-by: Oliver Steffen <osteffen@redhat.com>
---
 grub-core/Makefile.core.def |   6 ++
 grub-core/commands/bli.c    | 199 ++++++++++++++++++++++++++++++++++++
 include/grub/efi/api.h      |   5 +
 3 files changed, 210 insertions(+)
 create mode 100644 grub-core/commands/bli.c

diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 71093a100..cdfa2d101 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -2548,3 +2548,9 @@ module = {
   common = commands/i386/wrmsr.c;
   enable = x86;
 };
+
+module = {
+  name = bli;
+  efi = commands/bli.c;
+  enable = efi;
+};
diff --git a/grub-core/commands/bli.c b/grub-core/commands/bli.c
new file mode 100644
index 000000000..0ff44d58a
--- /dev/null
+++ b/grub-core/commands/bli.c
@@ -0,0 +1,199 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2023  Free Software Foundation, Inc.
+ *
+ *  GRUB is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  GRUB is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ *  Implementation of the Boot Loader Interface.
+ */
+
+#include <grub/charset.h>
+#include <grub/efi/api.h>
+#include <grub/efi/disk.h>
+#include <grub/efi/efi.h>
+#include <grub/err.h>
+#include <grub/extcmd.h>
+#include <grub/gpt_partition.h>
+#include <grub/misc.h>
+#include <grub/mm.h>
+#include <grub/partition.h>
+#include <grub/types.h>
+
+GRUB_MOD_LICENSE ("GPLv3+");
+
+#define MODNAME "bli"
+
+static const grub_guid_t bli_vendor_guid = GRUB_EFI_VENDOR_BOOT_LOADER_INTERFACE_GUID;
+
+static grub_err_t
+get_part_uuid (grub_device_t dev, char **part_uuid)
+{
+  grub_err_t status = GRUB_ERR_NONE;
+  grub_disk_t disk;
+  struct grub_gpt_partentry entry;
+
+  if (dev == NULL || dev->disk == NULL || dev->disk->partition == NULL)
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("invalid device"));
+
+  disk = grub_disk_open (dev->disk->name);
+  if (disk == NULL)
+    {
+      status = grub_errno;
+      char *part = grub_partition_get_name (dev->disk->partition);
+      grub_dprintf (MODNAME, "error opening disk: %s%s%s\n", dev->disk->name,
+		    dev->disk->partition != NULL ? "," : "",
+		    part != NULL ? part : "UNKNOWN");
+      grub_free (part);
+      return status;
+    }
+
+  if (grub_strcmp (dev->disk->partition->partmap->name, "gpt") != 0)
+    {
+      char *part = grub_partition_get_name (dev->disk->partition);
+      status = grub_error (GRUB_ERR_BAD_PART_TABLE,
+		           "this is not a GPT partition table: %s%s%s", dev->disk->name,
+			   dev->disk->partition != NULL ? "," : "",
+			   part != NULL ? part : "UNKNOWN");
+      grub_free (part);
+      goto fail;
+    }
+
+  if (grub_disk_read (disk, dev->disk->partition->offset,
+		      dev->disk->partition->index, sizeof (entry), &entry) != GRUB_ERR_NONE)
+    {
+      status = grub_errno;
+      char *part = grub_partition_get_name (dev->disk->partition);
+      grub_dprintf (MODNAME, "read error: %s%s%s\n", dev->disk->name,
+		    dev->disk->partition != NULL ? "," : "",
+		    part != NULL ? part : "UNKNOWN");
+      grub_free (part);
+      goto fail;
+    }
+
+  *part_uuid = grub_xasprintf ("%pG", &entry.guid);
+  if (*part_uuid == NULL)
+    status = grub_errno;
+
+ fail:
+  grub_disk_close (disk);
+
+  return status;
+}
+
+static grub_err_t
+set_efi_str_variable (const char *name, const grub_guid_t *guid,
+                      const char *value)
+{
+  grub_size_t len, len16;
+  grub_efi_char16_t *value_16;
+  grub_err_t status;
+
+  len = grub_strlen (value);
+
+  /* Check for integer overflow */
+  if (len > GRUB_SIZE_MAX / GRUB_MAX_UTF16_PER_UTF8 - 1)
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("data too large"));
+
+  len16 = len * GRUB_MAX_UTF16_PER_UTF8;
+
+  value_16 = grub_calloc (len16 + 1, sizeof (value_16[0]));
+  if (value_16 == NULL)
+    return grub_errno;
+
+  len16 = grub_utf8_to_utf16 (value_16, len16, (grub_uint8_t *) value, len, NULL);
+
+  status = grub_efi_set_variable_with_attributes (name, guid,
+			(void *) value_16, (len16 + 1) * sizeof (value_16[0]),
+			GRUB_EFI_VARIABLE_BOOTSERVICE_ACCESS
+			| GRUB_EFI_VARIABLE_RUNTIME_ACCESS);
+  if (status != GRUB_ERR_NONE)
+    grub_dprintf (MODNAME, "Error setting EFI variable %s: %d\n", name, status);
+
+  grub_free (value_16);
+
+  return status;
+}
+
+static grub_err_t
+set_loader_device_part_uuid (void)
+{
+  grub_efi_loaded_image_t *image;
+  char *device_name;
+  grub_err_t status = GRUB_ERR_NONE;
+  grub_device_t device;
+  char *part_uuid = NULL;
+
+  image = grub_efi_get_loaded_image (grub_efi_image_handle);
+  if (image == NULL)
+    return grub_error (GRUB_ERR_BAD_DEVICE, N_("unable to find boot device"));
+
+  device_name = grub_efidisk_get_device_name (image->device_handle);
+  if (device_name == NULL)
+    return grub_error (GRUB_ERR_BAD_DEVICE, N_("unable to find boot device"));
+
+  device = grub_device_open (device_name);
+  if (device == NULL)
+    {
+      status = grub_errno;
+      grub_dprintf (MODNAME, "Error opening device: %s", device_name);
+      goto fail;
+    }
+
+  status = get_part_uuid (device, &part_uuid);
+
+  grub_device_close (device);
+
+  if (status == GRUB_ERR_NONE)
+    status = set_efi_str_variable ("LoaderDevicePartUUID",
+				   &bli_vendor_guid,
+				   part_uuid);
+
+ fail:
+  grub_free (part_uuid);
+  grub_free (device_name);
+  return status;
+}
+
+static grub_err_t
+grub_cmd_bli (grub_extcmd_context_t ctxt __attribute__ ((unused)),
+	      int argc __attribute__ ((unused)),
+	      char **args __attribute__ ((unused)))
+{
+  grub_err_t status;
+
+  status = set_efi_str_variable ("LoaderInfo", &bli_vendor_guid, PACKAGE_STRING);
+  if (status != GRUB_ERR_NONE)
+    return status;
+
+  status = set_loader_device_part_uuid ();
+  if (status != GRUB_ERR_NONE)
+    return status;
+
+  return GRUB_ERR_NONE;
+}
+
+static grub_extcmd_t cmd;
+
+GRUB_MOD_INIT (bli)
+{
+  grub_dprintf (MODNAME, "%s got here\n", __func__);
+  cmd = grub_register_extcmd ("bli", grub_cmd_bli, 0, NULL,
+			      N_("Set EFI variables according to Boot Loader Interface spec."), NULL);
+}
+
+GRUB_MOD_FINI (bli)
+{
+  grub_unregister_extcmd (cmd);
+}
+
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
index a6bd74b96..d5b4f8c8e 100644
--- a/include/grub/efi/api.h
+++ b/include/grub/efi/api.h
@@ -374,6 +374,11 @@
     { 0xac, 0x74, 0xca, 0x55, 0x52, 0x31, 0xcc, 0x68 } \
   }
 
+#define GRUB_EFI_VENDOR_BOOT_LOADER_INTERFACE_GUID \
+  { 0x4a67b082, 0x0a4c, 0x41cf, \
+    {0xb6, 0xc7, 0x44, 0x0b, 0x29, 0xbb, 0x8c, 0x4f } \
+  }
+
 struct grub_efi_sal_system_table
 {
   grub_uint32_t signature;
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 07/10] grub-core/kern/efi: Remove redundant null-termination
  2023-03-02 18:20 [PATCH v3 00/10] Add basic Boot Loader Interface support Oliver Steffen
                   ` (5 preceding siblings ...)
  2023-03-02 18:20 ` [PATCH v3 06/10] Add a module for the Boot Loader Interface Oliver Steffen
@ 2023-03-02 18:20 ` Oliver Steffen
  2023-03-08 15:04   ` Daniel Kiper
  2023-03-02 18:20 ` [PATCH v3 08/10] types.h: Add GRUB_SSIZE_MAX Oliver Steffen
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 18+ messages in thread
From: Oliver Steffen @ 2023-03-02 18:20 UTC (permalink / raw)
  To: grub-devel
  Cc: Daniel Kiper, Gerd Hoffmann, Javier Martinez Canillas, Oliver Steffen

grub_calloc already initializes the buffer with \0, no
need to set the null-terminator at the end.

Signed-off-by: Oliver Steffen <osteffen@redhat.com>
---
 grub-core/kern/efi/efi.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
index 91aa5d644..008bf2f2e 100644
--- a/grub-core/kern/efi/efi.c
+++ b/grub-core/kern/efi/efi.c
@@ -221,7 +221,6 @@ grub_efi_set_variable_with_attributes (const char *var, const grub_guid_t *guid,
   if (!var16)
     return grub_errno;
   len16 = grub_utf8_to_utf16 (var16, len16, (grub_uint8_t *) var, len, NULL);
-  var16[len16] = 0;
 
   r = grub_efi_system_table->runtime_services;
 
@@ -267,7 +266,6 @@ grub_efi_get_variable_with_attributes (const char *var,
   if (!var16)
     return GRUB_EFI_OUT_OF_RESOURCES;
   len16 = grub_utf8_to_utf16 (var16, len16, (grub_uint8_t *) var, len, NULL);
-  var16[len16] = 0;
 
   r = grub_efi_system_table->runtime_services;
 
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 08/10] types.h: Add GRUB_SSIZE_MAX
  2023-03-02 18:20 [PATCH v3 00/10] Add basic Boot Loader Interface support Oliver Steffen
                   ` (6 preceding siblings ...)
  2023-03-02 18:20 ` [PATCH v3 07/10] grub-core/kern/efi: Remove redundant null-termination Oliver Steffen
@ 2023-03-02 18:20 ` Oliver Steffen
  2023-03-08 15:06   ` Daniel Kiper
  2023-03-02 18:20 ` [PATCH v3 09/10] commands/bli: Extract uft8 to utf16 conversion Oliver Steffen
  2023-03-02 18:20 ` [PATCH v3 10/10] util/grub.d: Activate bli module on EFI Oliver Steffen
  9 siblings, 1 reply; 18+ messages in thread
From: Oliver Steffen @ 2023-03-02 18:20 UTC (permalink / raw)
  To: grub-devel
  Cc: Daniel Kiper, Gerd Hoffmann, Javier Martinez Canillas, Oliver Steffen

In the same way as GRUB_SIZE_MAX, add GRUB_SSIZE_MAX.

Signed-off-by: Oliver Steffen <osteffen@redhat.com>
---
 include/grub/types.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/grub/types.h b/include/grub/types.h
index c56ce9820..9f43a5580 100644
--- a/include/grub/types.h
+++ b/include/grub/types.h
@@ -122,6 +122,7 @@ typedef grub_uint64_t	grub_size_t;
 typedef grub_int64_t	grub_ssize_t;
 
 # define GRUB_SIZE_MAX 18446744073709551615UL
+# define GRUB_SSIZE_MAX 9223372036854775807L
 
 # if GRUB_CPU_SIZEOF_LONG == 8
 #  define PRIxGRUB_SIZE	 "lx"
@@ -140,6 +141,7 @@ typedef grub_uint32_t	grub_size_t;
 typedef grub_int32_t	grub_ssize_t;
 
 # define GRUB_SIZE_MAX 4294967295UL
+# define GRUB_SSIZE_MAX 2147483647L
 
 # define PRIxGRUB_SIZE	"x"
 # define PRIxGRUB_ADDR	"x"
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 09/10] commands/bli: Extract uft8 to utf16 conversion
  2023-03-02 18:20 [PATCH v3 00/10] Add basic Boot Loader Interface support Oliver Steffen
                   ` (7 preceding siblings ...)
  2023-03-02 18:20 ` [PATCH v3 08/10] types.h: Add GRUB_SSIZE_MAX Oliver Steffen
@ 2023-03-02 18:20 ` Oliver Steffen
  2023-03-08 15:13   ` Daniel Kiper
  2023-03-02 18:20 ` [PATCH v3 10/10] util/grub.d: Activate bli module on EFI Oliver Steffen
  9 siblings, 1 reply; 18+ messages in thread
From: Oliver Steffen @ 2023-03-02 18:20 UTC (permalink / raw)
  To: grub-devel
  Cc: Daniel Kiper, Gerd Hoffmann, Javier Martinez Canillas, Oliver Steffen

Create a new function for utf-8 to utf-16 conversion called
`grub_utf8_to_utf16_alloc` in the bli module.  It is modeled after the
`grub_utf8_to_ucs4_alloc` like functions in charset.h.  The goal is to
move this to a central place so that it can help reduce code
duplication.

Please comment: Where should this go?
---
 grub-core/commands/bli.c | 47 ++++++++++++++++++++++++++++++----------
 1 file changed, 35 insertions(+), 12 deletions(-)

diff --git a/grub-core/commands/bli.c b/grub-core/commands/bli.c
index 0ff44d58a..371eb7074 100644
--- a/grub-core/commands/bli.c
+++ b/grub-core/commands/bli.c
@@ -36,6 +36,37 @@ GRUB_MOD_LICENSE ("GPLv3+");
 
 static const grub_guid_t bli_vendor_guid = GRUB_EFI_VENDOR_BOOT_LOADER_INTERFACE_GUID;
 
+/* To be moved to a central place */
+static grub_ssize_t
+grub_utf8_to_utf16_alloc (const char *str8, grub_uint16_t **utf16_msg, grub_uint16_t **last_position)
+{
+  grub_size_t len;
+  grub_size_t len16;
+
+  len = grub_strlen (str8);
+
+  /* Check for integer overflow */
+  if (len > GRUB_SSIZE_MAX / GRUB_MAX_UTF16_PER_UTF8 - 1)
+    {
+      grub_error (GRUB_ERR_BAD_ARGUMENT, N_("string too large"));
+      *utf16_msg = NULL;
+      return -1;
+    }
+
+  len16 = len * GRUB_MAX_UTF16_PER_UTF8;
+
+  *utf16_msg = grub_calloc (len16 + 1, sizeof (*utf16_msg[0]));
+  if (*utf16_msg == NULL)
+    return -1;
+
+  len16 = grub_utf8_to_utf16 (*utf16_msg, len16, (grub_uint8_t *) str8, len, NULL);
+
+  if (last_position)
+    *last_position = *utf16_msg + len16;
+
+  return len16;
+}
+
 static grub_err_t
 get_part_uuid (grub_device_t dev, char **part_uuid)
 {
@@ -91,28 +122,20 @@ get_part_uuid (grub_device_t dev, char **part_uuid)
   return status;
 }
 
+
 static grub_err_t
 set_efi_str_variable (const char *name, const grub_guid_t *guid,
                       const char *value)
 {
-  grub_size_t len, len16;
   grub_efi_char16_t *value_16;
+  grub_ssize_t len16;
   grub_err_t status;
 
-  len = grub_strlen (value);
+  len16 = grub_utf8_to_utf16_alloc (value, &value_16, NULL);
 
-  /* Check for integer overflow */
-  if (len > GRUB_SIZE_MAX / GRUB_MAX_UTF16_PER_UTF8 - 1)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("data too large"));
-
-  len16 = len * GRUB_MAX_UTF16_PER_UTF8;
-
-  value_16 = grub_calloc (len16 + 1, sizeof (value_16[0]));
-  if (value_16 == NULL)
+  if (len16 < 0)
     return grub_errno;
 
-  len16 = grub_utf8_to_utf16 (value_16, len16, (grub_uint8_t *) value, len, NULL);
-
   status = grub_efi_set_variable_with_attributes (name, guid,
 			(void *) value_16, (len16 + 1) * sizeof (value_16[0]),
 			GRUB_EFI_VARIABLE_BOOTSERVICE_ACCESS
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 10/10] util/grub.d: Activate bli module on EFI
  2023-03-02 18:20 [PATCH v3 00/10] Add basic Boot Loader Interface support Oliver Steffen
                   ` (8 preceding siblings ...)
  2023-03-02 18:20 ` [PATCH v3 09/10] commands/bli: Extract uft8 to utf16 conversion Oliver Steffen
@ 2023-03-02 18:20 ` Oliver Steffen
  2023-03-08 15:18   ` Daniel Kiper
  9 siblings, 1 reply; 18+ messages in thread
From: Oliver Steffen @ 2023-03-02 18:20 UTC (permalink / raw)
  To: grub-devel
  Cc: Daniel Kiper, Gerd Hoffmann, Javier Martinez Canillas, Oliver Steffen

Add a new configuration drop-in file that loads the
boot-loader-interface (bli) module and runs the command in case we are
booting on the EFI platform.

Signed-off-by: Oliver Steffen <osteffen@redhat.com>
---
 util/grub.d/25_boot_loader_interface.in | 34 +++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 util/grub.d/25_boot_loader_interface.in

diff --git a/util/grub.d/25_boot_loader_interface.in b/util/grub.d/25_boot_loader_interface.in
new file mode 100644
index 000000000..50daf3a10
--- /dev/null
+++ b/util/grub.d/25_boot_loader_interface.in
@@ -0,0 +1,34 @@
+#!/usr/bin/sh
+set -e
+
+# grub-mkconfig helper script.
+# Copyright (C) 2020  Free Software Foundation, Inc.
+#
+# GRUB is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# GRUB is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
+
+prefix="/usr"
+exec_prefix="/usr"
+datarootdir="/usr/share"
+
+export TEXTDOMAIN=grub
+export TEXTDOMAINDIR="${datarootdir}/locale"
+
+. "$pkgdatadir/grub-mkconfig_lib"
+
+cat << EOF
+if [ "\$grub_platform" = "efi" ]; then
+  insmod bli
+  bli
+fi
+EOF
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 03/10] Unify GUID types
  2023-03-02 18:20 ` [PATCH v3 03/10] Unify GUID types Oliver Steffen
@ 2023-03-08 14:02   ` Daniel Kiper
  0 siblings, 0 replies; 18+ messages in thread
From: Daniel Kiper @ 2023-03-08 14:02 UTC (permalink / raw)
  To: Oliver Steffen; +Cc: grub-devel, Gerd Hoffmann, Javier Martinez Canillas

On Thu, Mar 02, 2023 at 07:20:38PM +0100, Oliver Steffen wrote:
> There are 3 implementations of a GUID in Grub. Replace them with a
> common one, placed in types.h.
>
> It uses the "packed" flavor of the GUID structs, the alignment attribute
> is dropped, since it is not required.
>
> Signed-off-by: Oliver Steffen <osteffen@redhat.com>
> ---
>  grub-core/commands/acpi.c            |  4 +-
>  grub-core/commands/efi/efifwsetup.c  |  4 +-
>  grub-core/commands/efi/loadbios.c    | 14 +++---
>  grub-core/commands/efi/lsefi.c       |  4 +-
>  grub-core/commands/efi/lsefisystab.c |  4 +-
>  grub-core/commands/efi/lssal.c       |  4 +-
>  grub-core/commands/efi/smbios.c      | 12 +++---
>  grub-core/commands/efi/tpm.c         |  6 +--
>  grub-core/disk/efi/efidisk.c         |  4 +-
>  grub-core/efiemu/i386/pc/cfgtables.c |  6 +--
>  grub-core/efiemu/main.c              |  4 +-
>  grub-core/efiemu/runtime/efiemu.c    | 14 +++---
>  grub-core/kern/efi/acpi.c            | 12 +++---
>  grub-core/kern/efi/efi.c             | 22 +++++-----
>  grub-core/kern/efi/fdt.c             |  2 +-
>  grub-core/kern/efi/init.c            |  2 +-
>  grub-core/kern/efi/sb.c              |  4 +-
>  grub-core/loader/arm64/linux.c       |  4 +-
>  grub-core/loader/efi/fdt.c           |  2 +-
>  grub-core/loader/i386/xnu.c          |  4 +-
>  grub-core/loader/ia64/efi/linux.c    |  2 +-
>  grub-core/net/drivers/efi/efinet.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               | 64 ++++++++++------------------
>  include/grub/efi/efi.h               | 16 +++----
>  include/grub/efiemu/efiemu.h         | 10 ++---
>  include/grub/efiemu/runtime.h        |  2 +-
>  include/grub/types.h                 |  9 ++++
>  31 files changed, 122 insertions(+), 131 deletions(-)
>
> diff --git a/grub-core/commands/acpi.c b/grub-core/commands/acpi.c
> index fda62f4ea..4f8af86f2 100644
> --- a/grub-core/commands/acpi.c
> +++ b/grub-core/commands/acpi.c
> @@ -759,8 +759,8 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
>
>  #ifdef GRUB_MACHINE_EFI
>    {
> -    struct grub_efi_guid acpi = GRUB_EFI_ACPI_TABLE_GUID;
> -    struct grub_efi_guid acpi20 = GRUB_EFI_ACPI_20_TABLE_GUID;
> +    struct grub_guid acpi = GRUB_EFI_ACPI_TABLE_GUID;
> +    struct grub_guid acpi20 = GRUB_EFI_ACPI_20_TABLE_GUID;

I would be more consistent and use grub_guid_t instead of "struct grub_guid"
everywhere. Otherwise the patch LGTM...

Daniel


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 05/10] grub-core: Make use of guid printf format specifier
  2023-03-02 18:20 ` [PATCH v3 05/10] grub-core: Make use of guid printf format specifier Oliver Steffen
@ 2023-03-08 14:16   ` Daniel Kiper
  0 siblings, 0 replies; 18+ messages in thread
From: Daniel Kiper @ 2023-03-08 14:16 UTC (permalink / raw)
  To: Oliver Steffen; +Cc: grub-devel, Gerd Hoffmann, Javier Martinez Canillas

On Thu, Mar 02, 2023 at 07:20:40PM +0100, Oliver Steffen wrote:
> Use the new printf format specifier %pG.
>
> Fixes the text representation of GUIDs in the output of the lsefisystab
> command.
>
> Signed-off-by: Oliver Steffen <osteffen@redhat.com>

Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>

Daniel


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 06/10] Add a module for the Boot Loader Interface
  2023-03-02 18:20 ` [PATCH v3 06/10] Add a module for the Boot Loader Interface Oliver Steffen
@ 2023-03-08 15:01   ` Daniel Kiper
  0 siblings, 0 replies; 18+ messages in thread
From: Daniel Kiper @ 2023-03-08 15:01 UTC (permalink / raw)
  To: Oliver Steffen; +Cc: grub-devel, Gerd Hoffmann, Javier Martinez Canillas

On Thu, Mar 02, 2023 at 07:20:41PM +0100, Oliver Steffen wrote:
> Add a new module named boot_loader_interface, 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 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/
>
> Signed-off-by: Oliver Steffen <osteffen@redhat.com>
> ---
>  grub-core/Makefile.core.def |   6 ++
>  grub-core/commands/bli.c    | 199 ++++++++++++++++++++++++++++++++++++
>  include/grub/efi/api.h      |   5 +
>  3 files changed, 210 insertions(+)
>  create mode 100644 grub-core/commands/bli.c
>
> diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
> index 71093a100..cdfa2d101 100644
> --- a/grub-core/Makefile.core.def
> +++ b/grub-core/Makefile.core.def
> @@ -2548,3 +2548,9 @@ module = {
>    common = commands/i386/wrmsr.c;
>    enable = x86;
>  };
> +
> +module = {
> +  name = bli;
> +  efi = commands/bli.c;
> +  enable = efi;
> +};
> diff --git a/grub-core/commands/bli.c b/grub-core/commands/bli.c
> new file mode 100644
> index 000000000..0ff44d58a
> --- /dev/null
> +++ b/grub-core/commands/bli.c
> @@ -0,0 +1,199 @@
> +/*
> + *  GRUB  --  GRand Unified Bootloader
> + *  Copyright (C) 2023  Free Software Foundation, Inc.
> + *
> + *  GRUB is free software: you can redistribute it and/or modify
> + *  it under the terms of the GNU General Public License as published by
> + *  the Free Software Foundation, either version 3 of the License, or
> + *  (at your option) any later version.
> + *
> + *  GRUB is distributed in the hope that it will be useful,
> + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
> + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + *  GNU General Public License for more details.
> + *
> + *  You should have received a copy of the GNU General Public License
> + *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
> + *
> + *  Implementation of the Boot Loader Interface.
> + */
> +
> +#include <grub/charset.h>
> +#include <grub/efi/api.h>
> +#include <grub/efi/disk.h>
> +#include <grub/efi/efi.h>
> +#include <grub/err.h>
> +#include <grub/extcmd.h>
> +#include <grub/gpt_partition.h>
> +#include <grub/misc.h>
> +#include <grub/mm.h>
> +#include <grub/partition.h>
> +#include <grub/types.h>
> +
> +GRUB_MOD_LICENSE ("GPLv3+");
> +
> +#define MODNAME "bli"
> +
> +static const grub_guid_t bli_vendor_guid = GRUB_EFI_VENDOR_BOOT_LOADER_INTERFACE_GUID;
> +
> +static grub_err_t
> +get_part_uuid (grub_device_t dev, char **part_uuid)
> +{
> +  grub_err_t status = GRUB_ERR_NONE;
> +  grub_disk_t disk;
> +  struct grub_gpt_partentry entry;
> +
> +  if (dev == NULL || dev->disk == NULL || dev->disk->partition == NULL)
> +    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("invalid device"));
> +
> +  disk = grub_disk_open (dev->disk->name);
> +  if (disk == NULL)
> +    {
> +      status = grub_errno;
> +      char *part = grub_partition_get_name (dev->disk->partition);

I would define "char *part = NULL;" at the beginning of the get_part_uuid()
function and move most of the grub_free() calls behind "fail" label.

> +      grub_dprintf (MODNAME, "error opening disk: %s%s%s\n", dev->disk->name,
> +		    dev->disk->partition != NULL ? "," : "",
> +		    part != NULL ? part : "UNKNOWN");
> +      grub_free (part);

Except this one...

> +      return status;
> +    }
> +
> +  if (grub_strcmp (dev->disk->partition->partmap->name, "gpt") != 0)
> +    {
> +      char *part = grub_partition_get_name (dev->disk->partition);
> +      status = grub_error (GRUB_ERR_BAD_PART_TABLE,
> +		           "this is not a GPT partition table: %s%s%s", dev->disk->name,

N_("this is not a GPT partition table: %s%s%s")

> +			   dev->disk->partition != NULL ? "," : "",
> +			   part != NULL ? part : "UNKNOWN");
> +      grub_free (part);
> +      goto fail;
> +    }
> +
> +  if (grub_disk_read (disk, dev->disk->partition->offset,
> +		      dev->disk->partition->index, sizeof (entry), &entry) != GRUB_ERR_NONE)
> +    {
> +      status = grub_errno;
> +      char *part = grub_partition_get_name (dev->disk->partition);
> +      grub_dprintf (MODNAME, "read error: %s%s%s\n", dev->disk->name,

Why do not you use grub_error() here? In general I think we should use
grub_error() instead of grub_dprintf() for printing errors in this function.

> +		    dev->disk->partition != NULL ? "," : "",
> +		    part != NULL ? part : "UNKNOWN");
> +      grub_free (part);
> +      goto fail;
> +    }
> +
> +  *part_uuid = grub_xasprintf ("%pG", &entry.guid);
> +  if (*part_uuid == NULL)
> +    status = grub_errno;
> +
> + fail:
> +  grub_disk_close (disk);
> +
> +  return status;
> +}
> +
> +static grub_err_t
> +set_efi_str_variable (const char *name, const grub_guid_t *guid,
> +                      const char *value)
> +{
> +  grub_size_t len, len16;
> +  grub_efi_char16_t *value_16;
> +  grub_err_t status;
> +
> +  len = grub_strlen (value);
> +
> +  /* Check for integer overflow */
> +  if (len > GRUB_SIZE_MAX / GRUB_MAX_UTF16_PER_UTF8 - 1)
> +    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("data too large"));
> +
> +  len16 = len * GRUB_MAX_UTF16_PER_UTF8;
> +
> +  value_16 = grub_calloc (len16 + 1, sizeof (value_16[0]));
> +  if (value_16 == NULL)
> +    return grub_errno;
> +
> +  len16 = grub_utf8_to_utf16 (value_16, len16, (grub_uint8_t *) value, len, NULL);
> +
> +  status = grub_efi_set_variable_with_attributes (name, guid,
> +			(void *) value_16, (len16 + 1) * sizeof (value_16[0]),
> +			GRUB_EFI_VARIABLE_BOOTSERVICE_ACCESS
> +			| GRUB_EFI_VARIABLE_RUNTIME_ACCESS);

                        GRUB_EFI_VARIABLE_BOOTSERVICE_ACCESS | GRUB_EFI_VARIABLE_RUNTIME_ACCESS);

I cannot see any reason to wrap this line.

> +  if (status != GRUB_ERR_NONE)
> +    grub_dprintf (MODNAME, "Error setting EFI variable %s: %d\n", name, status);
> +
> +  grub_free (value_16);
> +
> +  return status;
> +}
> +
> +static grub_err_t
> +set_loader_device_part_uuid (void)
> +{
> +  grub_efi_loaded_image_t *image;
> +  char *device_name;
> +  grub_err_t status = GRUB_ERR_NONE;
> +  grub_device_t device;
> +  char *part_uuid = NULL;
> +
> +  image = grub_efi_get_loaded_image (grub_efi_image_handle);
> +  if (image == NULL)
> +    return grub_error (GRUB_ERR_BAD_DEVICE, N_("unable to find boot device"));
> +
> +  device_name = grub_efidisk_get_device_name (image->device_handle);
> +  if (device_name == NULL)
> +    return grub_error (GRUB_ERR_BAD_DEVICE, N_("unable to find boot device"));
> +
> +  device = grub_device_open (device_name);
> +  if (device == NULL)
> +    {
> +      status = grub_errno;
> +      grub_dprintf (MODNAME, "Error opening device: %s", device_name);

Again, why do not use grub_error() here?

> +      goto fail;
> +    }
> +
> +  status = get_part_uuid (device, &part_uuid);
> +
> +  grub_device_close (device);
> +
> +  if (status == GRUB_ERR_NONE)
> +    status = set_efi_str_variable ("LoaderDevicePartUUID",
> +				   &bli_vendor_guid,
> +				   part_uuid);

set_efi_str_variable ("LoaderDevicePartUUID", &bli_vendor_guid, part_uuid);

You do not need to wrap this line here.

> +
> + fail:
> +  grub_free (part_uuid);
> +  grub_free (device_name);
> +  return status;
> +}
> +
> +static grub_err_t
> +grub_cmd_bli (grub_extcmd_context_t ctxt __attribute__ ((unused)),
> +	      int argc __attribute__ ((unused)),
> +	      char **args __attribute__ ((unused)))
> +{
> +  grub_err_t status;
> +
> +  status = set_efi_str_variable ("LoaderInfo", &bli_vendor_guid, PACKAGE_STRING);
> +  if (status != GRUB_ERR_NONE)
> +    return status;
> +
> +  status = set_loader_device_part_uuid ();
> +  if (status != GRUB_ERR_NONE)
> +    return status;
> +
> +  return GRUB_ERR_NONE;
> +}
> +
> +static grub_extcmd_t cmd;
> +
> +GRUB_MOD_INIT (bli)
> +{
> +  grub_dprintf (MODNAME, "%s got here\n", __func__);
> +  cmd = grub_register_extcmd ("bli", grub_cmd_bli, 0, NULL,
> +			      N_("Set EFI variables according to Boot Loader Interface spec."), NULL);

Please add a section about this command to the docs/grub.texi. I think
it would be nice to add links to the specs there too.

Daniel


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 07/10] grub-core/kern/efi: Remove redundant null-termination
  2023-03-02 18:20 ` [PATCH v3 07/10] grub-core/kern/efi: Remove redundant null-termination Oliver Steffen
@ 2023-03-08 15:04   ` Daniel Kiper
  0 siblings, 0 replies; 18+ messages in thread
From: Daniel Kiper @ 2023-03-08 15:04 UTC (permalink / raw)
  To: Oliver Steffen; +Cc: grub-devel, Gerd Hoffmann, Javier Martinez Canillas

On Thu, Mar 02, 2023 at 07:20:42PM +0100, Oliver Steffen wrote:
> grub_calloc already initializes the buffer with \0, no

Nit, s/grub_calloc/grub_calloc()/...

> need to set the null-terminator at the end.

s/null-terminator/NUL-terminator/

>
> Signed-off-by: Oliver Steffen <osteffen@redhat.com>

Otherwise Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>...

Daniel


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 08/10] types.h: Add GRUB_SSIZE_MAX
  2023-03-02 18:20 ` [PATCH v3 08/10] types.h: Add GRUB_SSIZE_MAX Oliver Steffen
@ 2023-03-08 15:06   ` Daniel Kiper
  0 siblings, 0 replies; 18+ messages in thread
From: Daniel Kiper @ 2023-03-08 15:06 UTC (permalink / raw)
  To: Oliver Steffen; +Cc: grub-devel, Gerd Hoffmann, Javier Martinez Canillas

On Thu, Mar 02, 2023 at 07:20:43PM +0100, Oliver Steffen wrote:
> In the same way as GRUB_SIZE_MAX, add GRUB_SSIZE_MAX.
>
> Signed-off-by: Oliver Steffen <osteffen@redhat.com>

Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>

Daniel


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 09/10] commands/bli: Extract uft8 to utf16 conversion
  2023-03-02 18:20 ` [PATCH v3 09/10] commands/bli: Extract uft8 to utf16 conversion Oliver Steffen
@ 2023-03-08 15:13   ` Daniel Kiper
  0 siblings, 0 replies; 18+ messages in thread
From: Daniel Kiper @ 2023-03-08 15:13 UTC (permalink / raw)
  To: Oliver Steffen; +Cc: grub-devel, Gerd Hoffmann, Javier Martinez Canillas

On Thu, Mar 02, 2023 at 07:20:44PM +0100, Oliver Steffen wrote:
> Create a new function for utf-8 to utf-16 conversion called
> `grub_utf8_to_utf16_alloc` in the bli module.  It is modeled after the

s/`grub_utf8_to_utf16_alloc`/grub_utf8_to_utf16_alloc()/

> `grub_utf8_to_ucs4_alloc` like functions in charset.h.  The goal is to

s/`grub_utf8_to_ucs4_alloc`/grub_utf8_to_ucs4_alloc()/

> move this to a central place so that it can help reduce code
> duplication.
>
> Please comment: Where should this go?

I would put it in grub-core/normal/charset.c. If not then grub-core/kern/misc.c.

Daniel


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 10/10] util/grub.d: Activate bli module on EFI
  2023-03-02 18:20 ` [PATCH v3 10/10] util/grub.d: Activate bli module on EFI Oliver Steffen
@ 2023-03-08 15:18   ` Daniel Kiper
  0 siblings, 0 replies; 18+ messages in thread
From: Daniel Kiper @ 2023-03-08 15:18 UTC (permalink / raw)
  To: Oliver Steffen; +Cc: grub-devel, Gerd Hoffmann, Javier Martinez Canillas

On Thu, Mar 02, 2023 at 07:20:45PM +0100, Oliver Steffen wrote:
> Add a new configuration drop-in file that loads the
> boot-loader-interface (bli) module and runs the command in case we are
> booting on the EFI platform.
>
> Signed-off-by: Oliver Steffen <osteffen@redhat.com>
> ---
>  util/grub.d/25_boot_loader_interface.in | 34 +++++++++++++++++++++++++
>  1 file changed, 34 insertions(+)
>  create mode 100644 util/grub.d/25_boot_loader_interface.in
>
> diff --git a/util/grub.d/25_boot_loader_interface.in b/util/grub.d/25_boot_loader_interface.in
> new file mode 100644
> index 000000000..50daf3a10
> --- /dev/null
> +++ b/util/grub.d/25_boot_loader_interface.in
> @@ -0,0 +1,34 @@
> +#!/usr/bin/sh
> +set -e
> +
> +# grub-mkconfig helper script.
> +# Copyright (C) 2020  Free Software Foundation, Inc.

s/2020/2023/

> +#
> +# GRUB is free software: you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation, either version 3 of the License, or
> +# (at your option) any later version.
> +#
> +# GRUB is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
> +
> +prefix="/usr"
> +exec_prefix="/usr"
> +datarootdir="/usr/share"

This assumptions can be wrong. Please get relevant values from the configure...

Daniel


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2023-03-08 15:19 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-02 18:20 [PATCH v3 00/10] Add basic Boot Loader Interface support Oliver Steffen
2023-03-02 18:20 ` [PATCH v3 01/10] efi: Add grub_efi_set_variable_with_attributes Oliver Steffen
2023-03-02 18:20 ` [PATCH v3 02/10] efi: Check for integer overflow in string conversion Oliver Steffen
2023-03-02 18:20 ` [PATCH v3 03/10] Unify GUID types Oliver Steffen
2023-03-08 14:02   ` Daniel Kiper
2023-03-02 18:20 ` [PATCH v3 04/10] kern/misc: Add a format specifier GUIDs Oliver Steffen
2023-03-02 18:20 ` [PATCH v3 05/10] grub-core: Make use of guid printf format specifier Oliver Steffen
2023-03-08 14:16   ` Daniel Kiper
2023-03-02 18:20 ` [PATCH v3 06/10] Add a module for the Boot Loader Interface Oliver Steffen
2023-03-08 15:01   ` Daniel Kiper
2023-03-02 18:20 ` [PATCH v3 07/10] grub-core/kern/efi: Remove redundant null-termination Oliver Steffen
2023-03-08 15:04   ` Daniel Kiper
2023-03-02 18:20 ` [PATCH v3 08/10] types.h: Add GRUB_SSIZE_MAX Oliver Steffen
2023-03-08 15:06   ` Daniel Kiper
2023-03-02 18:20 ` [PATCH v3 09/10] commands/bli: Extract uft8 to utf16 conversion Oliver Steffen
2023-03-08 15:13   ` Daniel Kiper
2023-03-02 18:20 ` [PATCH v3 10/10] util/grub.d: Activate bli module on EFI Oliver Steffen
2023-03-08 15:18   ` Daniel Kiper

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.