Hi Heinrich,

On Tue, 5 Dec 2023 at 11:38, Heinrich Schuchardt
<heinrich.schucha...@canonical.com> wrote:
>
> * 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.schucha...@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);

UEFI specification v2.10 section '3.5 Boot Mechanisms' says
"EFI can boot from a device using the EFI_SIMPLE_FILE_SYSTEM_PROTOCOL or the
EFI_LOAD_FILE_PROTOCOL."

So in my understanding of the UEFI spec, I think
efi_simple_file_system_protocol_guid
is correct here.

>         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,

In EDK II reference implementation[0], it enumerates all
block_io_protocol devices
and eliminates logical partitions.
Should we do the same? If yes, I can prepare the patch on this.

[0] 
https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c#L2220

Regards,
Masahisa Kojima

>                                            NULL, &count,
>                                            (efi_handle_t **)&volume_handles);
>         if (ret != EFI_SUCCESS)
> --
> 2.40.1
>

Reply via email to