[PATCH 1/1] efi_loader: run bootdev_hunt() to find ESP

Simon Glass sjg at chromium.org
Fri Nov 15 15:21:11 CET 2024


Hi Heinrich,

On Thu, 14 Nov 2024 at 14:08, Heinrich Schuchardt
<heinrich.schuchardt at canonical.com> wrote:
>
>
>
> Jonas Karlman <jonas at kwiboo.se> schrieb am Do., 14. Nov. 2024, 21:26:
>>
>> Hi Heinrich,
>>
>> On 2024-11-13 20:55, Heinrich Schuchardt wrote:
>> > Some hard devices need specific routines to scan for block devices,
>> > e.g. NVMe (nvme scan), SCSI (scsi start).
>> >
>> > Invoke bootdev_hunt() to find all block devices.
>> >
>> > Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
>> > ---
>> >  lib/efi_loader/efi_setup.c | 8 ++++++++
>> >  1 file changed, 8 insertions(+)
>> >
>> > diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c
>> > index aa59bc7779d..8e0ff16f3eb 100644
>> > --- a/lib/efi_loader/efi_setup.c
>> > +++ b/lib/efi_loader/efi_setup.c
>> > @@ -7,6 +7,7 @@
>> >
>> >  #define LOG_CATEGORY LOGC_EFI
>> >
>> > +#include <bootdev.h>
>> >  #include <efi_loader.h>
>> >  #include <efi_variable.h>
>> >  #include <log.h>
>> > @@ -228,6 +229,13 @@ efi_status_t efi_init_obj_list(void)
>> >        * Probe block devices to find the ESP.
>> >        * efi_disks_register() must be called before efi_init_variables().
>> >        */
>> > +     if (CONFIG_IS_ENABLED(BOOTSTD)) {
>> > +             int r;
>> > +
>> > +             r = bootdev_hunt(NULL, 0);
>> > +             if (r)
>> > +                     log_debug("No boot device available\n");
>> > +     }
>> >       ret = efi_disks_register();
>> >       if (ret != EFI_SUCCESS)
>> >               goto out;
>>
>> This is causing significant slower boot when trying to boot using
>> extlinux (or script) from mmc device on Rockchip, this will cause all
>> slow devices to be initialized before a quick mmc boot, e.g. pci init,
>> usb start and dhcp due to efi_mgr being the global bootmeth.
>
>
> Specifically DHCP is very slow and not needed here.
>
> Maybe Simon has an idea how to filter it out. We should filter on UCLASS_BLK related here.

Each bootdev has a prio field which indicates how slow it is, so you
could have something which only runs the hunters for a certain
priority. bootstd does this automatically (going from fastest to
slowest), but bootmgr would need to handle that itself.

Perhaps call bootdev_hunt_prio() with just a few priorities?

>
> Furthermore I don't know if global bootmeths are always have to run first or if you could customize this.

They run first, but we could change that.

Regards,
Simon
Regards,
Simon


More information about the U-Boot mailing list