defaultenv-2: add boot sequence
v4 cover defaultenv-2: add boot sequence
HI,
v4:
update boot script
v3:
update comments
v2:
drop global.boot.default as we start the boot sequence by default update ansi-colors
allow to always pass -e to echo
this patch series depends on fs-symlink send previously
please pull
The following changes since commit 8b3bf5971afbdf1acc5becabb6f15ba4b2a5559d:
tap: fix missing parent setting on eth_device (2012-09-12 17:26:26 +0200)
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 0e955747dcc3b0b6941157b664ee4fdcf3267124:
defaultenv-2: add boot sequence (2012-09-14 01:22:02 +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
drop global.boot.default
start the boot sequence by default
----------------------------------------------------------------
Jean-Christophe PLAGNIOL-VILLARD (7):
globalvar: add inline when not enabled
echo: always allow to pass -e option
defaultenv-2/ansi-colors: export color only if enable
globalvar: add support to set a value to of all globalvars beginning with 'match'
defaultenv-2: boot use global.linux.bootargs.dyn for dynamic globalvar
defaultenv-2: boot reset linux.bootargs.dyn. and bootm. globalvar
defaultenv-2: add boot sequence
arch/arm/boards/crystalfontz-cfa10036/env/boot.d/01 | 1 + arch/arm/boards/crystalfontz-cfa10036/env/boot.d/02 | 1 + arch/arm/boards/crystalfontz-cfa10036/env/boot.d/03 | 1 + arch/arm/boards/crystalfontz-cfa10036/env/init/general | 3 --- arch/arm/boards/freescale-mx6-sabrelite/env/boot.d/01 | 1 + arch/arm/boards/freescale-mx6-sabrelite/env/boot.d/02 | 1 + arch/arm/boards/pcm038/env/boot.d/01 | 1 + arch/arm/boards/pcm038/env/boot.d/02 | 1 + arch/arm/boards/pcm038/env/boot.d/03 | 1 + arch/arm/boards/tqma53/env/boot.d/01 | 1 + arch/arm/boards/tqma53/env/boot.d/02 | 1 + commands/echo.c | 12 ++++-------- commands/global.c | 51 ++++++++++++++++++++++++++++++++++++++++----------- common/Kconfig | 2 ++ common/globalvar.c | 10 ++++++++++ defaultenv-2/base/bin/boot | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++--------- 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 | 6 +++--- defaultenv-2/base/boot/initrd | 2 +- defaultenv-2/base/data/ansi-colors | 4 ++++ defaultenv-2/base/init/general | 3 --- defaultenv-2/menu/menu/boot-entries-collect | 6 +----- defaultenv-2/menu/menu/mainmenu | 4 +--- include/globalvar.h | 23 +++++++++++++++++++++++ 33 files changed, 162 insertions(+), 57 deletions(-) create mode 120000 arch/arm/boards/crystalfontz-cfa10036/env/boot.d/01 create mode 120000 arch/arm/boards/crystalfontz-cfa10036/env/boot.d/02 create mode 120000 arch/arm/boards/crystalfontz-cfa10036/env/boot.d/03 create mode 120000 arch/arm/boards/freescale-mx6-sabrelite/env/boot.d/01 create mode 120000 arch/arm/boards/freescale-mx6-sabrelite/env/boot.d/02 create mode 120000 arch/arm/boards/pcm038/env/boot.d/01 create mode 120000 arch/arm/boards/pcm038/env/boot.d/02 create mode 120000 arch/arm/boards/pcm038/env/boot.d/03 create mode 120000 arch/arm/boards/tqma53/env/boot.d/01 create mode 120000 arch/arm/boards/tqma53/env/boot.d/02
Best Regards,
J.
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH v4 1/7 globalvar: add inline when not enabled
--- include/globalvar.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
include/globalvar.h +20 -0
@@ -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 */
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v4 2/7 echo: always allow to pass -e option
This will allow to do not taint if not enabled
--- commands/echo.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
commands/echo.c +4 -8
@@ -33,10 +33,9 @@ static int do_echo(int argc, char *argv[])int fd = stdout, opt, newline =1 ;char *file =NULL ;int oflags =O_WRONLY |O_CREAT ; -#ifdef CONFIG_CMD_ECHO_E char str[CONFIG_CBSIZE ];int process_escape =0 ; -#endif +/* We can't use getopt() here because we want to * echo all things we don't understand. */
@@ -66,11 +65,9 @@ static int do_echo(int argc, char *argv[]) goto no_optarg_out; optind++;break ; -#ifdef CONFIG_CMD_ECHO_E case 'e' : - process_escape =1 ; + process_escape =IS_ENABLED (CONFIG_CMD_ECHO_E );break ; -#endif default : goto exit_parse; }
@@ -89,13 +86,12 @@ exit_parse:for (i = optind; i < argc; i++) {if (i > optind)fputc (fd,' ' ); -#ifdef CONFIG_CMD_ECHO_E if (process_escape) {process_escape_sequence (argv[i], str,CONFIG_CBSIZE );fputs (fd, str); - } else -#endif + }else {fputs (fd, argv[i]); + } }if (newline)
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v4 3/7 defaultenv-2/ansi-colors: export color only if enable
In reply to Jean-Christophe PLAGNIOL-VILLARDThis will allow to do not check it everywhere
--- defaultenv-2/base/data/ansi-colors | 4 ++++ defaultenv-2/menu/menu/mainmenu | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-)
defaultenv-2/base/data/ansi-colors +4 -0
@@ -1,5 +1,9 @@ #!/bin/sh +if [ ${global.allow_color} != "true" ]; then + exit +fi + # Colors export RED='\e[1;31m' export BLUE='\e[1;34m'
defaultenv-2/menu/menu/mainmenu +1 -3
@@ -3,9 +3,7 @@ savepath=$PATH export menupath=$PATH:/env/menu -if [ ${global.allow_color} = "true" ]; then - . /env/data/ansi-colors -fi +. /env/data/ansi-colors while true; do export PATH=${menupath}
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v4 4/7 globalvar: add support to set a value to of all globalvars beginning with 'match'
In reply to Jean-Christophe PLAGNIOL-VILLARDvia c global_set_match and global -r
--- commands/global.c | 51 ++++++++++++++++++++++++++++++++++++++++----------- common/globalvar.c | 10 ++++++++++ include/globalvar.h | 3 +++ 3 files changed, 53 insertions(+), 11 deletions(-)
commands/global.c +40 -11
@@ -24,39 +24,68 @@#include <command.h> #include <globalvar.h> #include <environment.h> +#include <getopt.h> -static int do_global (int argc,char *argv[]) +static int globalvar_set (char * name,char * value) {int ret; + + ret =globalvar_add_simple (name); + +if (value) { +char *tmp =asprintf ("global.%s" , name); + ret =setenv (tmp, value); +free (tmp); + } + +return ret ?1 :0 ; +} + +static int do_global (int argc,char *argv[]) +{ +int opt; +int do_set_match =0 ;char *value; -if (argc !=2 ) +while ((opt =getopt (argc, argv,"r" )) >0 ) { +switch (opt) { +case 'r' : + do_set_match =1 ; +break ; + } + } + + argc -= optind; + argv += optind; + +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 ]); +if (do_set_match) { +if (!value) + value ="" ; -if (value) { -char *name =asprintf ("global.%s" , argv[1 ]); - ret =setenv (name, value); -free (name); +globalvar_set_match (argv[0 ], value); +return 0 ; } -return ret ?1 :0 ; +return globalvar_set (argv[0 ], value); } 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 set global variables", BAREBOX_CMD_HELP(cmd_global_help) BAREBOX_CMD_END
common/globalvar.c +10 -0
@@ -46,6 +46,16 @@ char *globalvar_get_match(const char *match, const char *seperator)return val; } +void globalvar_set_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 *
include/globalvar.h +3 -0
@@ -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_set_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_set_match (const char *match,const char *val) {}#endif #endif /* __GLOBALVAR_H */
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v4 5/7 defaultenv-2: boot use global.linux.bootargs.dyn for dynamic globalvar
In reply to Jean-Christophe PLAGNIOL-VILLARDlinux.bootargs.dyn.* will be cleared at the beginning of boot
This is need for boot sequence to do not have the previous boot param.
--- 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(-)
defaultenv-2/base/bin/bootargs-ip +2 -2
@@ -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
defaultenv-2/base/bin/bootargs-ip-barebox +1 -1
@@ -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:"
defaultenv-2/base/bin/bootargs-ip-dhcp +1 -1
@@ -2,4 +2,4 @@ # Do dhcp in Linux -global.linux.bootargs.ip="ip=dhcp" +global.linux.bootargs.dyn.ip="ip=dhcp"
defaultenv-2/base/bin/bootargs-ip-none +1 -1
@@ -2,4 +2,4 @@ # disable ip setup in Linux -global.linux.bootargs.ip="ip=none" +global.linux.bootargs.dyn.ip="ip=none"
defaultenv-2/base/bin/bootargs-root-disk +1 -1
@@ -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"
defaultenv-2/base/bin/bootargs-root-ext +1 -1
@@ -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"
defaultenv-2/base/bin/bootargs-root-initrd +1 -1
@@ -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}"
defaultenv-2/base/bin/bootargs-root-jffs2 +1 -1
@@ -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"
defaultenv-2/base/bin/bootargs-root-nfs +1 -1
@@ -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"
defaultenv-2/base/bin/bootargs-root-ubi +1 -1
@@ -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"
defaultenv-2/base/bin/init +3 -2
@@ -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
defaultenv-2/base/boot/initrd +1 -1
@@ -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>
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v4 6/7 defaultenv-2: boot reset linux.bootargs.dyn. and bootm. globalvar
In reply to Jean-Christophe PLAGNIOL-VILLARDThis is need for boot sequence to do not have the previous boot param.
--- defaultenv-2/base/bin/boot | 4 ++++ 1 file changed, 4 insertions(+)
defaultenv-2/base/bin/boot +4 -0
@@ -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
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v4 7/7 defaultenv-2: add boot sequence
In reply to Jean-Christophe PLAGNIOL-VILLARDBoot will boot run sequentially the script in /env/boot.d
drop global.boot.default as we start the boot sequence by default
update the current board using the defaultenv-2 at the sametime
--- .../arm/boards/crystalfontz-cfa10036/env/boot.d/01 | 1 + .../arm/boards/crystalfontz-cfa10036/env/boot.d/02 | 1 + .../arm/boards/crystalfontz-cfa10036/env/boot.d/03 | 1 + .../boards/crystalfontz-cfa10036/env/init/general | 3 -- .../boards/freescale-mx6-sabrelite/env/boot.d/01 | 1 + .../boards/freescale-mx6-sabrelite/env/boot.d/02 | 1 + arch/arm/boards/pcm038/env/boot.d/01 | 1 + arch/arm/boards/pcm038/env/boot.d/02 | 1 + arch/arm/boards/pcm038/env/boot.d/03 | 1 + arch/arm/boards/tqma53/env/boot.d/01 | 1 + arch/arm/boards/tqma53/env/boot.d/02 | 1 + common/Kconfig | 2 + defaultenv-2/base/bin/boot | 57 ++++++++++++++++---- defaultenv-2/base/bin/init | 1 - defaultenv-2/base/init/general | 3 -- defaultenv-2/menu/menu/boot-entries-collect | 6 +-- 16 files changed, 61 insertions(+), 21 deletions(-) create mode 120000 arch/arm/boards/crystalfontz-cfa10036/env/boot.d/01 create mode 120000 arch/arm/boards/crystalfontz-cfa10036/env/boot.d/02 create mode 120000 arch/arm/boards/crystalfontz-cfa10036/env/boot.d/03 create mode 120000 arch/arm/boards/freescale-mx6-sabrelite/env/boot.d/01 create mode 120000 arch/arm/boards/freescale-mx6-sabrelite/env/boot.d/02 create mode 120000 arch/arm/boards/pcm038/env/boot.d/01 create mode 120000 arch/arm/boards/pcm038/env/boot.d/02 create mode 120000 arch/arm/boards/pcm038/env/boot.d/03 create mode 120000 arch/arm/boards/tqma53/env/boot.d/01 create mode 120000 arch/arm/boards/tqma53/env/boot.d/02
arch/arm/boards/crystalfontz-cfa10036/env/boot.d/01 new file +1 -0
@@ -0,0 +1 @@ +../boot/mmc-ext3
arch/arm/boards/crystalfontz-cfa10036/env/boot.d/02 new file +1 -0
@@ -0,0 +1 @@ +../boot/net
arch/arm/boards/crystalfontz-cfa10036/env/boot.d/03 new file +1 -0
@@ -0,0 +1 @@ +../boot/initrd
arch/arm/boards/crystalfontz-cfa10036/env/init/general +0 -3
@@ -7,6 +7,3 @@ fi # timeout in seconds before the default boot entry is started global.autoboot_timeout=3 - -# default boot entry (one of /env/boot/*) -global.boot.default=mmc-ext3
arch/arm/boards/freescale-mx6-sabrelite/env/boot.d/01 new file +1 -0
@@ -0,0 +1 @@ +../boot/net
arch/arm/boards/freescale-mx6-sabrelite/env/boot.d/02 new file +1 -0
@@ -0,0 +1 @@ +../boot/initrd
arch/arm/boards/pcm038/env/boot.d/01 new file +1 -0
@@ -0,0 +1 @@ +../boot/nand-ubi
arch/arm/boards/pcm038/env/boot.d/02 new file +1 -0
@@ -0,0 +1 @@ +../boot/net
arch/arm/boards/pcm038/env/boot.d/03 new file +1 -0
@@ -0,0 +1 @@ +../boot/initrd
arch/arm/boards/tqma53/env/boot.d/01 new file +1 -0
@@ -0,0 +1 @@ +../boot/net
arch/arm/boards/tqma53/env/boot.d/02 new file +1 -0
@@ -0,0 +1 @@ +../boot/initrd
common/Kconfig +2 -0
@@ -563,6 +563,8 @@ config DEFAULT_ENVIRONMENT_GENERIC_NEW select CMD_GLOBAL select CMD_AUTOMOUNT select CMD_BASENAME + select CMD_READLINK + select CMD_DIRNAME select FLEXIBLE_BOOTARGS prompt "Generic environment template"
defaultenv-2/base/bin/boot +48 -9
84 lines not on this page · raw message
defaultenv-2/base/bin/init +0 -1
@@ -5,7 +5,6 @@ export PATH=/env/bin global hostname=generic global user=none global autoboot_timeout=3 -global boot.default=net global allow_color=true global linux.bootargs.base #linux.bootargs.dyn.* will be clearer at the beginning of boot
defaultenv-2/base/init/general +0 -3
@@ -10,6 +10,3 @@ global.user=sha # timeout in seconds before the default boot entry is started global.autoboot_timeout=3 - -# default boot entry (one of /env/boot/*) -global.boot.default=net
defaultenv-2/menu/menu/boot-entries-collect +1 -5
@@ -2,12 +2,8 @@ cd /env/boot -./$global.boot.default menu - for i in *; do - if [ "$i" != "$global.boot.default" ]; then - ./$i menu - fi + ./$i menu done cd /
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Quoted 6 lines · Jean-Christophe PLAGNIOL-VILLARD
Boot will boot run sequentially the script in /env/boot.d
drop global.boot.default as we start the boot sequence by default
update the current board using the defaultenv-2 at the sametime
I'm going to drop this one in its current form.
The way it is written is just too confusing. We have a sequence=[y|n] which is set in multiple places, then after evaluating 60 lines of shell code the script eventually may call itself, which again sets sequence to other values.
Currently my babbage board (which appearantly does not have links in /env/boot.d comes up with:
Quoted 7 lines
WARNING: boot sequence: none
booting
/env/boot/ or /env/boot.d/ does not exist. Valid choices:
initrd netboot sequence:
none
This gives not much clue what is wrong and what has to be done next.
The recursive call to itself makes the script unmaintainable and error prone.
The boot sequence feature per se is ok and it's good to have, but the implementation currently is not good.
It would be much better to separate the boot script from a script running a boot sequence. That way the boot script can have a clear set of parameters and is responsible for only booting a single source. Then a boot-sequence script again can have a clear set of options and has the only responsibility of iterating over the available sources.
I think many usecases do not require a boot sequence. For example if I want to boot from network it won't help me if the board boots from flash instead due to some network error. That's why I think users not wanting a boot sequence should be bothered with this as little as possible. This could be solved by keeping the boot script like it is and move the sequence stuff out to another script.
Look at documenting what the script does:
boot [method]: Boot a system using /env/boot/[method]
boot-sequence: Boot a system by iterating over /env/boot.d/* until
one succeeds.
Now with both combined in a single script:
boot [method]: If called without method, it will iterate over
/env/boot.d/*. If that directory does not exist, it will fall back to a single boot source, which you haven't specified, so the script will complain. If you give [method], that will be one of /env/boot/[method] or /env/boot.d/[method]. If [method] exists in both directories, the behaviour will be unspecified.
Another thing is that I do not have a good feeling about putting soft links into the repository. I can't really give any concrete problems with it, it just don't feels good to use such a feature which other version control systems or filesystems do not support
Sascha
Signature · 9 lines
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 [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Quoted 55 lines · Sascha Hauer
Quoted 6 lines · Jean-Christophe PLAGNIOL-VILLARD
Boot will boot run sequentially the script in /env/boot.d
drop global.boot.default as we start the boot sequence by default
update the current board using the defaultenv-2 at the sametime
I'm going to drop this one in its current form.
The way it is written is just too confusing. We have a sequence=[y|n] which is set in multiple places, then after evaluating 60 lines of shell code the script eventually may call itself, which again sets sequence to other values.
Currently my babbage board (which appearantly does not have links in /env/boot.d comes up with:
Quoted 7 lines
WARNING: boot sequence: none
booting
/env/boot/ or /env/boot.d/ does not exist. Valid choices:
initrd netboot sequence:
noneThis gives not much clue what is wrong and what has to be done next.
The recursive call to itself makes the script unmaintainable and error prone.
The boot sequence feature per se is ok and it's good to have, but the implementation currently is not good.
It would be much better to separate the boot script from a script running a boot sequence. That way the boot script can have a clear set of parameters and is responsible for only booting a single source. Then a boot-sequence script again can have a clear set of options and has the only responsibility of iterating over the available sources.
I think many usecases do not require a boot sequence. For example if I want to boot from network it won't help me if the board boots from flash instead due to some network error. That's why I think users not wanting a boot sequence should be bothered with this as little as possible. This could be solved by keeping the boot script like it is and move the sequence stuff out to another script.
Look at documenting what the script does:
boot [method]: Boot a system using /env/boot/[method]
boot-sequence: Boot a system by iterating over /env/boot.d/* until
one succeeds.Now with both combined in a single script:
Quoted 7 lines
boot [method]: If called without method, it will iterate over
/env/boot.d/*. If that directory does not exist, it will fall back to a single boot source, which you haven't specified, so the script will complain. If you give [method], that will be one of /env/boot/[method] or /env/boot.d/[method]. If [method] exists in both directories, the behaviour will be unspecified.
This was your request to do this this way
THe first version was keeping the old boot.default and ask you to enable the boot sequence specifycally and then you ask me to drop this to make the boot sequence by default
so now I've hardware ready to be send on the way with this next with boot sequence mandatory
so I do not think we drop it we can update it but not drop it
Quoted 5 lines
Another thing is that I do not have a good feeling about putting soft links into the repository. I can't really give any concrete problems with it, it just don't feels good to use such a feature which other version control systems or filesystems do not support
none of the scm or fs we known does not support this
except window stuff and common it's windows
Best Regards,
J.
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Quoted 10 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 8 lines · Sascha Hauer
boot [method]: If called without method, it will iterate over
/env/boot.d/*. If that directory does not exist, it will fall back to a single boot source, which you haven't specified, so the script will complain. If you give [method], that will be one of /env/boot/[method] or /env/boot.d/[method]. If [method] exists in both directories, the behaviour will be unspecified.This was your request to do this this way
Whatever I said, until recently I haven't even noticed that this script recursively calls itself. I also did not realize that this script intermixed two completely different things with 10 lines boot sequence, 10 lines not and then 10 lines maybe boot sequence.
Quoted 7 lines
THe first version was keeping the old boot.default and ask you to enable the boot sequence specifycally and then you ask me to drop this to make the boot sequence by default
so now I've hardware ready to be send on the way with this next with boot sequence mandatory
The -next branch is explicitly declared non stable. You shouldn't ship prerelease software and expect that it doesn't change.
Sascha
Signature · 9 lines
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 [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Quoted 23 lines · Sascha Hauer
Quoted 10 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 8 lines · Sascha Hauer
boot [method]: If called without method, it will iterate over
/env/boot.d/*. If that directory does not exist, it will fall back to a single boot source, which you haven't specified, so the script will complain. If you give [method], that will be one of /env/boot/[method] or /env/boot.d/[method]. If [method] exists in both directories, the behaviour will be unspecified.This was your request to do this this way
Whatever I said, until recently I haven't even noticed that this script recursively calls itself. I also did not realize that this script intermixed two completely different things with 10 lines boot sequence, 10 lines not and then 10 lines maybe boot sequence.
Quoted 5 lines
THe first version was keeping the old boot.default and ask you to enable the boot sequence specifycally and then you ask me to drop this to make the boot sequence by default
Quoted 5 lines
Quoted 2 lines
so now I've hardware ready to be send on the way with this next with boot sequence mandatory
The -next branch is explicitly declared non stable. You shouldn't ship prerelease software and expect that it doesn't change.
with the tag next-stable expect so
we need to put some rules so the next does not end up with a I apply but will see if used specially 6 days to the release
Best Regards,
J.
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox