From 5986d46f8efb20532d494242fccb051267f92e1a Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 19 Aug 2023 16:49:35 -0600 Subject: [PATCH] bootstd: Adjust the default bootmeth order The existing distro scripts check extlinux and scripts before EFI. Adjust the default ordering to do the same, to avoid breaking existing flows. Add some documentation, mentioning that this order will likely change in future. Signed-off-by: Simon Glass Reported-by: Da Xue --- boot/bootmeth_extlinux.c | 3 ++- boot/bootmeth_script.c | 3 ++- doc/develop/bootstd.rst | 8 +++++++- test/boot/bootflow.c | 4 ++-- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/boot/bootmeth_extlinux.c b/boot/bootmeth_extlinux.c index 6b2b840038..aa2a4591eb 100644 --- a/boot/bootmeth_extlinux.c +++ b/boot/bootmeth_extlinux.c @@ -184,7 +184,8 @@ static const struct udevice_id extlinux_bootmeth_ids[] = { { } }; -U_BOOT_DRIVER(bootmeth_extlinux) = { +/* Put an number before 'extlinux' to provide a default ordering */ +U_BOOT_DRIVER(bootmeth_1extlinux) = { .name = "bootmeth_extlinux", .id = UCLASS_BOOTMETH, .of_match = extlinux_bootmeth_ids, diff --git a/boot/bootmeth_script.c b/boot/bootmeth_script.c index a4050c384d..58c57a2d4b 100644 --- a/boot/bootmeth_script.c +++ b/boot/bootmeth_script.c @@ -243,7 +243,8 @@ static const struct udevice_id script_bootmeth_ids[] = { { } }; -U_BOOT_DRIVER(bootmeth_script) = { +/* Put an number before 'script' to provide a default ordering */ +U_BOOT_DRIVER(bootmeth_2script) = { .name = "bootmeth_script", .id = UCLASS_BOOTMETH, .of_match = script_bootmeth_ids, diff --git a/doc/develop/bootstd.rst b/doc/develop/bootstd.rst index ec31365357..c47de273ab 100644 --- a/doc/develop/bootstd.rst +++ b/doc/develop/bootstd.rst @@ -132,6 +132,9 @@ above bootdev scanning. Controlling ordering -------------------- +By default, faster bootdevs (or those which are assumed to be faster) are used +first, since they are more likely to be able to boot the device quickly. + Several options are available to control the ordering of boot scanning: @@ -151,6 +154,10 @@ bootdevs and their sequence numbers. bootmeths ~~~~~~~~~ +By default bootmeths are checked in name order. Use `bootmeth list` to see the +ordering. Note that the `extlinux` and `script` bootmeth is first, to preserve the behaviour +used by the old distro scripts. + This environment variable can be used to control the list of bootmeths used and their ordering for example:: @@ -164,7 +171,6 @@ controlled by aliases. The :ref:`usage/cmd/bootmeth:bootmeth command` (`bootmeth order`) operates in the same way as setting this variable. - Bootdev uclass -------------- diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c index 8a4e090e9b..1c91a942e9 100644 --- a/test/boot/bootflow.c +++ b/test/boot/bootflow.c @@ -27,7 +27,7 @@ DECLARE_GLOBAL_DATA_PTR; -extern U_BOOT_DRIVER(bootmeth_script); +extern U_BOOT_DRIVER(bootmeth_2script); static int inject_response(struct unit_test_state *uts) { @@ -525,7 +525,7 @@ static int prep_mmc4_bootdev(struct unit_test_state *uts) /* Enable the script bootmeth too */ ut_assertok(uclass_first_device_err(UCLASS_BOOTSTD, &bootstd)); - ut_assertok(device_bind(bootstd, DM_DRIVER_REF(bootmeth_script), + ut_assertok(device_bind(bootstd, DM_DRIVER_REF(bootmeth_2script), "bootmeth_script", 0, ofnode_null(), &dev)); /* Change the order to include mmc4 */