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

Simon Glass sjg at chromium.org
Mon Dec 4 01:31:31 CET 2023


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;
diff --git a/include/bootm.h b/include/bootm.h
index 1800ca32c264..8b0c907497ae 100644
--- a/include/bootm.h
+++ b/include/bootm.h
@@ -286,7 +286,7 @@ void zimage_dump(struct boot_params *base_ptr, bool show_cmdline);
  * bootm_boot_start() - Boot an image at the given address
  *
  * @addr: Image address
- * @cmdline: Command line to set
+ * @cmdline: Command line to set, NULL for default
  */
 int bootm_boot_start(ulong addr, const char *cmdline);
 
-- 
2.43.0.rc2.451.g8631bc7472-goog



More information about the U-Boot mailing list