Hi Alex, On Tue, Mar 27, 2018 at 08:43:26AM +0000, Alex Kiernan wrote: > When importing variables allow size to be elided using '-' and then > support a list of variables which restricts what will be picked during > the import. > > Signed-off-by: Alex Kiernan <alex.kier...@gmail.com>
I'm pretty sure it's the same goal as this patch[1] I suggested. Could you answer in the thread telling you need it as well so that we could get it merged or at least reviewed? Thanks, Quentin [1] http://patchwork.ozlabs.org/patch/855542/ > --- > > cmd/nvedit.c | 26 +++++++++++++++++++------- > 1 file changed, 19 insertions(+), 7 deletions(-) > > diff --git a/cmd/nvedit.c b/cmd/nvedit.c > index 4cb25b8..486bb24 100644 > --- a/cmd/nvedit.c > +++ b/cmd/nvedit.c > @@ -972,7 +972,7 @@ sep_err: > > #ifdef CONFIG_CMD_IMPORTENV > /* > - * env import [-d] [-t [-r] | -b | -c] addr [size] > + * env import [-d] [-t [-r] | -b | -c] addr [size] [var ...] > * -d: delete existing environment before importing; > * otherwise overwrite / append to existing definitions > * -t: assume text format; either "size" must be given or the > @@ -985,7 +985,10 @@ sep_err: > * -c: assume checksum protected environment format > * addr: memory address to read from > * size: length of input data; if missing, proper '\0' > - * termination is mandatory > + * termination is mandatory. If not required and passing > + * variables to import use '-' > + * var...: List of variable names that get imported. Without arguments, > + * all variables are imported > */ > static int do_env_import(cmd_tbl_t *cmdtp, int flag, > int argc, char * const argv[]) > @@ -1043,11 +1046,20 @@ static int do_env_import(cmd_tbl_t *cmdtp, int flag, > crlf_is_lf = 0; > > addr = simple_strtoul(argv[0], NULL, 16); > + --argc; > + ++argv; > ptr = map_sysmem(addr, 0); > > - if (argc == 2) { > - size = simple_strtoul(argv[1], NULL, 16); > - } else if (argc == 1 && chk) { > + if (argc >= 1 && !strcmp(argv[0], "-")) { > + --argc; > + ++argv; > + } > + > + if (argc >= 1) { > + size = simple_strtoul(argv[0], NULL, 16); > + --argc; > + ++argv; > + } else if (argc == 0 && chk) { > puts("## Error: external checksum format must pass size\n"); > return CMD_RET_FAILURE; > } else { > @@ -1084,7 +1096,7 @@ static int do_env_import(cmd_tbl_t *cmdtp, int flag, > } > > if (himport_r(&env_htab, ptr, size, sep, del ? 0 : H_NOCLEAR, > - crlf_is_lf, 0, NULL) == 0) { > + crlf_is_lf, argc, argc ? argv : NULL) == 0) { > pr_err("Environment import failed: errno = %d\n", errno); > return 1; > } > @@ -1213,7 +1225,7 @@ static char env_help_text[] = > #endif > #endif > #if defined(CONFIG_CMD_IMPORTENV) > - "env import [-d] [-t [-r] | -b | -c] addr [size] - import environment\n" > + "env import [-d] [-t [-r] | -b | -c] addr [size] [var ...] - import > environment\n" > #endif > "env print [-a | name ...] - print environment\n" > #if defined(CONFIG_CMD_RUN) > -- > 2.7.4 > > _______________________________________________ > U-Boot mailing list > U-Boot@lists.denx.de > https://lists.denx.de/listinfo/u-boot
signature.asc
Description: PGP signature
_______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot