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

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@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",

On Thu, Jun 6, 2013 at 4:41 PM, Steven Stallion sstallion@gmail.com wrote:
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.
Apologies for the double post - it looks like the message had been sitting in an mqueue waiting to resend.

Dear Steven Stallion,
In message 1370562103-92148-1-git-send-email-sstallion@gmail.com you wrote:
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@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);
}
- }
This is basically the same code (with only irrelevant differences) as used by do_bootm_netbsd(). Can you please
1) factor out this common code, and 2) documnt the behaviour ?
By the way: this patch still triggers two "do not use assignment in if condition" checkpoatch errors. Please fix these, too.
Best regards,
Wolfgang Denk

On Sun, Jun 9, 2013 at 12:52 AM, Wolfgang Denk wd@denx.de wrote:
This is basically the same code (with only irrelevant differences) as used by do_bootm_netbsd(). Can you please
- factor out this common code, and
- documnt the behaviour
?
Will do.
By the way: this patch still triggers two "do not use assignment in if condition" checkpoatch errors. Please fix these, too.
Will do. I'll submit a v2 patch later this evening.
Thanks for being patient :-)
Steve
participants (2)
-
Steven Stallion
-
Wolfgang Denk