* [PATCH 0/5] defaultenv-2: add boot sequence @ 2012-08-24 4:52 Jean-Christophe PLAGNIOL-VILLARD 2012-08-24 4:55 ` [PATCH 1/5] globalbar: add inline when not enabled Jean-Christophe PLAGNIOL-VILLARD 0 siblings, 1 reply; 11+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-08-24 4:52 UTC (permalink / raw) To: barebox HI, this patch series depends on fs-symlink send previously please pull The following changes since commit 64adf688f4f8cc6c0b7e1f3c4da29e881524c5f0: defautenv: add support of symlink (2012-08-23 21:31:57 +0800) are available in the git repository at: git://git.jcrosoft.org/barebox.git tags/defaultenv-2-boot-sequence for you to fetch changes up to ae5c90abd8625d1f091a0a089ac29f886fb6c6f5: defaultenv-2: add boot sequence (2012-08-24 12:02:36 +0800) ---------------------------------------------------------------- defaultenv-2: add boot sequence Boot will boot run sequentially the script in /env/boot.d We store symlink in /env/boot.d on /env/boot if not global.boot.defaul or global.boot.defaul == seq start the boot sequence Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> ---------------------------------------------------------------- Jean-Christophe PLAGNIOL-VILLARD (5): globalbar: add inline when not enabled globalvar: add support to set a value to of all globalvars beginning with 'match' defaultenv-2: boot use global.linux.bootargs.dyn for dynamic globarvar defaultenv-2: boot reset linux.bootargs.dyn. and bootm. globarvar defaultenv-2: add boot sequence commands/global.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++------- common/globalvar.c | 10 ++++++++++ defaultenv-2/base/bin/boot | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++----- defaultenv-2/base/bin/bootargs-ip | 4 ++-- defaultenv-2/base/bin/bootargs-ip-barebox | 2 +- defaultenv-2/base/bin/bootargs-ip-dhcp | 2 +- defaultenv-2/base/bin/bootargs-ip-none | 2 +- defaultenv-2/base/bin/bootargs-root-disk | 2 +- defaultenv-2/base/bin/bootargs-root-ext | 2 +- defaultenv-2/base/bin/bootargs-root-initrd | 2 +- defaultenv-2/base/bin/bootargs-root-jffs2 | 2 +- defaultenv-2/base/bin/bootargs-root-nfs | 2 +- defaultenv-2/base/bin/bootargs-root-ubi | 2 +- defaultenv-2/base/bin/init | 5 +++-- defaultenv-2/base/boot/initrd | 2 +- defaultenv-2/base/init/general | 2 +- include/globalvar.h | 23 +++++++++++++++++++++++ 17 files changed, 151 insertions(+), 27 deletions(-) Best Regards, J. _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/5] globalbar: add inline when not enabled 2012-08-24 4:52 [PATCH 0/5] defaultenv-2: add boot sequence Jean-Christophe PLAGNIOL-VILLARD @ 2012-08-24 4:55 ` Jean-Christophe PLAGNIOL-VILLARD 2012-08-24 4:55 ` [PATCH 2/5] globalvar: add support to set a value to of all globalvars beginning with 'match' Jean-Christophe PLAGNIOL-VILLARD ` (3 more replies) 0 siblings, 4 replies; 11+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-08-24 4:55 UTC (permalink / raw) To: barebox Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> --- include/globalvar.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/globalvar.h b/include/globalvar.h index 7cc3976..a127a05 100644 --- a/include/globalvar.h +++ b/include/globalvar.h @@ -1,6 +1,7 @@ #ifndef __GLOBALVAR_H #define __GLOBALVAR_H +#ifdef CONFIG_GLOBALVAR int globalvar_add_simple(const char *name); int globalvar_add(const char *name, @@ -8,5 +9,24 @@ int globalvar_add(const char *name, const char *(*get)(struct device_d *, struct param_d *p), unsigned long flags); char *globalvar_get_match(const char *match, const char *seperator); +#else +static inline int globalvar_add_simple(const char *name) +{ + return 0; +} + +static inline int globalvar_add(const char *name, + int (*set)(struct device_d *dev, struct param_d *p, const char *val), + const char *(*get)(struct device_d *, struct param_d *p), + unsigned long flags) +{ + return 0; +} + +static inline char *globalvar_get_match(const char *match, const char *seperator) +{ + return NULL; +} +#endif #endif /* __GLOBALVAR_H */ -- 1.7.10.4 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 2/5] globalvar: add support to set a value to of all globalvars beginning with 'match' 2012-08-24 4:55 ` [PATCH 1/5] globalbar: add inline when not enabled Jean-Christophe PLAGNIOL-VILLARD @ 2012-08-24 4:55 ` Jean-Christophe PLAGNIOL-VILLARD 2012-08-24 9:08 ` Roberto Nibali 2012-08-24 4:55 ` [PATCH 3/5] defaultenv-2: boot use global.linux.bootargs.dyn for dynamic globarvar Jean-Christophe PLAGNIOL-VILLARD ` (2 subsequent siblings) 3 siblings, 1 reply; 11+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-08-24 4:55 UTC (permalink / raw) To: barebox via c global_reset_match and global -r Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> --- commands/global.c | 58 ++++++++++++++++++++++++++++++++++++++++++++------- common/globalvar.c | 10 +++++++++ include/globalvar.h | 3 +++ 3 files changed, 64 insertions(+), 7 deletions(-) diff --git a/commands/global.c b/commands/global.c index de6b13e..cb22e63 100644 --- a/commands/global.c +++ b/commands/global.c @@ -24,25 +24,26 @@ #include <command.h> #include <globalvar.h> #include <environment.h> +#include <getopt.h> -static int do_global(int argc, char *argv[]) +static int do_global_add(int argc, char *argv[]) { int ret; char *value; - if (argc != 2) + if (argc != 1) return COMMAND_ERROR_USAGE; - value = strchr(argv[1], '='); + value = strchr(argv[0], '='); if (value) { *value = 0; value++; } - ret = globalvar_add_simple(argv[1]); + ret = globalvar_add_simple(argv[0]); if (value) { - char *name = asprintf("global.%s", argv[1]); + char *name = asprintf("global.%s", argv[0]); ret = setenv(name, value); free(name); } @@ -50,13 +51,56 @@ static int do_global(int argc, char *argv[]) return ret ? 1 : 0; } +static int do_global_reset(int argc, char *argv[]) +{ + char *value; + + if (argc != 1) + return COMMAND_ERROR_USAGE; + + value = strchr(argv[0], '='); + if (value) { + *value = 0; + value++; + } else { + value = ""; + } + + globalvar_reset_match(argv[0], value); + + return 0; +} + +static int do_global(int argc, char *argv[]) +{ + int opt; + int do_reset = 0; + + while ((opt = getopt(argc, argv, "r")) > 0) { + switch (opt) { + case 'r': + do_reset = 1; + break; + } + } + + argc -= optind; + argv += optind; + + if (do_reset) + return do_global_reset(argc, argv); + + return do_global_add(argc, argv); +} + BAREBOX_CMD_HELP_START(global) -BAREBOX_CMD_HELP_USAGE("global <var>[=<value]\n") +BAREBOX_CMD_HELP_USAGE("global [-r] <var>[=<value]\n") BAREBOX_CMD_HELP_SHORT("add a new global variable named <var>, optionally set to <value>\n") +BAREBOX_CMD_HELP_SHORT("-r to set a value to of all globalvars beginning with 'match'") BAREBOX_CMD_HELP_END BAREBOX_CMD_START(global) .cmd = do_global, - .usage = "create global variables", + .usage = "create or reset global variables", BAREBOX_CMD_HELP(cmd_global_help) BAREBOX_CMD_END diff --git a/common/globalvar.c b/common/globalvar.c index 71296ff..99f055e 100644 --- a/common/globalvar.c +++ b/common/globalvar.c @@ -46,6 +46,16 @@ char *globalvar_get_match(const char *match, const char *seperator) return val; } +void globalvar_reset_match(const char *match, const char *val) +{ + struct param_d *param; + + list_for_each_entry(param, &global_device.parameters, list) { + if (!strncmp(match, param->name, strlen(match))) + dev_set_param(&global_device, param->name, val); + } +} + /* * globalvar_add_simple * diff --git a/include/globalvar.h b/include/globalvar.h index a127a05..1935f83 100644 --- a/include/globalvar.h +++ b/include/globalvar.h @@ -9,6 +9,7 @@ int globalvar_add(const char *name, const char *(*get)(struct device_d *, struct param_d *p), unsigned long flags); char *globalvar_get_match(const char *match, const char *seperator); +void globalvar_reset_match(const char *match, const char *val); #else static inline int globalvar_add_simple(const char *name) { @@ -27,6 +28,8 @@ static inline char *globalvar_get_match(const char *match, const char *seperator { return NULL; } + +static inline void globalvar_reset_match(const char *match, const char *val) {} #endif #endif /* __GLOBALVAR_H */ -- 1.7.10.4 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/5] globalvar: add support to set a value to of all globalvars beginning with 'match' 2012-08-24 4:55 ` [PATCH 2/5] globalvar: add support to set a value to of all globalvars beginning with 'match' Jean-Christophe PLAGNIOL-VILLARD @ 2012-08-24 9:08 ` Roberto Nibali 2012-08-24 18:51 ` Jean-Christophe PLAGNIOL-VILLARD 0 siblings, 1 reply; 11+ messages in thread From: Roberto Nibali @ 2012-08-24 9:08 UTC (permalink / raw) To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox Hi > commands/global.c | 58 ++++++++++++++++++++++++++++++++++++++++++++------- > common/globalvar.c | 10 +++++++++ > include/globalvar.h | 3 +++ > 3 files changed, 64 insertions(+), 7 deletions(-) > > diff --git a/commands/global.c b/commands/global.c > index de6b13e..cb22e63 100644 > --- a/commands/global.c > +++ b/commands/global.c > @@ -24,25 +24,26 @@ > #include <command.h> > #include <globalvar.h> > #include <environment.h> > +#include <getopt.h> > > -static int do_global(int argc, char *argv[]) > +static int do_global_add(int argc, char *argv[]) > { > int ret; > char *value; > > - if (argc != 2) > + if (argc != 1) > return COMMAND_ERROR_USAGE; > > - value = strchr(argv[1], '='); > + value = strchr(argv[0], '='); > if (value) { > *value = 0; > value++; > } > > - ret = globalvar_add_simple(argv[1]); > + ret = globalvar_add_simple(argv[0]); > > if (value) { > - char *name = asprintf("global.%s", argv[1]); > + char *name = asprintf("global.%s", argv[0]); > ret = setenv(name, value); > free(name); > } > @@ -50,13 +51,56 @@ static int do_global(int argc, char *argv[]) > return ret ? 1 : 0; > } > > +static int do_global_reset(int argc, char *argv[]) > +{ > + char *value; > + > + if (argc != 1) > + return COMMAND_ERROR_USAGE; > + > + value = strchr(argv[0], '='); > + if (value) { > + *value = 0; > + value++; > + } else { > + value = ""; > + } > + > + globalvar_reset_match(argv[0], value); > + > + return 0; > +} > + > +static int do_global(int argc, char *argv[]) > +{ > + int opt; > + int do_reset = 0; > + > + while ((opt = getopt(argc, argv, "r")) > 0) { > + switch (opt) { > + case 'r': > + do_reset = 1; > + break; > + } > + } > + > + argc -= optind; > + argv += optind; > + > + if (do_reset) > + return do_global_reset(argc, argv); Since I just read the diff, I might fail to see the big picture, however, where's the call to globalvar_reset_match(), is it inside do_global_reset()? > + return do_global_add(argc, argv); > +} > + > BAREBOX_CMD_HELP_START(global) > -BAREBOX_CMD_HELP_USAGE("global <var>[=<value]\n") > +BAREBOX_CMD_HELP_USAGE("global [-r] <var>[=<value]\n") > BAREBOX_CMD_HELP_SHORT("add a new global variable named <var>, optionally set to <value>\n") > +BAREBOX_CMD_HELP_SHORT("-r to set a value to of all globalvars beginning with 'match'") Shouldn't this be REset instead of set? How about: "-r to reset all matching global variables to a value." Maybe giving an example could shed some light on the exact syntax of the exact kind of matching you had in mind. > BAREBOX_CMD_HELP_END > > BAREBOX_CMD_START(global) > .cmd = do_global, > - .usage = "create global variables", > + .usage = "create or reset global variables", > BAREBOX_CMD_HELP(cmd_global_help) > BAREBOX_CMD_END > diff --git a/common/globalvar.c b/common/globalvar.c > index 71296ff..99f055e 100644 > --- a/common/globalvar.c > +++ b/common/globalvar.c > @@ -46,6 +46,16 @@ char *globalvar_get_match(const char *match, const char *seperator) > return val; > } > > +void globalvar_reset_match(const char *match, const char *val) > +{ > + struct param_d *param; > + > + list_for_each_entry(param, &global_device.parameters, list) { > + if (!strncmp(match, param->name, strlen(match))) > + dev_set_param(&global_device, param->name, val); > + } > +} > + > /* > * globalvar_add_simple > * > diff --git a/include/globalvar.h b/include/globalvar.h > index a127a05..1935f83 100644 > --- a/include/globalvar.h > +++ b/include/globalvar.h > @@ -9,6 +9,7 @@ int globalvar_add(const char *name, > const char *(*get)(struct device_d *, struct param_d *p), > unsigned long flags); > char *globalvar_get_match(const char *match, const char *seperator); > +void globalvar_reset_match(const char *match, const char *val); > #else > static inline int globalvar_add_simple(const char *name) > { > @@ -27,6 +28,8 @@ static inline char *globalvar_get_match(const char *match, const char *seperator > { > return NULL; > } > + > +static inline void globalvar_reset_match(const char *match, const char *val) {} > #endif > > #endif /* __GLOBALVAR_H */ > -- > 1.7.10.4 > > > _______________________________________________ > barebox mailing list > barebox@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/barebox _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/5] globalvar: add support to set a value to of all globalvars beginning with 'match' 2012-08-24 9:08 ` Roberto Nibali @ 2012-08-24 18:51 ` Jean-Christophe PLAGNIOL-VILLARD 0 siblings, 0 replies; 11+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-08-24 18:51 UTC (permalink / raw) To: Roberto Nibali; +Cc: barebox On 11:08 Fri 24 Aug , Roberto Nibali wrote: > Hi > > > commands/global.c | 58 ++++++++++++++++++++++++++++++++++++++++++++------- > > common/globalvar.c | 10 +++++++++ > > include/globalvar.h | 3 +++ > > 3 files changed, 64 insertions(+), 7 deletions(-) > > > > diff --git a/commands/global.c b/commands/global.c > > index de6b13e..cb22e63 100644 > > --- a/commands/global.c > > +++ b/commands/global.c > > @@ -24,25 +24,26 @@ > > #include <command.h> > > #include <globalvar.h> > > #include <environment.h> > > +#include <getopt.h> > > > > -static int do_global(int argc, char *argv[]) > > +static int do_global_add(int argc, char *argv[]) > > { > > int ret; > > char *value; > > > > - if (argc != 2) > > + if (argc != 1) > > return COMMAND_ERROR_USAGE; > > > > - value = strchr(argv[1], '='); > > + value = strchr(argv[0], '='); > > if (value) { > > *value = 0; > > value++; > > } > > > > - ret = globalvar_add_simple(argv[1]); > > + ret = globalvar_add_simple(argv[0]); > > > > if (value) { > > - char *name = asprintf("global.%s", argv[1]); > > + char *name = asprintf("global.%s", argv[0]); > > ret = setenv(name, value); > > free(name); > > } > > @@ -50,13 +51,56 @@ static int do_global(int argc, char *argv[]) > > return ret ? 1 : 0; > > } > > > > +static int do_global_reset(int argc, char *argv[]) > > +{ > > + char *value; > > + > > + if (argc != 1) > > + return COMMAND_ERROR_USAGE; > > + > > + value = strchr(argv[0], '='); > > + if (value) { > > + *value = 0; > > + value++; > > + } else { > > + value = ""; > > + } > > + > > + globalvar_reset_match(argv[0], value); > > + > > + return 0; > > +} > > + > > +static int do_global(int argc, char *argv[]) > > +{ > > + int opt; > > + int do_reset = 0; > > + > > + while ((opt = getopt(argc, argv, "r")) > 0) { > > + switch (opt) { > > + case 'r': > > + do_reset = 1; > > + break; > > + } > > + } > > + > > + argc -= optind; > > + argv += optind; > > + > > + if (do_reset) > > + return do_global_reset(argc, argv); > > Since I just read the diff, I might fail to see the big picture, > however, where's the call to globalvar_reset_match(), is it inside > do_global_reset()? no can not you do this globalvar toto.l=t globalvar toto=a so you expect global.toto.l=t global.toto=a and if we you the reset_match you will have global.toto.l=a global.toto=a > > > + return do_global_add(argc, argv); > > +} > > + > > BAREBOX_CMD_HELP_START(global) > > -BAREBOX_CMD_HELP_USAGE("global <var>[=<value]\n") > > +BAREBOX_CMD_HELP_USAGE("global [-r] <var>[=<value]\n") > > BAREBOX_CMD_HELP_SHORT("add a new global variable named <var>, optionally set to <value>\n") > > +BAREBOX_CMD_HELP_SHORT("-r to set a value to of all globalvars beginning with 'match'") > > Shouldn't this be REset instead of set? How about: > > "-r to reset all matching global variables to a value." > > Maybe giving an example could shed some light on the exact syntax of > the exact kind of matching you had in mind. it's realy set a value to a list of params the text in english is clear Best Regards, J. _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 3/5] defaultenv-2: boot use global.linux.bootargs.dyn for dynamic globarvar 2012-08-24 4:55 ` [PATCH 1/5] globalbar: add inline when not enabled Jean-Christophe PLAGNIOL-VILLARD 2012-08-24 4:55 ` [PATCH 2/5] globalvar: add support to set a value to of all globalvars beginning with 'match' Jean-Christophe PLAGNIOL-VILLARD @ 2012-08-24 4:55 ` Jean-Christophe PLAGNIOL-VILLARD 2012-08-24 4:55 ` [PATCH 4/5] defaultenv-2: boot reset linux.bootargs.dyn. and bootm. globarvar Jean-Christophe PLAGNIOL-VILLARD 2012-08-24 4:55 ` [PATCH 5/5] defaultenv-2: add boot sequence Jean-Christophe PLAGNIOL-VILLARD 3 siblings, 0 replies; 11+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-08-24 4:55 UTC (permalink / raw) To: barebox linux.bootargs.dyn.* will be clearer at the beginning of boot This is need for boot sequence to do not have the previous boot param. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> --- defaultenv-2/base/bin/bootargs-ip | 4 ++-- defaultenv-2/base/bin/bootargs-ip-barebox | 2 +- defaultenv-2/base/bin/bootargs-ip-dhcp | 2 +- defaultenv-2/base/bin/bootargs-ip-none | 2 +- defaultenv-2/base/bin/bootargs-root-disk | 2 +- defaultenv-2/base/bin/bootargs-root-ext | 2 +- defaultenv-2/base/bin/bootargs-root-initrd | 2 +- defaultenv-2/base/bin/bootargs-root-jffs2 | 2 +- defaultenv-2/base/bin/bootargs-root-nfs | 2 +- defaultenv-2/base/bin/bootargs-root-ubi | 2 +- defaultenv-2/base/bin/init | 5 +++-- defaultenv-2/base/boot/initrd | 2 +- 12 files changed, 15 insertions(+), 14 deletions(-) diff --git a/defaultenv-2/base/bin/bootargs-ip b/defaultenv-2/base/bin/bootargs-ip index 15041c6..2d4486c 100644 --- a/defaultenv-2/base/bin/bootargs-ip +++ b/defaultenv-2/base/bin/bootargs-ip @@ -5,7 +5,7 @@ . /env/network/eth0 if [ $ip = dhcp ]; then - global.linux.bootargs.ip="ip=dhcp" + global.linux.bootargs.dyn.ip="ip=dhcp" else - global.linux.bootargs.ip="ip=$ipaddr:$serverip:$gateway:$netmask::eth0:" + global.linux.bootargs.dyn.ip="ip=$ipaddr:$serverip:$gateway:$netmask::eth0:" fi diff --git a/defaultenv-2/base/bin/bootargs-ip-barebox b/defaultenv-2/base/bin/bootargs-ip-barebox index 986c142..5a3b984 100644 --- a/defaultenv-2/base/bin/bootargs-ip-barebox +++ b/defaultenv-2/base/bin/bootargs-ip-barebox @@ -4,4 +4,4 @@ ifup eth0 -global.linux.bootargs.ip="ip=$eth0.ipaddr:$eth0.serverip:$eth0.gateway:$eth0.netmask::eth0:" +global.linux.bootargs.dyn.ip="ip=$eth0.ipaddr:$eth0.serverip:$eth0.gateway:$eth0.netmask::eth0:" diff --git a/defaultenv-2/base/bin/bootargs-ip-dhcp b/defaultenv-2/base/bin/bootargs-ip-dhcp index c542b24..dec8ae4 100644 --- a/defaultenv-2/base/bin/bootargs-ip-dhcp +++ b/defaultenv-2/base/bin/bootargs-ip-dhcp @@ -2,4 +2,4 @@ # Do dhcp in Linux -global.linux.bootargs.ip="ip=dhcp" +global.linux.bootargs.dyn.ip="ip=dhcp" diff --git a/defaultenv-2/base/bin/bootargs-ip-none b/defaultenv-2/base/bin/bootargs-ip-none index c010154..88aaa21 100644 --- a/defaultenv-2/base/bin/bootargs-ip-none +++ b/defaultenv-2/base/bin/bootargs-ip-none @@ -2,4 +2,4 @@ # disable ip setup in Linux -global.linux.bootargs.ip="ip=none" +global.linux.bootargs.dyn.ip="ip=none" diff --git a/defaultenv-2/base/bin/bootargs-root-disk b/defaultenv-2/base/bin/bootargs-root-disk index df8750e..aa60cf3 100644 --- a/defaultenv-2/base/bin/bootargs-root-disk +++ b/defaultenv-2/base/bin/bootargs-root-disk @@ -23,4 +23,4 @@ if [ -z "${fstype}" ]; then exit 1 fi -global.linux.bootargs.root="root=/dev/$part rootfstype=$fstype rootwait" +global.linux.bootargs.dyn.root="root=/dev/$part rootfstype=$fstype rootwait" diff --git a/defaultenv-2/base/bin/bootargs-root-ext b/defaultenv-2/base/bin/bootargs-root-ext index 45fcd5a..dbdddb9 100644 --- a/defaultenv-2/base/bin/bootargs-root-ext +++ b/defaultenv-2/base/bin/bootargs-root-ext @@ -9,4 +9,4 @@ while getopt "m:r:" opt; do fi done -global.linux.bootargs.root="root=/dev/$part rootfstype=ext$type rootwait" +global.linux.bootargs.dyn.root="root=/dev/$part rootfstype=ext$type rootwait" diff --git a/defaultenv-2/base/bin/bootargs-root-initrd b/defaultenv-2/base/bin/bootargs-root-initrd index 7072cea..cc711a1 100644 --- a/defaultenv-2/base/bin/bootargs-root-initrd +++ b/defaultenv-2/base/bin/bootargs-root-initrd @@ -13,4 +13,4 @@ while getopt "i:h" opt; do fi done -global.linux.bootargs.root="root=/dev/ram0 rdinit=${rdinit}" +global.linux.bootargs.dyn.root="root=/dev/ram0 rdinit=${rdinit}" diff --git a/defaultenv-2/base/bin/bootargs-root-jffs2 b/defaultenv-2/base/bin/bootargs-root-jffs2 index 74d59af..a8eb5e7 100644 --- a/defaultenv-2/base/bin/bootargs-root-jffs2 +++ b/defaultenv-2/base/bin/bootargs-root-jffs2 @@ -18,4 +18,4 @@ if [ -z "$mtd" ]; then exit 1 fi -global.linux.bootargs.root="root=$mtd rootfstype=jffs2" +global.linux.bootargs.dyn.root="root=$mtd rootfstype=jffs2" diff --git a/defaultenv-2/base/bin/bootargs-root-nfs b/defaultenv-2/base/bin/bootargs-root-nfs index 27bb6c4..355f93d 100644 --- a/defaultenv-2/base/bin/bootargs-root-nfs +++ b/defaultenv-2/base/bin/bootargs-root-nfs @@ -17,4 +17,4 @@ if [ -n ${serverip} ]; then nfsroot="$serverip:$nfsroot" fi -global.linux.bootargs.root="root=/dev/nfs nfsroot=$nfsroot,v3,tcp" +global.linux.bootargs.dyn.root="root=/dev/nfs nfsroot=$nfsroot,v3,tcp" diff --git a/defaultenv-2/base/bin/bootargs-root-ubi b/defaultenv-2/base/bin/bootargs-root-ubi index fb7f328..4260336 100644 --- a/defaultenv-2/base/bin/bootargs-root-ubi +++ b/defaultenv-2/base/bin/bootargs-root-ubi @@ -21,4 +21,4 @@ if [ -z "$mtd" ]; then exit 1 fi -global.linux.bootargs.root="root=ubi0:$ubiroot ubi.mtd=$mtd rootfstype=ubifs" +global.linux.bootargs.dyn.root="root=ubi0:$ubiroot ubi.mtd=$mtd rootfstype=ubifs" diff --git a/defaultenv-2/base/bin/init b/defaultenv-2/base/bin/init index 9d7eb2e..8e8871d 100644 --- a/defaultenv-2/base/bin/init +++ b/defaultenv-2/base/bin/init @@ -8,8 +8,9 @@ global autoboot_timeout=3 global boot.default=net global allow_color=true global linux.bootargs.base -global linux.bootargs.ip -global linux.bootargs.root +#linux.bootargs.dyn.* will be clearer at the beginning of boot +global linux.bootargs.dyn.ip +global linux.bootargs.dyn.root global editcmd=sedit /env/init/general diff --git a/defaultenv-2/base/boot/initrd b/defaultenv-2/base/boot/initrd index 79a353a..7c44d07 100644 --- a/defaultenv-2/base/boot/initrd +++ b/defaultenv-2/base/boot/initrd @@ -11,7 +11,7 @@ global.bootm.initrd="${path}/initramfs" bootargs-root-initrd #global.bootm.oftree=<path to oftree> -global.linux.bootargs.root="root=/dev/ram0" +global.linux.bootargs.dyn.root="root=/dev/ram0" #bootargs-root-nfs -n "<path on server>" -s <serverip> #bootargs-root-ubi -r <volume> -m <mtdname> -- 1.7.10.4 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 4/5] defaultenv-2: boot reset linux.bootargs.dyn. and bootm. globarvar 2012-08-24 4:55 ` [PATCH 1/5] globalbar: add inline when not enabled Jean-Christophe PLAGNIOL-VILLARD 2012-08-24 4:55 ` [PATCH 2/5] globalvar: add support to set a value to of all globalvars beginning with 'match' Jean-Christophe PLAGNIOL-VILLARD 2012-08-24 4:55 ` [PATCH 3/5] defaultenv-2: boot use global.linux.bootargs.dyn for dynamic globarvar Jean-Christophe PLAGNIOL-VILLARD @ 2012-08-24 4:55 ` Jean-Christophe PLAGNIOL-VILLARD 2012-08-24 4:55 ` [PATCH 5/5] defaultenv-2: add boot sequence Jean-Christophe PLAGNIOL-VILLARD 3 siblings, 0 replies; 11+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-08-24 4:55 UTC (permalink / raw) To: barebox This is need for boot sequence to do not have the previous boot param. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> --- defaultenv-2/base/bin/boot | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/defaultenv-2/base/bin/boot b/defaultenv-2/base/bin/boot index 4ebda3f..103eb87 100644 --- a/defaultenv-2/base/bin/boot +++ b/defaultenv-2/base/bin/boot @@ -33,6 +33,10 @@ while getopt "vdhl" opt; do fi done +# clear linux.bootargs.dyn.* and bootm.* +global -r linux.bootargs.dyn. +global -r bootm. + if [ $# = 0 ]; then scr="$global.boot.default" else -- 1.7.10.4 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 5/5] defaultenv-2: add boot sequence 2012-08-24 4:55 ` [PATCH 1/5] globalbar: add inline when not enabled Jean-Christophe PLAGNIOL-VILLARD ` (2 preceding siblings ...) 2012-08-24 4:55 ` [PATCH 4/5] defaultenv-2: boot reset linux.bootargs.dyn. and bootm. globarvar Jean-Christophe PLAGNIOL-VILLARD @ 2012-08-24 4:55 ` Jean-Christophe PLAGNIOL-VILLARD 2012-08-24 7:36 ` Roberto Nibali 2012-08-28 8:26 ` Sascha Hauer 3 siblings, 2 replies; 11+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-08-24 4:55 UTC (permalink / raw) To: barebox Boot will boot run sequentially the script in /env/boot.d if not global.boot.defaul or global.boot.defaul == seq start the boot sequence Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> --- defaultenv-2/base/bin/boot | 52 ++++++++++++++++++++++++++++++++++++---- defaultenv-2/base/init/general | 2 +- 2 files changed, 48 insertions(+), 6 deletions(-) diff --git a/defaultenv-2/base/bin/boot b/defaultenv-2/base/bin/boot index 103eb87..ade555d 100644 --- a/defaultenv-2/base/bin/boot +++ b/defaultenv-2/base/bin/boot @@ -2,20 +2,39 @@ verbose= dryrun= +sequence= usage=" $0 [OPTIONS] [source]\n -v verbose\n -d dryrun\n -l list boot sources\n + -s start boot sequence in /env/boot.d/\n -h help" +if [ ${global.allow_color} = "true" ]; then + . /env/data/ansi-colors + ECHO=-e +fi + for i in /env/boot/*; do basename $i s sources="$sources$s " done -while getopt "vdhl" opt; do +if [ -d /env/boot.d ]; then + sources="$sources\nboot sequence:" + for i in /env/boot.d/*; do + readlink -f $i s + basename $s link + basename $i s + sources="$sources\n $s -> $link" + done +else + sources="$sources\nboot sequence:\nnone" +fi + +while getopt "vdhls" opt; do if [ ${opt} = v ]; then if [ -n "$verbose" ]; then verbose="-v -v" @@ -23,7 +42,9 @@ while getopt "vdhl" opt; do verbose="-v" fi elif [ ${opt} = d ]; then - dryrun=1 + dryrun="-d" + elif [ ${opt} = s ]; then + sequence=1 elif [ ${opt} = l ]; then echo -e "boot sources:\n$sources" exit 0 @@ -43,12 +64,33 @@ else scr="$1" fi +if [ -n "$sequence" -o "x$src" = "xseq" ]; then + if [ ! -d /env/boot.d ]; then + echo ${ECHO} "${GREEN}boot sequence ${RED}none${NC}" + exit 1 + fi + echo ${ECHO} "${GREEN}Start boot sequence${NC}" + for i in /env/boot.d/*; do + readlink -f $i s + basename $s link + basename $i s + msg="${GREEN}boot${NC} ${YELLOW}${s}${NC} -> ${CYAN}${link}${NC}" + echo ${ECHO} "${msg}" + boot $dryrun $s + echo ${ECHO} "${msg} ${RED}failled${NC}" + ret=$? + done + echo ${ECHO} "${GREEN}boot sequence ${RED}failled${NC}" + exit $ret +fi + if [ -n "$scr" ]; then - if [ ! -f /env/boot/$scr ]; then - echo -e "/env/boot/$scr does not exist.Valid choices:\n$sources" + if [ ! -f /env/boot.d/$scr -a ! -f /env/boot/$scr ]; then + echo -e "/env/boot/$scr or /env/boot.d/$scr does not exist.Valid choices:\n$sources" exit fi - /env/boot/$scr + [ -f /env/boot.d/$scr ] && /env/boot.d/$scr + [ -f /env/boot/$scr ] && /env/boot/$scr fi if [ -n "$dryrun" ]; then diff --git a/defaultenv-2/base/init/general b/defaultenv-2/base/init/general index 98a92d1..2c0bd74 100644 --- a/defaultenv-2/base/init/general +++ b/defaultenv-2/base/init/general @@ -11,5 +11,5 @@ global.user=sha # timeout in seconds before the default boot entry is started global.autoboot_timeout=3 -# default boot entry (one of /env/boot/*) +# default boot entry (one of /env/boot/*) or seq to start the sequence global.boot.default=net -- 1.7.10.4 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 5/5] defaultenv-2: add boot sequence 2012-08-24 4:55 ` [PATCH 5/5] defaultenv-2: add boot sequence Jean-Christophe PLAGNIOL-VILLARD @ 2012-08-24 7:36 ` Roberto Nibali 2012-08-28 8:26 ` Sascha Hauer 1 sibling, 0 replies; 11+ messages in thread From: Roberto Nibali @ 2012-08-24 7:36 UTC (permalink / raw) To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox Hi > diff --git a/defaultenv-2/base/bin/boot b/defaultenv-2/base/bin/boot > index 103eb87..ade555d 100644 > --- a/defaultenv-2/base/bin/boot > +++ b/defaultenv-2/base/bin/boot > @@ -2,20 +2,39 @@ > > verbose= > dryrun= > +sequence= > > usage=" > $0 [OPTIONS] [source]\n > -v verbose\n > -d dryrun\n > -l list boot sources\n > + -s start boot sequence in /env/boot.d/\n > -h help" > > +if [ ${global.allow_color} = "true" ]; then > + . /env/data/ansi-colors > + ECHO=-e > +fi Since you seem to be using global.allow_color in other places as well, wouldn't it be advisable to move the whole if-block into /env/data/ansi-colors and subsequently just source it whenever a hush script needs it? Also why not generally use $ECHO in scripts, however along the lines of (inside /env/data/ansi-colors/): if [ ${global.allow_color} = "true" ]; then # color definitions ECHO = "echo -e" else ECHO = "echo" fi You then only invoke $ECHO instead of 'echo $ECHO'. > for i in /env/boot/*; do > basename $i s > sources="$sources$s " > done > > -while getopt "vdhl" opt; do > +if [ -d /env/boot.d ]; then > + sources="$sources\nboot sequence:" > + for i in /env/boot.d/*; do > + readlink -f $i s > + basename $s link > + basename $i s > + sources="$sources\n $s -> $link" > + done > +else > + sources="$sources\nboot sequence:\nnone" > +fi > + > +while getopt "vdhls" opt; do > if [ ${opt} = v ]; then > if [ -n "$verbose" ]; then > verbose="-v -v" > @@ -23,7 +42,9 @@ while getopt "vdhl" opt; do > verbose="-v" > fi > elif [ ${opt} = d ]; then > - dryrun=1 > + dryrun="-d" Why this change? > + elif [ ${opt} = s ]; then > + sequence=1 > elif [ ${opt} = l ]; then > echo -e "boot sources:\n$sources" > exit 0 > @@ -43,12 +64,33 @@ else > scr="$1" > fi > > +if [ -n "$sequence" -o "x$src" = "xseq" ]; then > + if [ ! -d /env/boot.d ]; then > + echo ${ECHO} "${GREEN}boot sequence ${RED}none${NC}" > + exit 1 > + fi > + echo ${ECHO} "${GREEN}Start boot sequence${NC}" > + for i in /env/boot.d/*; do > + readlink -f $i s > + basename $s link > + basename $i s > + msg="${GREEN}boot${NC} ${YELLOW}${s}${NC} -> ${CYAN}${link}${NC}" > + echo ${ECHO} "${msg}" > + boot $dryrun $s > + echo ${ECHO} "${msg} ${RED}failled${NC}" > + ret=$? > + done > + echo ${ECHO} "${GREEN}boot sequence ${RED}failled${NC}" > + exit $ret > +fi > + > if [ -n "$scr" ]; then > - if [ ! -f /env/boot/$scr ]; then > - echo -e "/env/boot/$scr does not exist.Valid choices:\n$sources" > + if [ ! -f /env/boot.d/$scr -a ! -f /env/boot/$scr ]; then > + echo -e "/env/boot/$scr or /env/boot.d/$scr does not exist.Valid choices:\n$sources" > exit > fi > - /env/boot/$scr > + [ -f /env/boot.d/$scr ] && /env/boot.d/$scr > + [ -f /env/boot/$scr ] && /env/boot/$scr > fi > > if [ -n "$dryrun" ]; then > diff --git a/defaultenv-2/base/init/general b/defaultenv-2/base/init/general > index 98a92d1..2c0bd74 100644 > --- a/defaultenv-2/base/init/general > +++ b/defaultenv-2/base/init/general > @@ -11,5 +11,5 @@ global.user=sha > # timeout in seconds before the default boot entry is started > global.autoboot_timeout=3 > > -# default boot entry (one of /env/boot/*) > +# default boot entry (one of /env/boot/*) or seq to start the sequence > global.boot.default=net > -- > 1.7.10.4 > > > _______________________________________________ > barebox mailing list > barebox@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/barebox _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 5/5] defaultenv-2: add boot sequence 2012-08-24 4:55 ` [PATCH 5/5] defaultenv-2: add boot sequence Jean-Christophe PLAGNIOL-VILLARD 2012-08-24 7:36 ` Roberto Nibali @ 2012-08-28 8:26 ` Sascha Hauer 2012-09-01 12:49 ` Jean-Christophe PLAGNIOL-VILLARD 1 sibling, 1 reply; 11+ messages in thread From: Sascha Hauer @ 2012-08-28 8:26 UTC (permalink / raw) To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox On Fri, Aug 24, 2012 at 06:55:13AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote: > Boot will boot run sequentially the script in /env/boot.d > > if not global.boot.defaul or global.boot.defaul == seq > start the boot sequence > > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> > --- > defaultenv-2/base/bin/boot | 52 ++++++++++++++++++++++++++++++++++++---- > defaultenv-2/base/init/general | 2 +- > 2 files changed, 48 insertions(+), 6 deletions(-) > > diff --git a/defaultenv-2/base/bin/boot b/defaultenv-2/base/bin/boot > index 103eb87..ade555d 100644 > --- a/defaultenv-2/base/bin/boot > +++ b/defaultenv-2/base/bin/boot > @@ -2,20 +2,39 @@ > > verbose= > dryrun= > +sequence= > > usage=" > $0 [OPTIONS] [source]\n > -v verbose\n > -d dryrun\n > -l list boot sources\n > + -s start boot sequence in /env/boot.d/\n I think there should not be a dedicated option for this. Instead, it should by default start the boot sequence. global.boot.default could then be dropped. Sascha > -h help" > > +if [ ${global.allow_color} = "true" ]; then > + . /env/data/ansi-colors > + ECHO=-e > +fi > + > for i in /env/boot/*; do > basename $i s > sources="$sources$s " > done > > -while getopt "vdhl" opt; do > +if [ -d /env/boot.d ]; then > + sources="$sources\nboot sequence:" > + for i in /env/boot.d/*; do > + readlink -f $i s > + basename $s link > + basename $i s > + sources="$sources\n $s -> $link" > + done > +else > + sources="$sources\nboot sequence:\nnone" > +fi > + > +while getopt "vdhls" opt; do > if [ ${opt} = v ]; then > if [ -n "$verbose" ]; then > verbose="-v -v" > @@ -23,7 +42,9 @@ while getopt "vdhl" opt; do > verbose="-v" > fi > elif [ ${opt} = d ]; then > - dryrun=1 > + dryrun="-d" > + elif [ ${opt} = s ]; then > + sequence=1 > elif [ ${opt} = l ]; then > echo -e "boot sources:\n$sources" > exit 0 > @@ -43,12 +64,33 @@ else > scr="$1" > fi > > +if [ -n "$sequence" -o "x$src" = "xseq" ]; then > + if [ ! -d /env/boot.d ]; then > + echo ${ECHO} "${GREEN}boot sequence ${RED}none${NC}" > + exit 1 > + fi > + echo ${ECHO} "${GREEN}Start boot sequence${NC}" > + for i in /env/boot.d/*; do > + readlink -f $i s > + basename $s link > + basename $i s > + msg="${GREEN}boot${NC} ${YELLOW}${s}${NC} -> ${CYAN}${link}${NC}" > + echo ${ECHO} "${msg}" > + boot $dryrun $s > + echo ${ECHO} "${msg} ${RED}failled${NC}" > + ret=$? > + done > + echo ${ECHO} "${GREEN}boot sequence ${RED}failled${NC}" > + exit $ret > +fi > + > if [ -n "$scr" ]; then > - if [ ! -f /env/boot/$scr ]; then > - echo -e "/env/boot/$scr does not exist.Valid choices:\n$sources" > + if [ ! -f /env/boot.d/$scr -a ! -f /env/boot/$scr ]; then > + echo -e "/env/boot/$scr or /env/boot.d/$scr does not exist.Valid choices:\n$sources" > exit > fi > - /env/boot/$scr > + [ -f /env/boot.d/$scr ] && /env/boot.d/$scr > + [ -f /env/boot/$scr ] && /env/boot/$scr > fi > > if [ -n "$dryrun" ]; then > diff --git a/defaultenv-2/base/init/general b/defaultenv-2/base/init/general > index 98a92d1..2c0bd74 100644 > --- a/defaultenv-2/base/init/general > +++ b/defaultenv-2/base/init/general > @@ -11,5 +11,5 @@ global.user=sha > # timeout in seconds before the default boot entry is started > global.autoboot_timeout=3 > > -# default boot entry (one of /env/boot/*) > +# default boot entry (one of /env/boot/*) or seq to start the sequence > global.boot.default=net > -- > 1.7.10.4 > > > _______________________________________________ > barebox mailing list > barebox@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/barebox > -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 5/5] defaultenv-2: add boot sequence 2012-08-28 8:26 ` Sascha Hauer @ 2012-09-01 12:49 ` Jean-Christophe PLAGNIOL-VILLARD 0 siblings, 0 replies; 11+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-01 12:49 UTC (permalink / raw) To: Sascha Hauer; +Cc: barebox On 10:26 Tue 28 Aug , Sascha Hauer wrote: > On Fri, Aug 24, 2012 at 06:55:13AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote: > > Boot will boot run sequentially the script in /env/boot.d > > > > if not global.boot.defaul or global.boot.defaul == seq > > start the boot sequence > > > > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> > > --- > > defaultenv-2/base/bin/boot | 52 ++++++++++++++++++++++++++++++++++++---- > > defaultenv-2/base/init/general | 2 +- > > 2 files changed, 48 insertions(+), 6 deletions(-) > > > > diff --git a/defaultenv-2/base/bin/boot b/defaultenv-2/base/bin/boot > > index 103eb87..ade555d 100644 > > --- a/defaultenv-2/base/bin/boot > > +++ b/defaultenv-2/base/bin/boot > > @@ -2,20 +2,39 @@ > > > > verbose= > > dryrun= > > +sequence= > > > > usage=" > > $0 [OPTIONS] [source]\n > > -v verbose\n > > -d dryrun\n > > -l list boot sources\n > > + -s start boot sequence in /env/boot.d/\n > > I think there should not be a dedicated option for this. Instead, it > should by default start the boot sequence. global.boot.default could > then be dropped. I was thinking about it too Best Regards, J. _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2012-09-01 12:49 UTC | newest] Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2012-08-24 4:52 [PATCH 0/5] defaultenv-2: add boot sequence Jean-Christophe PLAGNIOL-VILLARD 2012-08-24 4:55 ` [PATCH 1/5] globalbar: add inline when not enabled Jean-Christophe PLAGNIOL-VILLARD 2012-08-24 4:55 ` [PATCH 2/5] globalvar: add support to set a value to of all globalvars beginning with 'match' Jean-Christophe PLAGNIOL-VILLARD 2012-08-24 9:08 ` Roberto Nibali 2012-08-24 18:51 ` Jean-Christophe PLAGNIOL-VILLARD 2012-08-24 4:55 ` [PATCH 3/5] defaultenv-2: boot use global.linux.bootargs.dyn for dynamic globarvar Jean-Christophe PLAGNIOL-VILLARD 2012-08-24 4:55 ` [PATCH 4/5] defaultenv-2: boot reset linux.bootargs.dyn. and bootm. globarvar Jean-Christophe PLAGNIOL-VILLARD 2012-08-24 4:55 ` [PATCH 5/5] defaultenv-2: add boot sequence Jean-Christophe PLAGNIOL-VILLARD 2012-08-24 7:36 ` Roberto Nibali 2012-08-28 8:26 ` Sascha Hauer 2012-09-01 12:49 ` Jean-Christophe PLAGNIOL-VILLARD
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox