[U-Boot-Users] [PATCH] Pass NULL for cmd_start/end when bootcmd not present

Martin Hicks mort at bork.org
Wed Mar 29 23:37:23 CEST 2006


Update the way cmd_start and cmd_end are passed to the kernel when there
is no provided 'bootcmd' environment variable.

In this case r6 and r7, which are optional arguments, should be passed as
NULL.  This lets the kernel fall back on its default command line arguments
as defined in the kernel .config as CONFIG_CMDLINE

Signed-off-by: Martin Hicks <mort at bork.org>

---

 common/cmd_bootm.c |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

7bd5192777d195833d18fe4a224ca71bfb55117c
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 8599a49..c628946 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -567,18 +567,23 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int fl
 	cmdline = (char *)((sp - CFG_BARGSIZE) & ~0xF);
 	kbd = (bd_t *)(((ulong)cmdline - sizeof(bd_t)) & ~0xF);
 
-	if ((s = getenv("bootargs")) == NULL)
+	if ((s = getenv("bootargs")) == NULL) {
+		cmd_start = cmd_end = 0;
 		s = "";
+	} else {
+		strcpy (cmdline, s);
 
-	strcpy (cmdline, s);
-
-	cmd_start    = (ulong)&cmdline[0];
-	cmd_end      = cmd_start + strlen(cmdline);
+		cmd_start = (ulong)&cmdline[0];
+		cmd_end   = cmd_start + strlen(cmdline);
+	}
 
 	*kbd = *(gd->bd);
 
 #ifdef	DEBUG
-	printf ("## cmdline at 0x%08lX ... 0x%08lX\n", cmd_start, cmd_end);
+	if (cmd_start)
+		printf ("## cmdline at 0x%08lX ... 0x%08lX\n", cmd_start, cmd_end);
+	else
+		printf ("## cmdline len is 0.  Not passing a cmdline\n");
 
 	do_bdinfo (NULL, 0, 0, NULL);
 #endif
-- 
1.2.4





More information about the U-Boot mailing list