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

Wolfgang Denk wd at denx.de
Sun Jun 9 09:52:13 CEST 2013


Dear Steven Stallion,

In message <1370562103-92148-1-git-send-email-sstallion at 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 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);
> +		}
> +	}
> +

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

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Advice is seldom welcome; and those who want it the most always like
it the least.                         -- Philip Earl of Chesterfield


More information about the U-Boot mailing list