[PATCH v3 3/3] Load option with short device path for boot vars

Raymond Mao raymond.mao at linaro.org
Tue May 16 16:26:14 CEST 2023


Hi Ilias,

On Tue, 16 May 2023 at 01:57, Ilias Apalodimas <ilias.apalodimas at linaro.org>
wrote:

> Hi Raymond,
>
> On Tue, May 02, 2023 at 12:12:21PM -0700, Raymond Mao wrote:
> > The boot variables automatically generated for removable medias
> > should be with short form of device path without device nodes.
> > This is a requirement for the case that a removable media is
> > plugged into a different port but is still able to work with the
> > existing boot variables.
> >
> > Signed-off-by: Raymond Mao <raymond.mao at linaro.org>
> > ---
> > Changes in v2
> > - Ignore EFI_NOT_FOUND returned from
> >   efi_bootmgr_update_media_device_boot_option which means no boot
> >   options scanned.
> > Changes in v3
> > - Split the patch into moving and renaming functions and
> >   individual patches for each changed functionality
> >
> >  cmd/bootmenu.c                    |  2 +-
> >  cmd/eficonfig.c                   |  2 +-
> >  include/efi_loader.h              |  2 +-
> >  lib/efi_loader/efi_bootmgr.c      | 16 +++++++++++++---
> >  lib/efi_loader/efi_disk.c         |  2 +-
> >  lib/efi_loader/efi_variable.c     |  2 +-
> >  lib/efi_loader/efi_variable_tee.c |  2 +-
> >  7 files changed, 19 insertions(+), 9 deletions(-)
>
> [...]
>
> >   * @count:           number of efi handle
> > + * @short_path:              use short form device path for matching
> >   * Return:           status code
> >   */
> >  static efi_status_t efi_bootmgr_enumerate_boot_option(struct
> eficonfig_media_boot_option *opt,
> >                                                     efi_handle_t
> *volume_handles,
> > -                                                   efi_status_t count)
> > +                                                   efi_status_t count,
> > +                                                   bool short_path)
>
> Are there cases where the normal device path is used? If not we can get rid
> of the bool option entirely
>
[RM] At the moment no. I can revise the patch to remove the bool option if
we don't want to reserve the ability to support normal device paths for the
future.

>
> >  {
> >       u32 i;
> >       struct efi_handler *handler;
> > @@ -387,6 +389,13 @@ static efi_status_t
> efi_bootmgr_enumerate_boot_option(struct eficonfig_media_boo
> >               p = dev_name;
> >               utf8_utf16_strncpy(&p, buf, strlen(buf));
> >
> > +             /* use short form device path */
> > +             if (short_path) {
> > +                     device_path = efi_dp_shorten(device_path);
> > +                     if (!device_path)
> > +                             continue;
> > +             }
> > +
> >               lo.label = dev_name;
> >               lo.attributes = LOAD_OPTION_ACTIVE;
> >               lo.file_path = device_path;
>
>  [...]
>
>  Thanks
>  /Ilias
>


More information about the U-Boot mailing list