[PATCH 1/1] efi_loader: boot options should relate to the ESP

Heinrich Schuchardt heinrich.schuchardt at canonical.com
Tue Dec 5 03:37:51 CET 2023


* Only generate removable media entries for EFI system partitions.
* Only offer EFI system partitions for boot options in the eficonfig
  command.

Fixes: c416f1c0bcab ("bootmenu: add removable media entries")
Fixes: 87d791423ac6 ("eficonfig: menu-driven addition of UEFI boot option")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
---
 cmd/eficonfig.c              | 6 ++++--
 lib/efi_loader/efi_bootmgr.c | 3 ++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/cmd/eficonfig.c b/cmd/eficonfig.c
index 34a59cb15d..c066b28b6b 100644
--- a/cmd/eficonfig.c
+++ b/cmd/eficonfig.c
@@ -626,8 +626,10 @@ static efi_status_t eficonfig_select_volume(struct eficonfig_select_file_info *f
 	efi_handle_t *volume_handles = NULL;
 	struct efi_simple_file_system_protocol *v;
 
-	ret = efi_locate_handle_buffer_int(BY_PROTOCOL, &efi_simple_file_system_protocol_guid,
-					   NULL, &count, (efi_handle_t **)&volume_handles);
+	/* Find all EFI system partitions */
+	ret = efi_locate_handle_buffer_int(BY_PROTOCOL,
+					   &efi_system_partition_guid,
+					   NULL, &count, &volume_handles);
 	if (ret != EFI_SUCCESS) {
 		eficonfig_print_msg("No block device found!");
 		return ret;
diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c
index 48153bd5ff..9e84391186 100644
--- a/lib/efi_loader/efi_bootmgr.c
+++ b/lib/efi_loader/efi_bootmgr.c
@@ -1047,8 +1047,9 @@ efi_status_t efi_bootmgr_update_media_device_boot_option(void)
 	efi_handle_t *volume_handles = NULL;
 	struct eficonfig_media_boot_option *opt = NULL;
 
+	/* Find all EFI system partitions */
 	ret = efi_locate_handle_buffer_int(BY_PROTOCOL,
-					   &efi_simple_file_system_protocol_guid,
+					   &efi_system_partition_guid,
 					   NULL, &count,
 					   (efi_handle_t **)&volume_handles);
 	if (ret != EFI_SUCCESS)
-- 
2.40.1



More information about the U-Boot mailing list