[PATCH v4 3/4] bootstd: Relax the argument requirements for bootflow scan

Tom Rini trini at konsulko.com
Wed Mar 29 16:17:02 CEST 2023


On Wed, Mar 29, 2023 at 08:16:38PM +1300, Simon Glass wrote:

> Currently this does not allow the -lb flags unless CMD_BOOTFLOW_FULL is
> enabled, which means that we need two separate boot commands. Relax this
> to make things easier. It is only a small amount of extra code.
> 
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
> 
> (no changes since v1)
> 
>  boot/Kconfig   |  3 +--
>  cmd/bootflow.c | 14 ++++++++++++--
>  2 files changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/boot/Kconfig b/boot/Kconfig
> index 61ebc2750154..ae0e7b738c0c 100644
> --- a/boot/Kconfig
> +++ b/boot/Kconfig
> @@ -1554,8 +1554,7 @@ config USE_BOOTCOMMAND
>  config BOOTCOMMAND
>  	string "bootcmd value"
>  	depends on USE_BOOTCOMMAND && !USE_DEFAULT_ENV_FILE
> -	default "bootflow scan -lb" if BOOTSTD_BOOTCOMMAND && CMD_BOOTFLOW_FULL
> -	default "bootflow scan" if BOOTSTD_BOOTCOMMAND && !CMD_BOOTFLOW_FULL
> +	default "bootflow scan -lb" if BOOTSTD_BOOTCOMMAND
>  	default "run distro_bootcmd" if !BOOTSTD_BOOTCOMMAND && DISTRO_DEFAULTS
>  	help
>  	  This is the string of commands that will be used as bootcmd and if
> diff --git a/cmd/bootflow.c b/cmd/bootflow.c
> index 42f6e14a4370..c345b020070f 100644
> --- a/cmd/bootflow.c
> +++ b/cmd/bootflow.c
> @@ -124,9 +124,19 @@ static int do_bootflow_scan(struct cmd_tbl *cmdtp, int flag, int argc,
>  		if (!label)
>  			dev = std->cur_bootdev;
>  	} else {
> +		/*
> +		 * allow -b and -l (which is ignored) but complain about
> +		 * anything else
> +		 */
>  		if (has_args) {
> -			printf("Flags not supported: enable CONFIG_BOOTFLOW_FULL\n");
> -			return CMD_RET_USAGE;
> +			char *p;
> +
> +			for (p = argv[1] + 1; *p; p++) {
> +				if (*p != 'b' && *p != 'l') {
> +					printf("Flags not supported: enable CONFIG_BOOTFLOW_FULL\n");
> +					return CMD_RET_USAGE;
> +				}
> +			}
>  		}
>  		boot = true;
>  	}

I don't think this is worth it for the bit of growth everywhere,
honestly.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20230329/ea9a4ba1/attachment.sig>


More information about the U-Boot mailing list