[PATCH v5 4/7] efi_loader: support boot from URI device path

Ilias Apalodimas ilias.apalodimas at linaro.org
Fri Sep 29 14:42:58 CEST 2023


On Fri, 29 Sept 2023 at 14:35, Masahisa Kojima
<masahisa.kojima at linaro.org> wrote:
>
> Hi Ilias,
>
> On Fri, 29 Sept 2023 at 20:48, Ilias Apalodimas
> <ilias.apalodimas at linaro.org> wrote:
> >
> > Hi Kojima-san,
> >
> >
> > [...]
> >
> > > +
> > > +/**
> > > + * try_load_default_file() - try to load the default file
> > > + *
> > > + * Search the device having EFI_SIMPLE_FILE_SYSTEM_PROTOCOL,
> > > + * then try to load with the default boot file(e.g. EFI/BOOT/BOOTAA64.EFI).
> > > + *
> > > + * @dev                      pointer to the UCLASS_BLK or UCLASS_PARTITION udevice
> > > + * @image_handle:    pointer to handle for newly installed image
> > > + * Return:           status code
> > > + */
> > > +static efi_status_t try_load_default_file(struct udevice *dev,
> > > +                                       efi_handle_t *image_handle)
> > > +{
> > > +     efi_status_t ret;
> > > +     efi_handle_t handle;
> > > +     struct efi_handler *handler;
> > > +     struct efi_device_path *file_path;
> > > +     struct efi_device_path *device_path;
> > > +
> > > +     if (dev_tag_get_ptr(dev, DM_TAG_EFI, (void **)&handle)) {
> > > +             log_warning("DM_TAG_EFI not found\n");
> > > +             return EFI_INVALID_PARAMETER;
> > > +     }
> > > +
> > > +     ret = efi_search_protocol(handle,
> > > +                               &efi_simple_file_system_protocol_guid, &handler);
> > > +     if (ret != EFI_SUCCESS)
> > > +             return ret;
> > > +
> > > +     ret = EFI_CALL(bs->open_protocol(handle, &efi_guid_device_path,
> > > +                                      (void **)&device_path, efi_root, NULL,
> > > +                                      EFI_OPEN_PROTOCOL_GET_PROTOCOL));
> > > +     if (ret != EFI_SUCCESS)
> > > +             return ret;
> > > +
> > > +     file_path = expand_media_path(device_path);
> > > +     ret = EFI_CALL(efi_load_image(true, efi_root, file_path, NULL, 0,
> > > +                                   image_handle));
> > > +
> > > +     efi_free_pool(file_path);
> > > +
> > > +     return ret;
> > > +}
> >
> > We've discussed this on v4, but I am replying here, since you sent a v5 in
> > the meantime.
> > What I ideally wanted to do here is
> > - Add the boot option automatically once the disk gets mount (you've
> > already sent a patch for that)
> > - Since the boot option is automatically added we could instead of
> >   searching for BOOTAA64.EFI search for matches with a load option of
> >   '1234567'.
> > Is there some timing issue that I am missing which doesnt allow us to do
> > that ?
>
> Sorry, I probably misunderstood your design.
> What kind of boot option is automatically added when the disk is detected?
> Could you share your thoughts about the trigger to search for matches
> with a load option of '1234567'?

You've recently fixed the CI errors and reported this [0].  Once that
gets merged every time a new disk is added, it will be automatically
be scanned for BOOTXXX.efi files.  If we do find such files, they will
be added to the efi bootmgr list of available options.  We do mark
these with a '1234567' in the optional data.

Once that path gets merged, wouldn't it be simpler to just scan for
boot options with '1234567' in the load options on the mounted image,
instead of rescanning it for BOOTXXX.efi?

[0] https://lore.kernel.org/u-boot/20230927010436.1503621-1-masahisa.kojima@linaro.org/

Thanks
/Ilias
>
> Thanks,
> Masahisa Kojima
>
> >
> > [...]
> >
> > Cheers
> > /Ilias


More information about the U-Boot mailing list