[U-Boot] [PATCH] cmd_bootm: Add command line arguments to Plan 9

Steven Stallion sstallion at gmail.com
Fri Jun 7 01:41:43 CEST 2013


This patch introduces support for command line arguments to Plan 9.
Plan 9 generally dedicates a small region of kernel memory (known
as CONFADDR) for runtime configuration.  A new environment variable
named confaddr was introduced to indicate this location when copying
arguments.

Signed-off-by: Steven Stallion <sstallion at gmail.com>
---
 common/cmd_bootm.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 05130b6..5c62271 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -1533,6 +1533,7 @@ static int do_bootm_plan9(int flag, int argc, char * const argv[],
 			   bootm_headers_t *images)
 {
 	void (*entry_point)(void);
+	char *s;
 
 	if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
 		return 1;
@@ -1544,6 +1545,24 @@ static int do_bootm_plan9(int flag, int argc, char * const argv[],
 	}
 #endif
 
+	if ((s = getenv("confaddr")) != NULL) {
+		char *confaddr = (char *)simple_strtoul(s, NULL, 16);
+
+		if (argc > 2) {
+			int i;
+
+			s = confaddr;
+			for (i = 2; i < argc; i++) {
+				if (i > 2)
+					*s++ = '\n';
+				strcpy(s, argv[i]);
+				s += strlen(argv[i]);
+			}
+		} else if ((s = getenv("bootargs")) != NULL) {
+			strcpy(confaddr, s);
+		}
+	}
+
 	entry_point = (void (*)(void))images->ep;
 
 	printf("## Transferring control to Plan 9 (at address %08lx) ...\n",
-- 
1.7.0.4



More information about the U-Boot mailing list