[PATCH 07/14] bootm: Make cmdline optional with bootm_boot_start()

Tom Rini trini at konsulko.com
Sat Dec 9 19:39:28 CET 2023


On Sun, Dec 03, 2023 at 05:31:31PM -0700, Simon Glass wrote:

> Allow the default command line to be used when booting the OS. This is
> needed by fastboot.
> 
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
> 
>  boot/bootm.c    | 10 ++++++----
>  include/bootm.h |  2 +-
>  2 files changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/boot/bootm.c b/boot/bootm.c
> index f630b8c1a9c3..4a5da2a3bebf 100644
> --- a/boot/bootm.c
> +++ b/boot/bootm.c
> @@ -1187,10 +1187,12 @@ int bootm_boot_start(ulong addr, const char *cmdline)
>  
>  	snprintf(addr_str, sizeof(addr_str), "%lx", addr);
>  
> -	ret = env_set("bootargs", cmdline);
> -	if (ret) {
> -		printf("Failed to set cmdline\n");
> -		return ret;
> +	if (cmdline) {
> +		ret = env_set("bootargs", cmdline);
> +		if (ret) {
> +			printf("Failed to set cmdline\n");
> +			return ret;
> +		}
>  	}
>  	memset(&bmi, '\0', sizeof(bmi));
>  	bmi.addr_fit = addr_str;

env_set handles NULL today. If there's some problem with fastboot with
CMDLINE=n without this patch I worry there's a functional problem being
obscured here. Or it's not a problem at this point in the code to set
bootargs to empty and we need to allow for that in general.

-- 
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/20231209/d15ba1a3/attachment.sig>


More information about the U-Boot mailing list