History log of /u-boot/cmd/bootflow.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 0afee262 11-Jan-2024 Heinrich Schuchardt <xypron.glpk@gmx.de>

cmd: bootflow: remove dead code in do_bootflow_cmdline()

Checking argc < 3 twice is redundant.

Addresses-Coverity-ID: 477198 Logically dead code
Fixes: 921f63e57238 ("bootflow: Allow setting a cmdline arg with no value")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 921f63e5 29-Nov-2023 Simon Glass <sjg@chromium.org>

bootflow: Allow setting a cmdline arg with no value

This is supposed to be supported by the 'bootflow cmd' command, at
least according to the help. There is a 'bootflow cmd clear' but it is
often more intuitive to use 'bootcmd cmd set' with an empty value.

Update the command to pass BOOTFLOWCL_EMPTY in this case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a4bee0b4 01-Oct-2023 Simon Glass <sjg@chromium.org>

bootstd: Add a menu option to bootflow scan

Allow showing a menu and automatically booting, with 'bootflow scan'.
This is more convenient than using a script.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3fa53b95 01-Oct-2023 Simon Glass <sjg@chromium.org>

bootstd: Add a return code to bootflow menu

Return an error when the user does not select an OS, so we know whether
to boot or not.

Move calling of bootflow_menu_run() into a separate function so we can
call it from other places.

Expand the test to cover these cases.

Add some documentation also, while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3616218b 07-Oct-2023 Tom Rini <trini@konsulko.com>

cmd: Convert existing long help messages to the new macro

- Generally we just drop the #ifdef CONFIG_SYS_LONGHELP and endif lines
and use U_BOOT_LONGHELP to declare the same variable name as before
- In a few places, either rename the variable to follow convention or
introduce the variable as it was being done inline before.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c3867e2e 24-Aug-2023 Simon Glass <sjg@chromium.org>

bootflow: Show an empty filename when there is none

At present 'bootflow list' shows <NULL> for the filename when it is not
present. Show an empty string instead, since that is more user-friendly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c279224e 10-Aug-2023 Simon Glass <sjg@chromium.org>

bootstd: Add a command to read all files for a bootflow

Some bootflows (such as EFI and ChromiumOS) delay reading the kernel until
it is needed to boot. This saves time when scanning and avoids needing to
allocate memory for something that may never be used.

To permit reading of these files, add a new 'bootflow read' command.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbb607d2 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow display of the x86 setup information

Provide an option to dump this information if available.

Move the funciion prototype to the common x86 header. Allow the command
line to be left out since 'bootflow info' show this itself and it is
not in the correct place in memory until the kernel is actually booted.

Fix a badly aligned heading while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 33ebcb46 12-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Support automatically setting Linux parameters

Some Linux parameters can be set automatically by U-Boot, if it knows the
device being used. For example, since U-Boot knows the serial console
being used, it can add parameters for earlycon and console.

Add support for this.

Note that this is an experimental feature and we will see how useful it
turns out to be. It is very handy for ChromeOS, since otherwise it is very
difficult to manually determine the UART address or port number,
particularly in a script.

Provide an example of how this is used with ChromeOS.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 82c0938f 12-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Add support for updating elements of the cmdline

Add a bootflow command to update the command line more easily. This allows
changing a particular parameter rather than editing a very long strings.
It is also easier to handle with scripting.

The new 'bootflow cmdline' command allows getting and setting single
parameters.

Fix up the example output while we are here, since there are a few new
items.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 43b6fa9c 12-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow storing x86 setup information

On x86 boards Linux uses a block of binary data to provide information
about the command line, memory map, etc. Provide a way to store this in
the bootflow so it can be passed on to the OS.

No attempt is made to generalise the code, since other archs don't need
this information. The field is present always, though, to avoid needing
accessors or #ifdefs when building code on other archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d42243fe 12-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Use the bootargs env var for changing the cmdline

The "bootargs" environment variable is used to set the command-line
arguments to pass to the OS. Use this same mechanism with bootstd as well.
When the variable is updated, it is written to the current bootflow. When
the current bootflow is updated, the environment variable is updated too.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# f4a91655 12-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow storing the OS command line in the bootflow

Some operating systems have a command line which can be adjusted before
booting. Store this in the bootflow so it can be controlled within
U-Boot.

Fix up the example output while we are here, since there are a few new
items.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c8894348 10-May-2023 Simon Glass <sjg@chromium.org>

bootstd: Tidy up reporting of errors

In a few cases the error handling is not quite right. Make sure we
return the actual error in distro_efi_read_bootflow_file() rather than
-EINVAL. Return -IO when a file cannot be read. Also show the error name
if available.

This does not change operation, but does make it easier to diagnose
problems.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d8d40bc3 06-May-2023 Simon Glass <sjg@chromium.org>

bootstd: Correct default boot command

The patch to relax flag requirements was not accepted[1], so we still have
to have separate bootcommands depending on CMD_BOOTFLOW_FULL.

The previous attempt at this did not work, since it used the wrong name
for the options.

Fix this and change the message to mention BOOTSTD_FULL since this affects
not just the flags, but all functionality, so is more likely what the user
wants.

Drop the useless condition on CMD_BOOTFLOW_FULL while we are here.

[1] https://patchwork.ozlabs.org/project/uboot/patch/20230329071655.1959513-2-sjg@chromium.org/

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: a91492b6e9c ("bootstd: Provide a default command")

# e0dda26c 06-Apr-2023 Tom Rini <trini@konsulko.com>

bootflow: Rework do_bootflow_menu() slightly

When building this with clang, we get a warning such as:
cmd/bootflow.c:412:27: warning: variable 'bflow' is uninitialized when used here [-Wuninitialized]
printf("Selected: %s\n", bflow->os_name ? bflow->os_name : bflow->name);
^~~~~

And a suggestion to just initialize bflow to NULL. This would however
would be ensuring a bad dereference. Instead, looking at the function we
rework things so that when CONFIG_EXPO is not enabled (and so, no UI) we
error early and would never reach this point in the code. Simplify the
rest slightly as well while at this.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f9fb57c6 23-Apr-2023 Simon Glass <sjg@chromium.org>

bootstd: Show a message sometimes if no bootflows are found

Enable some messages that might provide hints, but only for
CMD_BOOTFLOW_FULL since otherwise the -l flag is not available.

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Tom Rini <trini@konsulko.com>

# 4f806f31 22-Feb-2023 Simon Glass <sjg@chromium.org>

bootflow: Rename bootflow_flags_t

These flags actually relate to the iterator, not the bootflow struct
itself. Rename them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0041b1c0 28-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow enabling BOOTSTD_FULL without needing EXPO

It is sometimes useful to have one without the other, e.g. on a device
without a display, since at present the expo feature requires CONFIG_VIDEO
to be enabled.

Update the Makefile and bootflow command to support this, as well as the
EXPO dependency.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4b7cb058 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Drop the old bootflow_scan_first()

This function is not used outside tests. Drop it and rename
bootflow_scan_dev() since it is how we start a scan now.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 91943ff7 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow scanning a single bootdev label

We want to support scanning a single label, like 'mmc' or 'usb0'. Add
this feature by plumbing the label through to the iterator, setting a
flag to indicate that only siblings of the initial device should be used.

This means that scanning a bootdev by its name is not supported anymore.
That feature doesn't seem very useful in practice, so it is no great loss.

Add a test for bootdev_find_by_any() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d73420e4 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Use hunters when scanning for bootflows

Add a flag to control whether hunters are used when scanning for
bootflows. Enable it by default and tidy up the flag comments a little.

Fow now this has no effect, until a future patch enables this feature.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d9f48579 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Treat DHCP and PXE as bootdev labels

These are associated with the ethernet boot device but do not match its
uclass name, so handle them as special cases.

Provide a way to pass flags through with the bootdev so that we know
how to process it. The flags are checked by the bootmeths, to ensure that
only the selected bootmeth is used.

While these both use the network device, they work quite differently. It
is common to run only one of these, or to run PXE before DHCP. Provide
bootflow flags to control which methods are used. Check these in the two
bootmeths so that only the chosen one is used.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7638c851 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Include the device tree in the bootflow

Some bootmeths provide a way to load a device tree as well as the base
OS image. Add a way to store this in the bootflow. Update the
'bootflow info' command to show this information.

Note that the device tree is not allocated, but instead is stored at
an address provided by an environment variable. This may need to be
adjusted at some point, but for now it works well and fits in with the
existing distro-boot scripts.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 02d929bf 06-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Support creating a boot menu

Create an expo to handle the boot menu. For now this is quite simple, with
just a header, some menu items and a pointer to show the current one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24d8e1b3 06-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow reading a logo for the OS

Some operating systems provide a logo in bmp format. Read this in if
present so it can be displayed in the menu.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2175e76a 06-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Read the Operating System name for distro/scripts

Add the concept of an OS name to the bootflow. This typically includes the
OS name, version and kernel version.

Implement this for the distro and script bootmeths so that it works with
Armbian and older version of Fedora.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2b80bc1e 30-Jul-2022 Simon Glass <sjg@chromium.org>

bootstd: Support bootflows with global bootmeths

Add support for handling this concept in bootflows. Update the 'bootflow'
command to allow only the normal bootmeths to be used. This alllows
skipping EFI bootmgr and VBE, for example.

Signed-off-by: Simon Glass <sjg@chromium.org>

# eccb25cd 30-Jul-2022 Simon Glass <sjg@chromium.org>

bootstd: Allow the bootdev to be optional in bootflows

With global bootmeths we want to scan without a bootdev. Update the logic
to allow this.

Change the bootflow command to show the bootdev only when valid.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2d653f68 24-Apr-2022 Simon Glass <sjg@chromium.org>

bootstd: Add a bootflow command

Add a 'bootflow' command to handle listing and selection of bootflow.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 921f63e5 29-Nov-2023 Simon Glass <sjg@chromium.org>

bootflow: Allow setting a cmdline arg with no value

This is supposed to be supported by the 'bootflow cmd' command, at
least according to the help. There is a 'bootflow cmd clear' but it is
often more intuitive to use 'bootcmd cmd set' with an empty value.

Update the command to pass BOOTFLOWCL_EMPTY in this case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a4bee0b4 01-Oct-2023 Simon Glass <sjg@chromium.org>

bootstd: Add a menu option to bootflow scan

Allow showing a menu and automatically booting, with 'bootflow scan'.
This is more convenient than using a script.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3fa53b95 01-Oct-2023 Simon Glass <sjg@chromium.org>

bootstd: Add a return code to bootflow menu

Return an error when the user does not select an OS, so we know whether
to boot or not.

Move calling of bootflow_menu_run() into a separate function so we can
call it from other places.

Expand the test to cover these cases.

Add some documentation also, while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3616218b 07-Oct-2023 Tom Rini <trini@konsulko.com>

cmd: Convert existing long help messages to the new macro

- Generally we just drop the #ifdef CONFIG_SYS_LONGHELP and endif lines
and use U_BOOT_LONGHELP to declare the same variable name as before
- In a few places, either rename the variable to follow convention or
introduce the variable as it was being done inline before.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c3867e2e 24-Aug-2023 Simon Glass <sjg@chromium.org>

bootflow: Show an empty filename when there is none

At present 'bootflow list' shows <NULL> for the filename when it is not
present. Show an empty string instead, since that is more user-friendly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c279224e 10-Aug-2023 Simon Glass <sjg@chromium.org>

bootstd: Add a command to read all files for a bootflow

Some bootflows (such as EFI and ChromiumOS) delay reading the kernel until
it is needed to boot. This saves time when scanning and avoids needing to
allocate memory for something that may never be used.

To permit reading of these files, add a new 'bootflow read' command.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbb607d2 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow display of the x86 setup information

Provide an option to dump this information if available.

Move the funciion prototype to the common x86 header. Allow the command
line to be left out since 'bootflow info' show this itself and it is
not in the correct place in memory until the kernel is actually booted.

Fix a badly aligned heading while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 33ebcb46 12-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Support automatically setting Linux parameters

Some Linux parameters can be set automatically by U-Boot, if it knows the
device being used. For example, since U-Boot knows the serial console
being used, it can add parameters for earlycon and console.

Add support for this.

Note that this is an experimental feature and we will see how useful it
turns out to be. It is very handy for ChromeOS, since otherwise it is very
difficult to manually determine the UART address or port number,
particularly in a script.

Provide an example of how this is used with ChromeOS.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 82c0938f 12-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Add support for updating elements of the cmdline

Add a bootflow command to update the command line more easily. This allows
changing a particular parameter rather than editing a very long strings.
It is also easier to handle with scripting.

The new 'bootflow cmdline' command allows getting and setting single
parameters.

Fix up the example output while we are here, since there are a few new
items.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 43b6fa9c 12-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow storing x86 setup information

On x86 boards Linux uses a block of binary data to provide information
about the command line, memory map, etc. Provide a way to store this in
the bootflow so it can be passed on to the OS.

No attempt is made to generalise the code, since other archs don't need
this information. The field is present always, though, to avoid needing
accessors or #ifdefs when building code on other archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d42243fe 12-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Use the bootargs env var for changing the cmdline

The "bootargs" environment variable is used to set the command-line
arguments to pass to the OS. Use this same mechanism with bootstd as well.
When the variable is updated, it is written to the current bootflow. When
the current bootflow is updated, the environment variable is updated too.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# f4a91655 12-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow storing the OS command line in the bootflow

Some operating systems have a command line which can be adjusted before
booting. Store this in the bootflow so it can be controlled within
U-Boot.

Fix up the example output while we are here, since there are a few new
items.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c8894348 10-May-2023 Simon Glass <sjg@chromium.org>

bootstd: Tidy up reporting of errors

In a few cases the error handling is not quite right. Make sure we
return the actual error in distro_efi_read_bootflow_file() rather than
-EINVAL. Return -IO when a file cannot be read. Also show the error name
if available.

This does not change operation, but does make it easier to diagnose
problems.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d8d40bc3 06-May-2023 Simon Glass <sjg@chromium.org>

bootstd: Correct default boot command

The patch to relax flag requirements was not accepted[1], so we still have
to have separate bootcommands depending on CMD_BOOTFLOW_FULL.

The previous attempt at this did not work, since it used the wrong name
for the options.

Fix this and change the message to mention BOOTSTD_FULL since this affects
not just the flags, but all functionality, so is more likely what the user
wants.

Drop the useless condition on CMD_BOOTFLOW_FULL while we are here.

[1] https://patchwork.ozlabs.org/project/uboot/patch/20230329071655.1959513-2-sjg@chromium.org/

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: a91492b6e9c ("bootstd: Provide a default command")

# e0dda26c 06-Apr-2023 Tom Rini <trini@konsulko.com>

bootflow: Rework do_bootflow_menu() slightly

When building this with clang, we get a warning such as:
cmd/bootflow.c:412:27: warning: variable 'bflow' is uninitialized when used here [-Wuninitialized]
printf("Selected: %s\n", bflow->os_name ? bflow->os_name : bflow->name);
^~~~~

And a suggestion to just initialize bflow to NULL. This would however
would be ensuring a bad dereference. Instead, looking at the function we
rework things so that when CONFIG_EXPO is not enabled (and so, no UI) we
error early and would never reach this point in the code. Simplify the
rest slightly as well while at this.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f9fb57c6 23-Apr-2023 Simon Glass <sjg@chromium.org>

bootstd: Show a message sometimes if no bootflows are found

Enable some messages that might provide hints, but only for
CMD_BOOTFLOW_FULL since otherwise the -l flag is not available.

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Tom Rini <trini@konsulko.com>

# 4f806f31 22-Feb-2023 Simon Glass <sjg@chromium.org>

bootflow: Rename bootflow_flags_t

These flags actually relate to the iterator, not the bootflow struct
itself. Rename them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0041b1c0 28-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow enabling BOOTSTD_FULL without needing EXPO

It is sometimes useful to have one without the other, e.g. on a device
without a display, since at present the expo feature requires CONFIG_VIDEO
to be enabled.

Update the Makefile and bootflow command to support this, as well as the
EXPO dependency.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4b7cb058 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Drop the old bootflow_scan_first()

This function is not used outside tests. Drop it and rename
bootflow_scan_dev() since it is how we start a scan now.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 91943ff7 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow scanning a single bootdev label

We want to support scanning a single label, like 'mmc' or 'usb0'. Add
this feature by plumbing the label through to the iterator, setting a
flag to indicate that only siblings of the initial device should be used.

This means that scanning a bootdev by its name is not supported anymore.
That feature doesn't seem very useful in practice, so it is no great loss.

Add a test for bootdev_find_by_any() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d73420e4 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Use hunters when scanning for bootflows

Add a flag to control whether hunters are used when scanning for
bootflows. Enable it by default and tidy up the flag comments a little.

Fow now this has no effect, until a future patch enables this feature.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d9f48579 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Treat DHCP and PXE as bootdev labels

These are associated with the ethernet boot device but do not match its
uclass name, so handle them as special cases.

Provide a way to pass flags through with the bootdev so that we know
how to process it. The flags are checked by the bootmeths, to ensure that
only the selected bootmeth is used.

While these both use the network device, they work quite differently. It
is common to run only one of these, or to run PXE before DHCP. Provide
bootflow flags to control which methods are used. Check these in the two
bootmeths so that only the chosen one is used.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7638c851 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Include the device tree in the bootflow

Some bootmeths provide a way to load a device tree as well as the base
OS image. Add a way to store this in the bootflow. Update the
'bootflow info' command to show this information.

Note that the device tree is not allocated, but instead is stored at
an address provided by an environment variable. This may need to be
adjusted at some point, but for now it works well and fits in with the
existing distro-boot scripts.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 02d929bf 06-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Support creating a boot menu

Create an expo to handle the boot menu. For now this is quite simple, with
just a header, some menu items and a pointer to show the current one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24d8e1b3 06-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow reading a logo for the OS

Some operating systems provide a logo in bmp format. Read this in if
present so it can be displayed in the menu.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2175e76a 06-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Read the Operating System name for distro/scripts

Add the concept of an OS name to the bootflow. This typically includes the
OS name, version and kernel version.

Implement this for the distro and script bootmeths so that it works with
Armbian and older version of Fedora.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2b80bc1e 30-Jul-2022 Simon Glass <sjg@chromium.org>

bootstd: Support bootflows with global bootmeths

Add support for handling this concept in bootflows. Update the 'bootflow'
command to allow only the normal bootmeths to be used. This alllows
skipping EFI bootmgr and VBE, for example.

Signed-off-by: Simon Glass <sjg@chromium.org>

# eccb25cd 30-Jul-2022 Simon Glass <sjg@chromium.org>

bootstd: Allow the bootdev to be optional in bootflows

With global bootmeths we want to scan without a bootdev. Update the logic
to allow this.

Change the bootflow command to show the bootdev only when valid.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2d653f68 24-Apr-2022 Simon Glass <sjg@chromium.org>

bootstd: Add a bootflow command

Add a 'bootflow' command to handle listing and selection of bootflow.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3fa53b95 01-Oct-2023 Simon Glass <sjg@chromium.org>

bootstd: Add a return code to bootflow menu

Return an error when the user does not select an OS, so we know whether
to boot or not.

Move calling of bootflow_menu_run() into a separate function so we can
call it from other places.

Expand the test to cover these cases.

Add some documentation also, while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3616218b 07-Oct-2023 Tom Rini <trini@konsulko.com>

cmd: Convert existing long help messages to the new macro

- Generally we just drop the #ifdef CONFIG_SYS_LONGHELP and endif lines
and use U_BOOT_LONGHELP to declare the same variable name as before
- In a few places, either rename the variable to follow convention or
introduce the variable as it was being done inline before.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c3867e2e 24-Aug-2023 Simon Glass <sjg@chromium.org>

bootflow: Show an empty filename when there is none

At present 'bootflow list' shows <NULL> for the filename when it is not
present. Show an empty string instead, since that is more user-friendly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c279224e 10-Aug-2023 Simon Glass <sjg@chromium.org>

bootstd: Add a command to read all files for a bootflow

Some bootflows (such as EFI and ChromiumOS) delay reading the kernel until
it is needed to boot. This saves time when scanning and avoids needing to
allocate memory for something that may never be used.

To permit reading of these files, add a new 'bootflow read' command.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbb607d2 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow display of the x86 setup information

Provide an option to dump this information if available.

Move the funciion prototype to the common x86 header. Allow the command
line to be left out since 'bootflow info' show this itself and it is
not in the correct place in memory until the kernel is actually booted.

Fix a badly aligned heading while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 33ebcb46 12-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Support automatically setting Linux parameters

Some Linux parameters can be set automatically by U-Boot, if it knows the
device being used. For example, since U-Boot knows the serial console
being used, it can add parameters for earlycon and console.

Add support for this.

Note that this is an experimental feature and we will see how useful it
turns out to be. It is very handy for ChromeOS, since otherwise it is very
difficult to manually determine the UART address or port number,
particularly in a script.

Provide an example of how this is used with ChromeOS.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 82c0938f 12-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Add support for updating elements of the cmdline

Add a bootflow command to update the command line more easily. This allows
changing a particular parameter rather than editing a very long strings.
It is also easier to handle with scripting.

The new 'bootflow cmdline' command allows getting and setting single
parameters.

Fix up the example output while we are here, since there are a few new
items.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 43b6fa9c 12-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow storing x86 setup information

On x86 boards Linux uses a block of binary data to provide information
about the command line, memory map, etc. Provide a way to store this in
the bootflow so it can be passed on to the OS.

No attempt is made to generalise the code, since other archs don't need
this information. The field is present always, though, to avoid needing
accessors or #ifdefs when building code on other archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d42243fe 12-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Use the bootargs env var for changing the cmdline

The "bootargs" environment variable is used to set the command-line
arguments to pass to the OS. Use this same mechanism with bootstd as well.
When the variable is updated, it is written to the current bootflow. When
the current bootflow is updated, the environment variable is updated too.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# f4a91655 12-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow storing the OS command line in the bootflow

Some operating systems have a command line which can be adjusted before
booting. Store this in the bootflow so it can be controlled within
U-Boot.

Fix up the example output while we are here, since there are a few new
items.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c8894348 10-May-2023 Simon Glass <sjg@chromium.org>

bootstd: Tidy up reporting of errors

In a few cases the error handling is not quite right. Make sure we
return the actual error in distro_efi_read_bootflow_file() rather than
-EINVAL. Return -IO when a file cannot be read. Also show the error name
if available.

This does not change operation, but does make it easier to diagnose
problems.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d8d40bc3 06-May-2023 Simon Glass <sjg@chromium.org>

bootstd: Correct default boot command

The patch to relax flag requirements was not accepted[1], so we still have
to have separate bootcommands depending on CMD_BOOTFLOW_FULL.

The previous attempt at this did not work, since it used the wrong name
for the options.

Fix this and change the message to mention BOOTSTD_FULL since this affects
not just the flags, but all functionality, so is more likely what the user
wants.

Drop the useless condition on CMD_BOOTFLOW_FULL while we are here.

[1] https://patchwork.ozlabs.org/project/uboot/patch/20230329071655.1959513-2-sjg@chromium.org/

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: a91492b6e9c ("bootstd: Provide a default command")

# e0dda26c 06-Apr-2023 Tom Rini <trini@konsulko.com>

bootflow: Rework do_bootflow_menu() slightly

When building this with clang, we get a warning such as:
cmd/bootflow.c:412:27: warning: variable 'bflow' is uninitialized when used here [-Wuninitialized]
printf("Selected: %s\n", bflow->os_name ? bflow->os_name : bflow->name);
^~~~~

And a suggestion to just initialize bflow to NULL. This would however
would be ensuring a bad dereference. Instead, looking at the function we
rework things so that when CONFIG_EXPO is not enabled (and so, no UI) we
error early and would never reach this point in the code. Simplify the
rest slightly as well while at this.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f9fb57c6 23-Apr-2023 Simon Glass <sjg@chromium.org>

bootstd: Show a message sometimes if no bootflows are found

Enable some messages that might provide hints, but only for
CMD_BOOTFLOW_FULL since otherwise the -l flag is not available.

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Tom Rini <trini@konsulko.com>

# 4f806f31 22-Feb-2023 Simon Glass <sjg@chromium.org>

bootflow: Rename bootflow_flags_t

These flags actually relate to the iterator, not the bootflow struct
itself. Rename them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0041b1c0 28-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow enabling BOOTSTD_FULL without needing EXPO

It is sometimes useful to have one without the other, e.g. on a device
without a display, since at present the expo feature requires CONFIG_VIDEO
to be enabled.

Update the Makefile and bootflow command to support this, as well as the
EXPO dependency.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4b7cb058 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Drop the old bootflow_scan_first()

This function is not used outside tests. Drop it and rename
bootflow_scan_dev() since it is how we start a scan now.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 91943ff7 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow scanning a single bootdev label

We want to support scanning a single label, like 'mmc' or 'usb0'. Add
this feature by plumbing the label through to the iterator, setting a
flag to indicate that only siblings of the initial device should be used.

This means that scanning a bootdev by its name is not supported anymore.
That feature doesn't seem very useful in practice, so it is no great loss.

Add a test for bootdev_find_by_any() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d73420e4 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Use hunters when scanning for bootflows

Add a flag to control whether hunters are used when scanning for
bootflows. Enable it by default and tidy up the flag comments a little.

Fow now this has no effect, until a future patch enables this feature.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d9f48579 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Treat DHCP and PXE as bootdev labels

These are associated with the ethernet boot device but do not match its
uclass name, so handle them as special cases.

Provide a way to pass flags through with the bootdev so that we know
how to process it. The flags are checked by the bootmeths, to ensure that
only the selected bootmeth is used.

While these both use the network device, they work quite differently. It
is common to run only one of these, or to run PXE before DHCP. Provide
bootflow flags to control which methods are used. Check these in the two
bootmeths so that only the chosen one is used.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7638c851 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Include the device tree in the bootflow

Some bootmeths provide a way to load a device tree as well as the base
OS image. Add a way to store this in the bootflow. Update the
'bootflow info' command to show this information.

Note that the device tree is not allocated, but instead is stored at
an address provided by an environment variable. This may need to be
adjusted at some point, but for now it works well and fits in with the
existing distro-boot scripts.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 02d929bf 06-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Support creating a boot menu

Create an expo to handle the boot menu. For now this is quite simple, with
just a header, some menu items and a pointer to show the current one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24d8e1b3 06-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow reading a logo for the OS

Some operating systems provide a logo in bmp format. Read this in if
present so it can be displayed in the menu.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2175e76a 06-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Read the Operating System name for distro/scripts

Add the concept of an OS name to the bootflow. This typically includes the
OS name, version and kernel version.

Implement this for the distro and script bootmeths so that it works with
Armbian and older version of Fedora.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2b80bc1e 30-Jul-2022 Simon Glass <sjg@chromium.org>

bootstd: Support bootflows with global bootmeths

Add support for handling this concept in bootflows. Update the 'bootflow'
command to allow only the normal bootmeths to be used. This alllows
skipping EFI bootmgr and VBE, for example.

Signed-off-by: Simon Glass <sjg@chromium.org>

# eccb25cd 30-Jul-2022 Simon Glass <sjg@chromium.org>

bootstd: Allow the bootdev to be optional in bootflows

With global bootmeths we want to scan without a bootdev. Update the logic
to allow this.

Change the bootflow command to show the bootdev only when valid.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2d653f68 24-Apr-2022 Simon Glass <sjg@chromium.org>

bootstd: Add a bootflow command

Add a 'bootflow' command to handle listing and selection of bootflow.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3616218b 07-Oct-2023 Tom Rini <trini@konsulko.com>

cmd: Convert existing long help messages to the new macro

- Generally we just drop the #ifdef CONFIG_SYS_LONGHELP and endif lines
and use U_BOOT_LONGHELP to declare the same variable name as before
- In a few places, either rename the variable to follow convention or
introduce the variable as it was being done inline before.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c3867e2e 24-Aug-2023 Simon Glass <sjg@chromium.org>

bootflow: Show an empty filename when there is none

At present 'bootflow list' shows <NULL> for the filename when it is not
present. Show an empty string instead, since that is more user-friendly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c279224e 10-Aug-2023 Simon Glass <sjg@chromium.org>

bootstd: Add a command to read all files for a bootflow

Some bootflows (such as EFI and ChromiumOS) delay reading the kernel until
it is needed to boot. This saves time when scanning and avoids needing to
allocate memory for something that may never be used.

To permit reading of these files, add a new 'bootflow read' command.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbb607d2 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow display of the x86 setup information

Provide an option to dump this information if available.

Move the funciion prototype to the common x86 header. Allow the command
line to be left out since 'bootflow info' show this itself and it is
not in the correct place in memory until the kernel is actually booted.

Fix a badly aligned heading while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 33ebcb46 12-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Support automatically setting Linux parameters

Some Linux parameters can be set automatically by U-Boot, if it knows the
device being used. For example, since U-Boot knows the serial console
being used, it can add parameters for earlycon and console.

Add support for this.

Note that this is an experimental feature and we will see how useful it
turns out to be. It is very handy for ChromeOS, since otherwise it is very
difficult to manually determine the UART address or port number,
particularly in a script.

Provide an example of how this is used with ChromeOS.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 82c0938f 12-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Add support for updating elements of the cmdline

Add a bootflow command to update the command line more easily. This allows
changing a particular parameter rather than editing a very long strings.
It is also easier to handle with scripting.

The new 'bootflow cmdline' command allows getting and setting single
parameters.

Fix up the example output while we are here, since there are a few new
items.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 43b6fa9c 12-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow storing x86 setup information

On x86 boards Linux uses a block of binary data to provide information
about the command line, memory map, etc. Provide a way to store this in
the bootflow so it can be passed on to the OS.

No attempt is made to generalise the code, since other archs don't need
this information. The field is present always, though, to avoid needing
accessors or #ifdefs when building code on other archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d42243fe 12-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Use the bootargs env var for changing the cmdline

The "bootargs" environment variable is used to set the command-line
arguments to pass to the OS. Use this same mechanism with bootstd as well.
When the variable is updated, it is written to the current bootflow. When
the current bootflow is updated, the environment variable is updated too.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# f4a91655 12-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow storing the OS command line in the bootflow

Some operating systems have a command line which can be adjusted before
booting. Store this in the bootflow so it can be controlled within
U-Boot.

Fix up the example output while we are here, since there are a few new
items.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c8894348 10-May-2023 Simon Glass <sjg@chromium.org>

bootstd: Tidy up reporting of errors

In a few cases the error handling is not quite right. Make sure we
return the actual error in distro_efi_read_bootflow_file() rather than
-EINVAL. Return -IO when a file cannot be read. Also show the error name
if available.

This does not change operation, but does make it easier to diagnose
problems.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d8d40bc3 06-May-2023 Simon Glass <sjg@chromium.org>

bootstd: Correct default boot command

The patch to relax flag requirements was not accepted[1], so we still have
to have separate bootcommands depending on CMD_BOOTFLOW_FULL.

The previous attempt at this did not work, since it used the wrong name
for the options.

Fix this and change the message to mention BOOTSTD_FULL since this affects
not just the flags, but all functionality, so is more likely what the user
wants.

Drop the useless condition on CMD_BOOTFLOW_FULL while we are here.

[1] https://patchwork.ozlabs.org/project/uboot/patch/20230329071655.1959513-2-sjg@chromium.org/

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: a91492b6e9c ("bootstd: Provide a default command")

# e0dda26c 06-Apr-2023 Tom Rini <trini@konsulko.com>

bootflow: Rework do_bootflow_menu() slightly

When building this with clang, we get a warning such as:
cmd/bootflow.c:412:27: warning: variable 'bflow' is uninitialized when used here [-Wuninitialized]
printf("Selected: %s\n", bflow->os_name ? bflow->os_name : bflow->name);
^~~~~

And a suggestion to just initialize bflow to NULL. This would however
would be ensuring a bad dereference. Instead, looking at the function we
rework things so that when CONFIG_EXPO is not enabled (and so, no UI) we
error early and would never reach this point in the code. Simplify the
rest slightly as well while at this.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f9fb57c6 23-Apr-2023 Simon Glass <sjg@chromium.org>

bootstd: Show a message sometimes if no bootflows are found

Enable some messages that might provide hints, but only for
CMD_BOOTFLOW_FULL since otherwise the -l flag is not available.

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Tom Rini <trini@konsulko.com>

# 4f806f31 22-Feb-2023 Simon Glass <sjg@chromium.org>

bootflow: Rename bootflow_flags_t

These flags actually relate to the iterator, not the bootflow struct
itself. Rename them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0041b1c0 28-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow enabling BOOTSTD_FULL without needing EXPO

It is sometimes useful to have one without the other, e.g. on a device
without a display, since at present the expo feature requires CONFIG_VIDEO
to be enabled.

Update the Makefile and bootflow command to support this, as well as the
EXPO dependency.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4b7cb058 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Drop the old bootflow_scan_first()

This function is not used outside tests. Drop it and rename
bootflow_scan_dev() since it is how we start a scan now.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 91943ff7 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow scanning a single bootdev label

We want to support scanning a single label, like 'mmc' or 'usb0'. Add
this feature by plumbing the label through to the iterator, setting a
flag to indicate that only siblings of the initial device should be used.

This means that scanning a bootdev by its name is not supported anymore.
That feature doesn't seem very useful in practice, so it is no great loss.

Add a test for bootdev_find_by_any() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d73420e4 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Use hunters when scanning for bootflows

Add a flag to control whether hunters are used when scanning for
bootflows. Enable it by default and tidy up the flag comments a little.

Fow now this has no effect, until a future patch enables this feature.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d9f48579 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Treat DHCP and PXE as bootdev labels

These are associated with the ethernet boot device but do not match its
uclass name, so handle them as special cases.

Provide a way to pass flags through with the bootdev so that we know
how to process it. The flags are checked by the bootmeths, to ensure that
only the selected bootmeth is used.

While these both use the network device, they work quite differently. It
is common to run only one of these, or to run PXE before DHCP. Provide
bootflow flags to control which methods are used. Check these in the two
bootmeths so that only the chosen one is used.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7638c851 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Include the device tree in the bootflow

Some bootmeths provide a way to load a device tree as well as the base
OS image. Add a way to store this in the bootflow. Update the
'bootflow info' command to show this information.

Note that the device tree is not allocated, but instead is stored at
an address provided by an environment variable. This may need to be
adjusted at some point, but for now it works well and fits in with the
existing distro-boot scripts.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 02d929bf 06-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Support creating a boot menu

Create an expo to handle the boot menu. For now this is quite simple, with
just a header, some menu items and a pointer to show the current one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24d8e1b3 06-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow reading a logo for the OS

Some operating systems provide a logo in bmp format. Read this in if
present so it can be displayed in the menu.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2175e76a 06-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Read the Operating System name for distro/scripts

Add the concept of an OS name to the bootflow. This typically includes the
OS name, version and kernel version.

Implement this for the distro and script bootmeths so that it works with
Armbian and older version of Fedora.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2b80bc1e 30-Jul-2022 Simon Glass <sjg@chromium.org>

bootstd: Support bootflows with global bootmeths

Add support for handling this concept in bootflows. Update the 'bootflow'
command to allow only the normal bootmeths to be used. This alllows
skipping EFI bootmgr and VBE, for example.

Signed-off-by: Simon Glass <sjg@chromium.org>

# eccb25cd 30-Jul-2022 Simon Glass <sjg@chromium.org>

bootstd: Allow the bootdev to be optional in bootflows

With global bootmeths we want to scan without a bootdev. Update the logic
to allow this.

Change the bootflow command to show the bootdev only when valid.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2d653f68 24-Apr-2022 Simon Glass <sjg@chromium.org>

bootstd: Add a bootflow command

Add a 'bootflow' command to handle listing and selection of bootflow.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c3867e2e 24-Aug-2023 Simon Glass <sjg@chromium.org>

bootflow: Show an empty filename when there is none

At present 'bootflow list' shows <NULL> for the filename when it is not
present. Show an empty string instead, since that is more user-friendly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c279224e 10-Aug-2023 Simon Glass <sjg@chromium.org>

bootstd: Add a command to read all files for a bootflow

Some bootflows (such as EFI and ChromiumOS) delay reading the kernel until
it is needed to boot. This saves time when scanning and avoids needing to
allocate memory for something that may never be used.

To permit reading of these files, add a new 'bootflow read' command.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbb607d2 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow display of the x86 setup information

Provide an option to dump this information if available.

Move the funciion prototype to the common x86 header. Allow the command
line to be left out since 'bootflow info' show this itself and it is
not in the correct place in memory until the kernel is actually booted.

Fix a badly aligned heading while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 33ebcb46 12-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Support automatically setting Linux parameters

Some Linux parameters can be set automatically by U-Boot, if it knows the
device being used. For example, since U-Boot knows the serial console
being used, it can add parameters for earlycon and console.

Add support for this.

Note that this is an experimental feature and we will see how useful it
turns out to be. It is very handy for ChromeOS, since otherwise it is very
difficult to manually determine the UART address or port number,
particularly in a script.

Provide an example of how this is used with ChromeOS.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 82c0938f 12-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Add support for updating elements of the cmdline

Add a bootflow command to update the command line more easily. This allows
changing a particular parameter rather than editing a very long strings.
It is also easier to handle with scripting.

The new 'bootflow cmdline' command allows getting and setting single
parameters.

Fix up the example output while we are here, since there are a few new
items.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 43b6fa9c 12-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow storing x86 setup information

On x86 boards Linux uses a block of binary data to provide information
about the command line, memory map, etc. Provide a way to store this in
the bootflow so it can be passed on to the OS.

No attempt is made to generalise the code, since other archs don't need
this information. The field is present always, though, to avoid needing
accessors or #ifdefs when building code on other archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d42243fe 12-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Use the bootargs env var for changing the cmdline

The "bootargs" environment variable is used to set the command-line
arguments to pass to the OS. Use this same mechanism with bootstd as well.
When the variable is updated, it is written to the current bootflow. When
the current bootflow is updated, the environment variable is updated too.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# f4a91655 12-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow storing the OS command line in the bootflow

Some operating systems have a command line which can be adjusted before
booting. Store this in the bootflow so it can be controlled within
U-Boot.

Fix up the example output while we are here, since there are a few new
items.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c8894348 10-May-2023 Simon Glass <sjg@chromium.org>

bootstd: Tidy up reporting of errors

In a few cases the error handling is not quite right. Make sure we
return the actual error in distro_efi_read_bootflow_file() rather than
-EINVAL. Return -IO when a file cannot be read. Also show the error name
if available.

This does not change operation, but does make it easier to diagnose
problems.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d8d40bc3 06-May-2023 Simon Glass <sjg@chromium.org>

bootstd: Correct default boot command

The patch to relax flag requirements was not accepted[1], so we still have
to have separate bootcommands depending on CMD_BOOTFLOW_FULL.

The previous attempt at this did not work, since it used the wrong name
for the options.

Fix this and change the message to mention BOOTSTD_FULL since this affects
not just the flags, but all functionality, so is more likely what the user
wants.

Drop the useless condition on CMD_BOOTFLOW_FULL while we are here.

[1] https://patchwork.ozlabs.org/project/uboot/patch/20230329071655.1959513-2-sjg@chromium.org/

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: a91492b6e9c ("bootstd: Provide a default command")

# e0dda26c 06-Apr-2023 Tom Rini <trini@konsulko.com>

bootflow: Rework do_bootflow_menu() slightly

When building this with clang, we get a warning such as:
cmd/bootflow.c:412:27: warning: variable 'bflow' is uninitialized when used here [-Wuninitialized]
printf("Selected: %s\n", bflow->os_name ? bflow->os_name : bflow->name);
^~~~~

And a suggestion to just initialize bflow to NULL. This would however
would be ensuring a bad dereference. Instead, looking at the function we
rework things so that when CONFIG_EXPO is not enabled (and so, no UI) we
error early and would never reach this point in the code. Simplify the
rest slightly as well while at this.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f9fb57c6 23-Apr-2023 Simon Glass <sjg@chromium.org>

bootstd: Show a message sometimes if no bootflows are found

Enable some messages that might provide hints, but only for
CMD_BOOTFLOW_FULL since otherwise the -l flag is not available.

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Tom Rini <trini@konsulko.com>

# 4f806f31 22-Feb-2023 Simon Glass <sjg@chromium.org>

bootflow: Rename bootflow_flags_t

These flags actually relate to the iterator, not the bootflow struct
itself. Rename them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0041b1c0 28-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow enabling BOOTSTD_FULL without needing EXPO

It is sometimes useful to have one without the other, e.g. on a device
without a display, since at present the expo feature requires CONFIG_VIDEO
to be enabled.

Update the Makefile and bootflow command to support this, as well as the
EXPO dependency.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4b7cb058 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Drop the old bootflow_scan_first()

This function is not used outside tests. Drop it and rename
bootflow_scan_dev() since it is how we start a scan now.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 91943ff7 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow scanning a single bootdev label

We want to support scanning a single label, like 'mmc' or 'usb0'. Add
this feature by plumbing the label through to the iterator, setting a
flag to indicate that only siblings of the initial device should be used.

This means that scanning a bootdev by its name is not supported anymore.
That feature doesn't seem very useful in practice, so it is no great loss.

Add a test for bootdev_find_by_any() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d73420e4 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Use hunters when scanning for bootflows

Add a flag to control whether hunters are used when scanning for
bootflows. Enable it by default and tidy up the flag comments a little.

Fow now this has no effect, until a future patch enables this feature.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d9f48579 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Treat DHCP and PXE as bootdev labels

These are associated with the ethernet boot device but do not match its
uclass name, so handle them as special cases.

Provide a way to pass flags through with the bootdev so that we know
how to process it. The flags are checked by the bootmeths, to ensure that
only the selected bootmeth is used.

While these both use the network device, they work quite differently. It
is common to run only one of these, or to run PXE before DHCP. Provide
bootflow flags to control which methods are used. Check these in the two
bootmeths so that only the chosen one is used.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7638c851 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Include the device tree in the bootflow

Some bootmeths provide a way to load a device tree as well as the base
OS image. Add a way to store this in the bootflow. Update the
'bootflow info' command to show this information.

Note that the device tree is not allocated, but instead is stored at
an address provided by an environment variable. This may need to be
adjusted at some point, but for now it works well and fits in with the
existing distro-boot scripts.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 02d929bf 06-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Support creating a boot menu

Create an expo to handle the boot menu. For now this is quite simple, with
just a header, some menu items and a pointer to show the current one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24d8e1b3 06-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow reading a logo for the OS

Some operating systems provide a logo in bmp format. Read this in if
present so it can be displayed in the menu.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2175e76a 06-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Read the Operating System name for distro/scripts

Add the concept of an OS name to the bootflow. This typically includes the
OS name, version and kernel version.

Implement this for the distro and script bootmeths so that it works with
Armbian and older version of Fedora.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2b80bc1e 30-Jul-2022 Simon Glass <sjg@chromium.org>

bootstd: Support bootflows with global bootmeths

Add support for handling this concept in bootflows. Update the 'bootflow'
command to allow only the normal bootmeths to be used. This alllows
skipping EFI bootmgr and VBE, for example.

Signed-off-by: Simon Glass <sjg@chromium.org>

# eccb25cd 30-Jul-2022 Simon Glass <sjg@chromium.org>

bootstd: Allow the bootdev to be optional in bootflows

With global bootmeths we want to scan without a bootdev. Update the logic
to allow this.

Change the bootflow command to show the bootdev only when valid.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2d653f68 24-Apr-2022 Simon Glass <sjg@chromium.org>

bootstd: Add a bootflow command

Add a 'bootflow' command to handle listing and selection of bootflow.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 33ebcb46 12-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Support automatically setting Linux parameters

Some Linux parameters can be set automatically by U-Boot, if it knows the
device being used. For example, since U-Boot knows the serial console
being used, it can add parameters for earlycon and console.

Add support for this.

Note that this is an experimental feature and we will see how useful it
turns out to be. It is very handy for ChromeOS, since otherwise it is very
difficult to manually determine the UART address or port number,
particularly in a script.

Provide an example of how this is used with ChromeOS.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 82c0938f 12-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Add support for updating elements of the cmdline

Add a bootflow command to update the command line more easily. This allows
changing a particular parameter rather than editing a very long strings.
It is also easier to handle with scripting.

The new 'bootflow cmdline' command allows getting and setting single
parameters.

Fix up the example output while we are here, since there are a few new
items.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 43b6fa9c 12-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow storing x86 setup information

On x86 boards Linux uses a block of binary data to provide information
about the command line, memory map, etc. Provide a way to store this in
the bootflow so it can be passed on to the OS.

No attempt is made to generalise the code, since other archs don't need
this information. The field is present always, though, to avoid needing
accessors or #ifdefs when building code on other archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d42243fe 12-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Use the bootargs env var for changing the cmdline

The "bootargs" environment variable is used to set the command-line
arguments to pass to the OS. Use this same mechanism with bootstd as well.
When the variable is updated, it is written to the current bootflow. When
the current bootflow is updated, the environment variable is updated too.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# f4a91655 12-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow storing the OS command line in the bootflow

Some operating systems have a command line which can be adjusted before
booting. Store this in the bootflow so it can be controlled within
U-Boot.

Fix up the example output while we are here, since there are a few new
items.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c8894348 10-May-2023 Simon Glass <sjg@chromium.org>

bootstd: Tidy up reporting of errors

In a few cases the error handling is not quite right. Make sure we
return the actual error in distro_efi_read_bootflow_file() rather than
-EINVAL. Return -IO when a file cannot be read. Also show the error name
if available.

This does not change operation, but does make it easier to diagnose
problems.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d8d40bc3 06-May-2023 Simon Glass <sjg@chromium.org>

bootstd: Correct default boot command

The patch to relax flag requirements was not accepted[1], so we still have
to have separate bootcommands depending on CMD_BOOTFLOW_FULL.

The previous attempt at this did not work, since it used the wrong name
for the options.

Fix this and change the message to mention BOOTSTD_FULL since this affects
not just the flags, but all functionality, so is more likely what the user
wants.

Drop the useless condition on CMD_BOOTFLOW_FULL while we are here.

[1] https://patchwork.ozlabs.org/project/uboot/patch/20230329071655.1959513-2-sjg@chromium.org/

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: a91492b6e9c ("bootstd: Provide a default command")

# e0dda26c 06-Apr-2023 Tom Rini <trini@konsulko.com>

bootflow: Rework do_bootflow_menu() slightly

When building this with clang, we get a warning such as:
cmd/bootflow.c:412:27: warning: variable 'bflow' is uninitialized when used here [-Wuninitialized]
printf("Selected: %s\n", bflow->os_name ? bflow->os_name : bflow->name);
^~~~~

And a suggestion to just initialize bflow to NULL. This would however
would be ensuring a bad dereference. Instead, looking at the function we
rework things so that when CONFIG_EXPO is not enabled (and so, no UI) we
error early and would never reach this point in the code. Simplify the
rest slightly as well while at this.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f9fb57c6 23-Apr-2023 Simon Glass <sjg@chromium.org>

bootstd: Show a message sometimes if no bootflows are found

Enable some messages that might provide hints, but only for
CMD_BOOTFLOW_FULL since otherwise the -l flag is not available.

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Tom Rini <trini@konsulko.com>

# 4f806f31 22-Feb-2023 Simon Glass <sjg@chromium.org>

bootflow: Rename bootflow_flags_t

These flags actually relate to the iterator, not the bootflow struct
itself. Rename them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0041b1c0 28-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow enabling BOOTSTD_FULL without needing EXPO

It is sometimes useful to have one without the other, e.g. on a device
without a display, since at present the expo feature requires CONFIG_VIDEO
to be enabled.

Update the Makefile and bootflow command to support this, as well as the
EXPO dependency.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4b7cb058 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Drop the old bootflow_scan_first()

This function is not used outside tests. Drop it and rename
bootflow_scan_dev() since it is how we start a scan now.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 91943ff7 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow scanning a single bootdev label

We want to support scanning a single label, like 'mmc' or 'usb0'. Add
this feature by plumbing the label through to the iterator, setting a
flag to indicate that only siblings of the initial device should be used.

This means that scanning a bootdev by its name is not supported anymore.
That feature doesn't seem very useful in practice, so it is no great loss.

Add a test for bootdev_find_by_any() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d73420e4 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Use hunters when scanning for bootflows

Add a flag to control whether hunters are used when scanning for
bootflows. Enable it by default and tidy up the flag comments a little.

Fow now this has no effect, until a future patch enables this feature.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d9f48579 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Treat DHCP and PXE as bootdev labels

These are associated with the ethernet boot device but do not match its
uclass name, so handle them as special cases.

Provide a way to pass flags through with the bootdev so that we know
how to process it. The flags are checked by the bootmeths, to ensure that
only the selected bootmeth is used.

While these both use the network device, they work quite differently. It
is common to run only one of these, or to run PXE before DHCP. Provide
bootflow flags to control which methods are used. Check these in the two
bootmeths so that only the chosen one is used.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7638c851 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Include the device tree in the bootflow

Some bootmeths provide a way to load a device tree as well as the base
OS image. Add a way to store this in the bootflow. Update the
'bootflow info' command to show this information.

Note that the device tree is not allocated, but instead is stored at
an address provided by an environment variable. This may need to be
adjusted at some point, but for now it works well and fits in with the
existing distro-boot scripts.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 02d929bf 06-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Support creating a boot menu

Create an expo to handle the boot menu. For now this is quite simple, with
just a header, some menu items and a pointer to show the current one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24d8e1b3 06-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow reading a logo for the OS

Some operating systems provide a logo in bmp format. Read this in if
present so it can be displayed in the menu.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2175e76a 06-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Read the Operating System name for distro/scripts

Add the concept of an OS name to the bootflow. This typically includes the
OS name, version and kernel version.

Implement this for the distro and script bootmeths so that it works with
Armbian and older version of Fedora.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2b80bc1e 30-Jul-2022 Simon Glass <sjg@chromium.org>

bootstd: Support bootflows with global bootmeths

Add support for handling this concept in bootflows. Update the 'bootflow'
command to allow only the normal bootmeths to be used. This alllows
skipping EFI bootmgr and VBE, for example.

Signed-off-by: Simon Glass <sjg@chromium.org>

# eccb25cd 30-Jul-2022 Simon Glass <sjg@chromium.org>

bootstd: Allow the bootdev to be optional in bootflows

With global bootmeths we want to scan without a bootdev. Update the logic
to allow this.

Change the bootflow command to show the bootdev only when valid.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2d653f68 24-Apr-2022 Simon Glass <sjg@chromium.org>

bootstd: Add a bootflow command

Add a 'bootflow' command to handle listing and selection of bootflow.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c8894348 10-May-2023 Simon Glass <sjg@chromium.org>

bootstd: Tidy up reporting of errors

In a few cases the error handling is not quite right. Make sure we
return the actual error in distro_efi_read_bootflow_file() rather than
-EINVAL. Return -IO when a file cannot be read. Also show the error name
if available.

This does not change operation, but does make it easier to diagnose
problems.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d8d40bc3 06-May-2023 Simon Glass <sjg@chromium.org>

bootstd: Correct default boot command

The patch to relax flag requirements was not accepted[1], so we still have
to have separate bootcommands depending on CMD_BOOTFLOW_FULL.

The previous attempt at this did not work, since it used the wrong name
for the options.

Fix this and change the message to mention BOOTSTD_FULL since this affects
not just the flags, but all functionality, so is more likely what the user
wants.

Drop the useless condition on CMD_BOOTFLOW_FULL while we are here.

[1] https://patchwork.ozlabs.org/project/uboot/patch/20230329071655.1959513-2-sjg@chromium.org/

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: a91492b6e9c ("bootstd: Provide a default command")

# e0dda26c 06-Apr-2023 Tom Rini <trini@konsulko.com>

bootflow: Rework do_bootflow_menu() slightly

When building this with clang, we get a warning such as:
cmd/bootflow.c:412:27: warning: variable 'bflow' is uninitialized when used here [-Wuninitialized]
printf("Selected: %s\n", bflow->os_name ? bflow->os_name : bflow->name);
^~~~~

And a suggestion to just initialize bflow to NULL. This would however
would be ensuring a bad dereference. Instead, looking at the function we
rework things so that when CONFIG_EXPO is not enabled (and so, no UI) we
error early and would never reach this point in the code. Simplify the
rest slightly as well while at this.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f9fb57c6 23-Apr-2023 Simon Glass <sjg@chromium.org>

bootstd: Show a message sometimes if no bootflows are found

Enable some messages that might provide hints, but only for
CMD_BOOTFLOW_FULL since otherwise the -l flag is not available.

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Tom Rini <trini@konsulko.com>

# 4f806f31 22-Feb-2023 Simon Glass <sjg@chromium.org>

bootflow: Rename bootflow_flags_t

These flags actually relate to the iterator, not the bootflow struct
itself. Rename them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0041b1c0 28-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow enabling BOOTSTD_FULL without needing EXPO

It is sometimes useful to have one without the other, e.g. on a device
without a display, since at present the expo feature requires CONFIG_VIDEO
to be enabled.

Update the Makefile and bootflow command to support this, as well as the
EXPO dependency.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4b7cb058 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Drop the old bootflow_scan_first()

This function is not used outside tests. Drop it and rename
bootflow_scan_dev() since it is how we start a scan now.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 91943ff7 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow scanning a single bootdev label

We want to support scanning a single label, like 'mmc' or 'usb0'. Add
this feature by plumbing the label through to the iterator, setting a
flag to indicate that only siblings of the initial device should be used.

This means that scanning a bootdev by its name is not supported anymore.
That feature doesn't seem very useful in practice, so it is no great loss.

Add a test for bootdev_find_by_any() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d73420e4 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Use hunters when scanning for bootflows

Add a flag to control whether hunters are used when scanning for
bootflows. Enable it by default and tidy up the flag comments a little.

Fow now this has no effect, until a future patch enables this feature.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d9f48579 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Treat DHCP and PXE as bootdev labels

These are associated with the ethernet boot device but do not match its
uclass name, so handle them as special cases.

Provide a way to pass flags through with the bootdev so that we know
how to process it. The flags are checked by the bootmeths, to ensure that
only the selected bootmeth is used.

While these both use the network device, they work quite differently. It
is common to run only one of these, or to run PXE before DHCP. Provide
bootflow flags to control which methods are used. Check these in the two
bootmeths so that only the chosen one is used.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7638c851 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Include the device tree in the bootflow

Some bootmeths provide a way to load a device tree as well as the base
OS image. Add a way to store this in the bootflow. Update the
'bootflow info' command to show this information.

Note that the device tree is not allocated, but instead is stored at
an address provided by an environment variable. This may need to be
adjusted at some point, but for now it works well and fits in with the
existing distro-boot scripts.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 02d929bf 06-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Support creating a boot menu

Create an expo to handle the boot menu. For now this is quite simple, with
just a header, some menu items and a pointer to show the current one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24d8e1b3 06-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow reading a logo for the OS

Some operating systems provide a logo in bmp format. Read this in if
present so it can be displayed in the menu.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2175e76a 06-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Read the Operating System name for distro/scripts

Add the concept of an OS name to the bootflow. This typically includes the
OS name, version and kernel version.

Implement this for the distro and script bootmeths so that it works with
Armbian and older version of Fedora.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2b80bc1e 30-Jul-2022 Simon Glass <sjg@chromium.org>

bootstd: Support bootflows with global bootmeths

Add support for handling this concept in bootflows. Update the 'bootflow'
command to allow only the normal bootmeths to be used. This alllows
skipping EFI bootmgr and VBE, for example.

Signed-off-by: Simon Glass <sjg@chromium.org>

# eccb25cd 30-Jul-2022 Simon Glass <sjg@chromium.org>

bootstd: Allow the bootdev to be optional in bootflows

With global bootmeths we want to scan without a bootdev. Update the logic
to allow this.

Change the bootflow command to show the bootdev only when valid.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2d653f68 24-Apr-2022 Simon Glass <sjg@chromium.org>

bootstd: Add a bootflow command

Add a 'bootflow' command to handle listing and selection of bootflow.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f9fb57c6 23-Apr-2023 Simon Glass <sjg@chromium.org>

bootstd: Show a message sometimes if no bootflows are found

Enable some messages that might provide hints, but only for
CMD_BOOTFLOW_FULL since otherwise the -l flag is not available.

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Tom Rini <trini@konsulko.com>

# 4f806f31 22-Feb-2023 Simon Glass <sjg@chromium.org>

bootflow: Rename bootflow_flags_t

These flags actually relate to the iterator, not the bootflow struct
itself. Rename them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0041b1c0 28-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow enabling BOOTSTD_FULL without needing EXPO

It is sometimes useful to have one without the other, e.g. on a device
without a display, since at present the expo feature requires CONFIG_VIDEO
to be enabled.

Update the Makefile and bootflow command to support this, as well as the
EXPO dependency.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4b7cb058 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Drop the old bootflow_scan_first()

This function is not used outside tests. Drop it and rename
bootflow_scan_dev() since it is how we start a scan now.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 91943ff7 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow scanning a single bootdev label

We want to support scanning a single label, like 'mmc' or 'usb0'. Add
this feature by plumbing the label through to the iterator, setting a
flag to indicate that only siblings of the initial device should be used.

This means that scanning a bootdev by its name is not supported anymore.
That feature doesn't seem very useful in practice, so it is no great loss.

Add a test for bootdev_find_by_any() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d73420e4 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Use hunters when scanning for bootflows

Add a flag to control whether hunters are used when scanning for
bootflows. Enable it by default and tidy up the flag comments a little.

Fow now this has no effect, until a future patch enables this feature.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d9f48579 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Treat DHCP and PXE as bootdev labels

These are associated with the ethernet boot device but do not match its
uclass name, so handle them as special cases.

Provide a way to pass flags through with the bootdev so that we know
how to process it. The flags are checked by the bootmeths, to ensure that
only the selected bootmeth is used.

While these both use the network device, they work quite differently. It
is common to run only one of these, or to run PXE before DHCP. Provide
bootflow flags to control which methods are used. Check these in the two
bootmeths so that only the chosen one is used.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7638c851 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Include the device tree in the bootflow

Some bootmeths provide a way to load a device tree as well as the base
OS image. Add a way to store this in the bootflow. Update the
'bootflow info' command to show this information.

Note that the device tree is not allocated, but instead is stored at
an address provided by an environment variable. This may need to be
adjusted at some point, but for now it works well and fits in with the
existing distro-boot scripts.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 02d929bf 06-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Support creating a boot menu

Create an expo to handle the boot menu. For now this is quite simple, with
just a header, some menu items and a pointer to show the current one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24d8e1b3 06-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow reading a logo for the OS

Some operating systems provide a logo in bmp format. Read this in if
present so it can be displayed in the menu.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2175e76a 06-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Read the Operating System name for distro/scripts

Add the concept of an OS name to the bootflow. This typically includes the
OS name, version and kernel version.

Implement this for the distro and script bootmeths so that it works with
Armbian and older version of Fedora.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2b80bc1e 30-Jul-2022 Simon Glass <sjg@chromium.org>

bootstd: Support bootflows with global bootmeths

Add support for handling this concept in bootflows. Update the 'bootflow'
command to allow only the normal bootmeths to be used. This alllows
skipping EFI bootmgr and VBE, for example.

Signed-off-by: Simon Glass <sjg@chromium.org>

# eccb25cd 30-Jul-2022 Simon Glass <sjg@chromium.org>

bootstd: Allow the bootdev to be optional in bootflows

With global bootmeths we want to scan without a bootdev. Update the logic
to allow this.

Change the bootflow command to show the bootdev only when valid.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2d653f68 24-Apr-2022 Simon Glass <sjg@chromium.org>

bootstd: Add a bootflow command

Add a 'bootflow' command to handle listing and selection of bootflow.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4f806f31 22-Feb-2023 Simon Glass <sjg@chromium.org>

bootflow: Rename bootflow_flags_t

These flags actually relate to the iterator, not the bootflow struct
itself. Rename them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0041b1c0 28-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow enabling BOOTSTD_FULL without needing EXPO

It is sometimes useful to have one without the other, e.g. on a device
without a display, since at present the expo feature requires CONFIG_VIDEO
to be enabled.

Update the Makefile and bootflow command to support this, as well as the
EXPO dependency.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4b7cb058 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Drop the old bootflow_scan_first()

This function is not used outside tests. Drop it and rename
bootflow_scan_dev() since it is how we start a scan now.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 91943ff7 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow scanning a single bootdev label

We want to support scanning a single label, like 'mmc' or 'usb0'. Add
this feature by plumbing the label through to the iterator, setting a
flag to indicate that only siblings of the initial device should be used.

This means that scanning a bootdev by its name is not supported anymore.
That feature doesn't seem very useful in practice, so it is no great loss.

Add a test for bootdev_find_by_any() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d73420e4 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Use hunters when scanning for bootflows

Add a flag to control whether hunters are used when scanning for
bootflows. Enable it by default and tidy up the flag comments a little.

Fow now this has no effect, until a future patch enables this feature.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d9f48579 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Treat DHCP and PXE as bootdev labels

These are associated with the ethernet boot device but do not match its
uclass name, so handle them as special cases.

Provide a way to pass flags through with the bootdev so that we know
how to process it. The flags are checked by the bootmeths, to ensure that
only the selected bootmeth is used.

While these both use the network device, they work quite differently. It
is common to run only one of these, or to run PXE before DHCP. Provide
bootflow flags to control which methods are used. Check these in the two
bootmeths so that only the chosen one is used.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7638c851 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Include the device tree in the bootflow

Some bootmeths provide a way to load a device tree as well as the base
OS image. Add a way to store this in the bootflow. Update the
'bootflow info' command to show this information.

Note that the device tree is not allocated, but instead is stored at
an address provided by an environment variable. This may need to be
adjusted at some point, but for now it works well and fits in with the
existing distro-boot scripts.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 02d929bf 06-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Support creating a boot menu

Create an expo to handle the boot menu. For now this is quite simple, with
just a header, some menu items and a pointer to show the current one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24d8e1b3 06-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow reading a logo for the OS

Some operating systems provide a logo in bmp format. Read this in if
present so it can be displayed in the menu.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2175e76a 06-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Read the Operating System name for distro/scripts

Add the concept of an OS name to the bootflow. This typically includes the
OS name, version and kernel version.

Implement this for the distro and script bootmeths so that it works with
Armbian and older version of Fedora.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2b80bc1e 30-Jul-2022 Simon Glass <sjg@chromium.org>

bootstd: Support bootflows with global bootmeths

Add support for handling this concept in bootflows. Update the 'bootflow'
command to allow only the normal bootmeths to be used. This alllows
skipping EFI bootmgr and VBE, for example.

Signed-off-by: Simon Glass <sjg@chromium.org>

# eccb25cd 30-Jul-2022 Simon Glass <sjg@chromium.org>

bootstd: Allow the bootdev to be optional in bootflows

With global bootmeths we want to scan without a bootdev. Update the logic
to allow this.

Change the bootflow command to show the bootdev only when valid.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2d653f68 24-Apr-2022 Simon Glass <sjg@chromium.org>

bootstd: Add a bootflow command

Add a 'bootflow' command to handle listing and selection of bootflow.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0041b1c0 28-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow enabling BOOTSTD_FULL without needing EXPO

It is sometimes useful to have one without the other, e.g. on a device
without a display, since at present the expo feature requires CONFIG_VIDEO
to be enabled.

Update the Makefile and bootflow command to support this, as well as the
EXPO dependency.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4b7cb058 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Drop the old bootflow_scan_first()

This function is not used outside tests. Drop it and rename
bootflow_scan_dev() since it is how we start a scan now.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 91943ff7 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow scanning a single bootdev label

We want to support scanning a single label, like 'mmc' or 'usb0'. Add
this feature by plumbing the label through to the iterator, setting a
flag to indicate that only siblings of the initial device should be used.

This means that scanning a bootdev by its name is not supported anymore.
That feature doesn't seem very useful in practice, so it is no great loss.

Add a test for bootdev_find_by_any() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d73420e4 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Use hunters when scanning for bootflows

Add a flag to control whether hunters are used when scanning for
bootflows. Enable it by default and tidy up the flag comments a little.

Fow now this has no effect, until a future patch enables this feature.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d9f48579 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Treat DHCP and PXE as bootdev labels

These are associated with the ethernet boot device but do not match its
uclass name, so handle them as special cases.

Provide a way to pass flags through with the bootdev so that we know
how to process it. The flags are checked by the bootmeths, to ensure that
only the selected bootmeth is used.

While these both use the network device, they work quite differently. It
is common to run only one of these, or to run PXE before DHCP. Provide
bootflow flags to control which methods are used. Check these in the two
bootmeths so that only the chosen one is used.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7638c851 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Include the device tree in the bootflow

Some bootmeths provide a way to load a device tree as well as the base
OS image. Add a way to store this in the bootflow. Update the
'bootflow info' command to show this information.

Note that the device tree is not allocated, but instead is stored at
an address provided by an environment variable. This may need to be
adjusted at some point, but for now it works well and fits in with the
existing distro-boot scripts.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 02d929bf 06-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Support creating a boot menu

Create an expo to handle the boot menu. For now this is quite simple, with
just a header, some menu items and a pointer to show the current one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24d8e1b3 06-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow reading a logo for the OS

Some operating systems provide a logo in bmp format. Read this in if
present so it can be displayed in the menu.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2175e76a 06-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Read the Operating System name for distro/scripts

Add the concept of an OS name to the bootflow. This typically includes the
OS name, version and kernel version.

Implement this for the distro and script bootmeths so that it works with
Armbian and older version of Fedora.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2b80bc1e 30-Jul-2022 Simon Glass <sjg@chromium.org>

bootstd: Support bootflows with global bootmeths

Add support for handling this concept in bootflows. Update the 'bootflow'
command to allow only the normal bootmeths to be used. This alllows
skipping EFI bootmgr and VBE, for example.

Signed-off-by: Simon Glass <sjg@chromium.org>

# eccb25cd 30-Jul-2022 Simon Glass <sjg@chromium.org>

bootstd: Allow the bootdev to be optional in bootflows

With global bootmeths we want to scan without a bootdev. Update the logic
to allow this.

Change the bootflow command to show the bootdev only when valid.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2d653f68 24-Apr-2022 Simon Glass <sjg@chromium.org>

bootstd: Add a bootflow command

Add a 'bootflow' command to handle listing and selection of bootflow.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4b7cb058 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Drop the old bootflow_scan_first()

This function is not used outside tests. Drop it and rename
bootflow_scan_dev() since it is how we start a scan now.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 91943ff7 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow scanning a single bootdev label

We want to support scanning a single label, like 'mmc' or 'usb0'. Add
this feature by plumbing the label through to the iterator, setting a
flag to indicate that only siblings of the initial device should be used.

This means that scanning a bootdev by its name is not supported anymore.
That feature doesn't seem very useful in practice, so it is no great loss.

Add a test for bootdev_find_by_any() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d73420e4 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Use hunters when scanning for bootflows

Add a flag to control whether hunters are used when scanning for
bootflows. Enable it by default and tidy up the flag comments a little.

Fow now this has no effect, until a future patch enables this feature.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d9f48579 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Treat DHCP and PXE as bootdev labels

These are associated with the ethernet boot device but do not match its
uclass name, so handle them as special cases.

Provide a way to pass flags through with the bootdev so that we know
how to process it. The flags are checked by the bootmeths, to ensure that
only the selected bootmeth is used.

While these both use the network device, they work quite differently. It
is common to run only one of these, or to run PXE before DHCP. Provide
bootflow flags to control which methods are used. Check these in the two
bootmeths so that only the chosen one is used.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7638c851 17-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Include the device tree in the bootflow

Some bootmeths provide a way to load a device tree as well as the base
OS image. Add a way to store this in the bootflow. Update the
'bootflow info' command to show this information.

Note that the device tree is not allocated, but instead is stored at
an address provided by an environment variable. This may need to be
adjusted at some point, but for now it works well and fits in with the
existing distro-boot scripts.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 02d929bf 06-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Support creating a boot menu

Create an expo to handle the boot menu. For now this is quite simple, with
just a header, some menu items and a pointer to show the current one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24d8e1b3 06-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow reading a logo for the OS

Some operating systems provide a logo in bmp format. Read this in if
present so it can be displayed in the menu.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2175e76a 06-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Read the Operating System name for distro/scripts

Add the concept of an OS name to the bootflow. This typically includes the
OS name, version and kernel version.

Implement this for the distro and script bootmeths so that it works with
Armbian and older version of Fedora.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2b80bc1e 30-Jul-2022 Simon Glass <sjg@chromium.org>

bootstd: Support bootflows with global bootmeths

Add support for handling this concept in bootflows. Update the 'bootflow'
command to allow only the normal bootmeths to be used. This alllows
skipping EFI bootmgr and VBE, for example.

Signed-off-by: Simon Glass <sjg@chromium.org>

# eccb25cd 30-Jul-2022 Simon Glass <sjg@chromium.org>

bootstd: Allow the bootdev to be optional in bootflows

With global bootmeths we want to scan without a bootdev. Update the logic
to allow this.

Change the bootflow command to show the bootdev only when valid.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2d653f68 24-Apr-2022 Simon Glass <sjg@chromium.org>

bootstd: Add a bootflow command

Add a 'bootflow' command to handle listing and selection of bootflow.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 02d929bf 06-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Support creating a boot menu

Create an expo to handle the boot menu. For now this is quite simple, with
just a header, some menu items and a pointer to show the current one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24d8e1b3 06-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Allow reading a logo for the OS

Some operating systems provide a logo in bmp format. Read this in if
present so it can be displayed in the menu.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2175e76a 06-Jan-2023 Simon Glass <sjg@chromium.org>

bootstd: Read the Operating System name for distro/scripts

Add the concept of an OS name to the bootflow. This typically includes the
OS name, version and kernel version.

Implement this for the distro and script bootmeths so that it works with
Armbian and older version of Fedora.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2b80bc1e 30-Jul-2022 Simon Glass <sjg@chromium.org>

bootstd: Support bootflows with global bootmeths

Add support for handling this concept in bootflows. Update the 'bootflow'
command to allow only the normal bootmeths to be used. This alllows
skipping EFI bootmgr and VBE, for example.

Signed-off-by: Simon Glass <sjg@chromium.org>

# eccb25cd 30-Jul-2022 Simon Glass <sjg@chromium.org>

bootstd: Allow the bootdev to be optional in bootflows

With global bootmeths we want to scan without a bootdev. Update the logic
to allow this.

Change the bootflow command to show the bootdev only when valid.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2d653f68 24-Apr-2022 Simon Glass <sjg@chromium.org>

bootstd: Add a bootflow command

Add a 'bootflow' command to handle listing and selection of bootflow.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2b80bc1e 30-Jul-2022 Simon Glass <sjg@chromium.org>

bootstd: Support bootflows with global bootmeths

Add support for handling this concept in bootflows. Update the 'bootflow'
command to allow only the normal bootmeths to be used. This alllows
skipping EFI bootmgr and VBE, for example.

Signed-off-by: Simon Glass <sjg@chromium.org>

# eccb25cd 30-Jul-2022 Simon Glass <sjg@chromium.org>

bootstd: Allow the bootdev to be optional in bootflows

With global bootmeths we want to scan without a bootdev. Update the logic
to allow this.

Change the bootflow command to show the bootdev only when valid.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2d653f68 24-Apr-2022 Simon Glass <sjg@chromium.org>

bootstd: Add a bootflow command

Add a 'bootflow' command to handle listing and selection of bootflow.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2d653f68 24-Apr-2022 Simon Glass <sjg@chromium.org>

bootstd: Add a bootflow command

Add a 'bootflow' command to handle listing and selection of bootflow.

Signed-off-by: Simon Glass <sjg@chromium.org>