bootstd: Provide a command to select the bootdev order

It is sometimes useful to select or override the default bootdev order.
Add a command for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2025-05-01 07:37:15 -06:00
parent 80471f8ac0
commit d93f42d6e3
7 changed files with 190 additions and 0 deletions

View File

@@ -13,6 +13,7 @@ Synopsis
bootdev list [-p] - list all available bootdevs (-p to probe)
bootdev hunt [-l|<spec>] - use hunt drivers to find bootdevs
bootdev order [clear] | [<spec> ...] - view or update bootdev order
bootdev select <bm> - select a bootdev by name
bootdev info [-p] - show information about a bootdev
@@ -78,6 +79,27 @@ To run hunters, specify the name of the hunter to run, e.g. "mmc". If no
name is provided, all hunters are run.
bootdev order
~~~~~~~~~~~~~
This allows the bootdev order to be examined or set. With no argument the
current ordering is shown, one item per line.
The argument can either be 'clear' or a space-separated list of labels. Each
label can be the name of a bootdev (e.g. "mmc1.bootdev"), a bootdev sequence
number ("3") or a media uclass ("mmc") with an optional sequence number (mmc2).
Use `bootdev order clear` to clear any ordering and use the default.
By default, the ordering is defined by the `boot_targets` environment variable
or, failing that, the bootstd node in the devicetree ("bootdev-order" property).
If no ordering is provided, then a default one is used.
Note that this command does not check that the ordering is valid. In fact the
meaning of the ordering depends on what the bootflow iterator discovers when it
is used. Invalid entries will result in no bootdevs being found for that entry,
so they are effectively skipped.
bootdev select
~~~~~~~~~~~~~~
@@ -171,6 +193,20 @@ This shows using one of the available hunters, then listing them::
Capacity: 0.0 MB = 0.0 GB (1 x 512)
=>
This shows viewing and changing the ordering::
=> bootdev order
mmc2
mmc1
=> bootdev order 'mmc usb'
=> bootdev order
mmc
usb
=> bootdev order clear
=> bootdev order
No ordering
=>
Return value
------------