[PATCH 1/1] efi_loader: run bootdev_hunt() to find ESP
Simon Glass
sjg at chromium.org
Thu Nov 14 19:55:11 CET 2024
Hi Heinrich,
On Thu, 14 Nov 2024 at 02:55, Heinrich Schuchardt
<heinrich.schuchardt at canonical.com> wrote:
>
>
>
> Simon Glass <sjg at chromium.org> schrieb am Do., 14. Nov. 2024, 04:54:
>>
>> Hi Heinrich,
>>
>> On Wed, 13 Nov 2024 at 12:55, Heinrich Schuchardt
>> <heinrich.schuchardt at canonical.com> 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;
>> > --
>> > 2.45.2
>> >
>>
>> Reviewed-by: Simon Glass <sjg at chromium.org>
>>
>> Can we do this later, e.g. when we need to boot? What specifically
>> needs to scan for block devices? Perhaps a better question is: when is
>> the ESP needed? It would be nice to have that info in the commit
>> message.
>
>
> The setup routine is only entered if running EFI code like efidebug, eficonfig, bothmeth_efi. So this change does not impact users booting via the legacy entry point of Linux
>
> The ESP holds file ubootefi.var. We need the contents of the file before reading or updating any EFI variable.
>
> We further need all block devices to be known in eficonfig, efidebug, bootmeth_efi.
>
OK got it.
>>
>> I wonder if we could/should delete efi_disks_register() now?
>
>
> Does bootdev_hunter probe all block devices? Or could there be any that are only bound but not probed?
>
> I do not see a BOOTDEV_HUNTER for host, pvblock, and blkmap. Is this an oversight?
Yes, or at least no one did it.
Regards,
SImon
More information about the U-Boot
mailing list