[PATCH v2 16/17] boot: Run the EFI bootmgr just before network devices
Simon Glass
sjg at chromium.org
Wed Oct 1 23:26:41 CEST 2025
At present the EFI bootmgr scans all devices in the system before
deciding which one to boot. Ideally it would use the bootstd iterator
for this, but in the meantime, give it a lower priority, so it runs
just before the network devices.
Note that if there are no hunted network devices hunted, then it will
run at the end, after all bootdevs are exhausted. In other words, it
will always run.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
Changes in v2:
- Update commit message to indicate the bootmeth will always run
- Document how the priority was chosen
boot/bootmeth_efi_mgr.c | 9 +++++++++
test/boot/bootflow.c | 4 ++--
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/boot/bootmeth_efi_mgr.c b/boot/bootmeth_efi_mgr.c
index 42b8863815e..05fc35d01a9 100644
--- a/boot/bootmeth_efi_mgr.c
+++ b/boot/bootmeth_efi_mgr.c
@@ -99,6 +99,15 @@ static int bootmeth_efi_mgr_bind(struct udevice *dev)
plat->desc = "EFI bootmgr flow";
plat->flags = BOOTMETHF_GLOBAL;
+ /*
+ * bootmgr scans all available devices which can take a while,
+ * especially for network devices. So choose the priority so that it
+ * comes just before the 'very slow' devices. This allows systems which
+ * don't rely on bootmgr to boot quickly, while allowing bootmgr to run
+ * on systems which need it.
+ */
+ plat->glob_prio = BOOTDEVP_6_NET_BASE;
+
return 0;
}
diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c
index 1e98bb7d978..ea394c34ba9 100644
--- a/test/boot/bootflow.c
+++ b/test/boot/bootflow.c
@@ -455,11 +455,11 @@ static int bootflow_system(struct unit_test_state *uts)
ut_assertok(device_probe(dev));
sandbox_set_fake_efi_mgr_dev(dev, true);
- /* We should get a single 'bootmgr' method at the start */
+ /* We should get a single 'bootmgr' method at the end */
bootstd_clear_glob();
ut_assertok(run_command("bootflow scan -lH", 0));
ut_assert_skip_to_line(
- " 0 efi_mgr ready (none) 0 <NULL> ");
+ " 1 efi_mgr ready (none) 0 <NULL> ");
ut_assert_skip_to_line("No more bootdevs");
ut_assert_skip_to_line("(2 bootflows, 2 valid)");
ut_assert_console_end();
--
2.43.0
More information about the U-Boot
mailing list