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 <sjg@chromium.org>
Reported-by: Da Xue <da@libre.computer>
This commit is contained in:
Simon Glass 2023-08-19 16:49:35 -06:00 committed by Tom Rini
parent d389efc448
commit 5986d46f8e
4 changed files with 13 additions and 5 deletions

View file

@ -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", .name = "bootmeth_extlinux",
.id = UCLASS_BOOTMETH, .id = UCLASS_BOOTMETH,
.of_match = extlinux_bootmeth_ids, .of_match = extlinux_bootmeth_ids,

View file

@ -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", .name = "bootmeth_script",
.id = UCLASS_BOOTMETH, .id = UCLASS_BOOTMETH,
.of_match = script_bootmeth_ids, .of_match = script_bootmeth_ids,

View file

@ -132,6 +132,9 @@ above bootdev scanning.
Controlling ordering 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: Several options are available to control the ordering of boot scanning:
@ -151,6 +154,10 @@ bootdevs and their sequence numbers.
bootmeths 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 This environment variable can be used to control the list of bootmeths used and
their ordering for example:: their ordering for example::
@ -164,7 +171,6 @@ controlled by aliases.
The :ref:`usage/cmd/bootmeth:bootmeth command` (`bootmeth order`) operates in The :ref:`usage/cmd/bootmeth:bootmeth command` (`bootmeth order`) operates in
the same way as setting this variable. the same way as setting this variable.
Bootdev uclass Bootdev uclass
-------------- --------------

View file

@ -27,7 +27,7 @@
DECLARE_GLOBAL_DATA_PTR; 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) 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 */ /* Enable the script bootmeth too */
ut_assertok(uclass_first_device_err(UCLASS_BOOTSTD, &bootstd)); 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)); "bootmeth_script", 0, ofnode_null(), &dev));
/* Change the order to include mmc4 */ /* Change the order to include mmc4 */