mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/7 v2] defaultenv-2: add boot sequence
@ 2012-09-05 12:25 Jean-Christophe PLAGNIOL-VILLARD
  2012-09-05 12:28 ` [PATCH 1/7] globalbar: add inline when not enabled Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 14+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-05 12:25 UTC (permalink / raw)
  To: barebox

HI,

	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 b65e60792376bb209adfa128e1783cf67af9f13b:

  defautenv: add support of symlink (2012-09-05 03:22:14 +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 15dd5521e4aeb6061ae258251967e2f89b237f5f:

  defaultenv-2: add boot sequence (2012-09-05 20:16:01 +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

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

----------------------------------------------------------------
Jean-Christophe PLAGNIOL-VILLARD (7):
      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
      echo: always allow to pass -e option
      defaultenv-2/ansi-colors: export color only if enable
      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                                        |    4 ++--
 commands/global.c                                      |   58 +++++++++++++++++++++++++++++++++++++++++++++++++++-------
 common/globalvar.c                                     |   10 ++++++++++
 defaultenv-2/base/bin/boot                             |   55 +++++++++++++++++++++++++++++++++++++++++++++++++------
 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/data/ansi-colors                     |    4 ++++
 defaultenv-2/base/init/general                         |    3 ---
 defaultenv-2/menu/menu/mainmenu                        |    4 +---
 include/globalvar.h                                    |   23 +++++++++++++++++++++++
 31 files changed, 165 insertions(+), 38 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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/7] globalbar: add inline when not enabled
  2012-09-05 12:25 [PATCH 0/7 v2] defaultenv-2: add boot sequence Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-05 12:28 ` Jean-Christophe PLAGNIOL-VILLARD
  2012-09-05 12:28   ` [PATCH 2/7] globalvar: add support to set a value to of all globalvars beginning with 'match' Jean-Christophe PLAGNIOL-VILLARD
                     ` (6 more replies)
  0 siblings, 7 replies; 14+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-05 12:28 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] 14+ messages in thread

* [PATCH 2/7] globalvar: add support to set a value to of all globalvars beginning with 'match'
  2012-09-05 12:28 ` [PATCH 1/7] globalbar: add inline when not enabled Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-05 12:28   ` Jean-Christophe PLAGNIOL-VILLARD
  2012-09-07 17:45     ` Sascha Hauer
  2012-09-05 12:28   ` [PATCH 3/7] defaultenv-2: boot use global.linux.bootargs.dyn for dynamic globarvar Jean-Christophe PLAGNIOL-VILLARD
                     ` (5 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-05 12:28 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] 14+ messages in thread

* [PATCH 3/7] defaultenv-2: boot use global.linux.bootargs.dyn for dynamic globarvar
  2012-09-05 12:28 ` [PATCH 1/7] globalbar: add inline when not enabled Jean-Christophe PLAGNIOL-VILLARD
  2012-09-05 12:28   ` [PATCH 2/7] globalvar: add support to set a value to of all globalvars beginning with 'match' Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-05 12:28   ` Jean-Christophe PLAGNIOL-VILLARD
  2012-09-07 17:48     ` Sascha Hauer
  2012-09-05 12:28   ` [PATCH 4/7] defaultenv-2: boot reset linux.bootargs.dyn. and bootm. globarvar Jean-Christophe PLAGNIOL-VILLARD
                     ` (4 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-05 12:28 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] 14+ messages in thread

* [PATCH 4/7] defaultenv-2: boot reset linux.bootargs.dyn. and bootm. globarvar
  2012-09-05 12:28 ` [PATCH 1/7] globalbar: add inline when not enabled Jean-Christophe PLAGNIOL-VILLARD
  2012-09-05 12:28   ` [PATCH 2/7] globalvar: add support to set a value to of all globalvars beginning with 'match' Jean-Christophe PLAGNIOL-VILLARD
  2012-09-05 12:28   ` [PATCH 3/7] defaultenv-2: boot use global.linux.bootargs.dyn for dynamic globarvar Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-05 12:28   ` Jean-Christophe PLAGNIOL-VILLARD
  2012-09-05 12:28   ` [PATCH 5/7] echo: always allow to pass -e option Jean-Christophe PLAGNIOL-VILLARD
                     ` (3 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-05 12:28 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] 14+ messages in thread

* [PATCH 5/7] echo: always allow to pass -e option
  2012-09-05 12:28 ` [PATCH 1/7] globalbar: add inline when not enabled Jean-Christophe PLAGNIOL-VILLARD
                     ` (2 preceding siblings ...)
  2012-09-05 12:28   ` [PATCH 4/7] defaultenv-2: boot reset linux.bootargs.dyn. and bootm. globarvar Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-05 12:28   ` Jean-Christophe PLAGNIOL-VILLARD
  2012-09-07 17:50     ` Sascha Hauer
  2012-09-05 12:28   ` [PATCH 6/7] defaultenv-2/ansi-colors: export color only if enable Jean-Christophe PLAGNIOL-VILLARD
                     ` (2 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-05 12:28 UTC (permalink / raw)
  To: barebox

This will allow to do not taint if not enabled

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 commands/echo.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/commands/echo.c b/commands/echo.c
index a19d992..566f5c2 100644
--- a/commands/echo.c
+++ b/commands/echo.c
@@ -66,11 +66,11 @@ static int do_echo(int argc, char *argv[])
 				goto no_optarg_out;
 			optind++;
 			break;
-#ifdef CONFIG_CMD_ECHO_E
 		case 'e':
+#ifdef CONFIG_CMD_ECHO_E
 			process_escape = 1;
-			break;
 #endif
+			break;
 		default:
 			goto exit_parse;
 		}
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 6/7] defaultenv-2/ansi-colors: export color only if enable
  2012-09-05 12:28 ` [PATCH 1/7] globalbar: add inline when not enabled Jean-Christophe PLAGNIOL-VILLARD
                     ` (3 preceding siblings ...)
  2012-09-05 12:28   ` [PATCH 5/7] echo: always allow to pass -e option Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-05 12:28   ` Jean-Christophe PLAGNIOL-VILLARD
  2012-09-05 12:28   ` [PATCH 7/7] defaultenv-2: add boot sequence Jean-Christophe PLAGNIOL-VILLARD
  2012-09-07 17:33   ` [PATCH 1/7] globalbar: add inline when not enabled Sascha Hauer
  6 siblings, 0 replies; 14+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-05 12:28 UTC (permalink / raw)
  To: barebox

This will allow to do not check it everywhere

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 defaultenv-2/base/data/ansi-colors |    4 ++++
 defaultenv-2/menu/menu/mainmenu    |    4 +---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/defaultenv-2/base/data/ansi-colors b/defaultenv-2/base/data/ansi-colors
index c71b6b7..6365329 100644
--- a/defaultenv-2/base/data/ansi-colors
+++ b/defaultenv-2/base/data/ansi-colors
@@ -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'
diff --git a/defaultenv-2/menu/menu/mainmenu b/defaultenv-2/menu/menu/mainmenu
index d7b0033..5bd7027 100644
--- a/defaultenv-2/menu/menu/mainmenu
+++ b/defaultenv-2/menu/menu/mainmenu
@@ -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}
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 7/7] defaultenv-2: add boot sequence
  2012-09-05 12:28 ` [PATCH 1/7] globalbar: add inline when not enabled Jean-Christophe PLAGNIOL-VILLARD
                     ` (4 preceding siblings ...)
  2012-09-05 12:28   ` [PATCH 6/7] defaultenv-2/ansi-colors: export color only if enable Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-05 12:28   ` Jean-Christophe PLAGNIOL-VILLARD
  2012-09-07 17:33   ` [PATCH 1/7] globalbar: add inline when not enabled Sascha Hauer
  6 siblings, 0 replies; 14+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-05 12:28 UTC (permalink / raw)
  To: barebox

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

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 .../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 +
 defaultenv-2/base/bin/boot                         |   51 +++++++++++++++++---
 defaultenv-2/base/init/general                     |    3 --
 13 files changed, 55 insertions(+), 12 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

diff --git a/arch/arm/boards/crystalfontz-cfa10036/env/boot.d/01 b/arch/arm/boards/crystalfontz-cfa10036/env/boot.d/01
new file mode 120000
index 0000000..1e6fecc
--- /dev/null
+++ b/arch/arm/boards/crystalfontz-cfa10036/env/boot.d/01
@@ -0,0 +1 @@
+../boot/mmc-ext3
\ No newline at end of file
diff --git a/arch/arm/boards/crystalfontz-cfa10036/env/boot.d/02 b/arch/arm/boards/crystalfontz-cfa10036/env/boot.d/02
new file mode 120000
index 0000000..70b8ea3
--- /dev/null
+++ b/arch/arm/boards/crystalfontz-cfa10036/env/boot.d/02
@@ -0,0 +1 @@
+../boot/net
\ No newline at end of file
diff --git a/arch/arm/boards/crystalfontz-cfa10036/env/boot.d/03 b/arch/arm/boards/crystalfontz-cfa10036/env/boot.d/03
new file mode 120000
index 0000000..b41f2fd
--- /dev/null
+++ b/arch/arm/boards/crystalfontz-cfa10036/env/boot.d/03
@@ -0,0 +1 @@
+../boot/initrd
\ No newline at end of file
diff --git a/arch/arm/boards/crystalfontz-cfa10036/env/init/general b/arch/arm/boards/crystalfontz-cfa10036/env/init/general
index 5cb3a75..125de5d 100644
--- a/arch/arm/boards/crystalfontz-cfa10036/env/init/general
+++ b/arch/arm/boards/crystalfontz-cfa10036/env/init/general
@@ -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
diff --git a/arch/arm/boards/freescale-mx6-sabrelite/env/boot.d/01 b/arch/arm/boards/freescale-mx6-sabrelite/env/boot.d/01
new file mode 120000
index 0000000..70b8ea3
--- /dev/null
+++ b/arch/arm/boards/freescale-mx6-sabrelite/env/boot.d/01
@@ -0,0 +1 @@
+../boot/net
\ No newline at end of file
diff --git a/arch/arm/boards/freescale-mx6-sabrelite/env/boot.d/02 b/arch/arm/boards/freescale-mx6-sabrelite/env/boot.d/02
new file mode 120000
index 0000000..b41f2fd
--- /dev/null
+++ b/arch/arm/boards/freescale-mx6-sabrelite/env/boot.d/02
@@ -0,0 +1 @@
+../boot/initrd
\ No newline at end of file
diff --git a/arch/arm/boards/pcm038/env/boot.d/01 b/arch/arm/boards/pcm038/env/boot.d/01
new file mode 120000
index 0000000..d1b275c
--- /dev/null
+++ b/arch/arm/boards/pcm038/env/boot.d/01
@@ -0,0 +1 @@
+../boot/nand-ubi
\ No newline at end of file
diff --git a/arch/arm/boards/pcm038/env/boot.d/02 b/arch/arm/boards/pcm038/env/boot.d/02
new file mode 120000
index 0000000..70b8ea3
--- /dev/null
+++ b/arch/arm/boards/pcm038/env/boot.d/02
@@ -0,0 +1 @@
+../boot/net
\ No newline at end of file
diff --git a/arch/arm/boards/pcm038/env/boot.d/03 b/arch/arm/boards/pcm038/env/boot.d/03
new file mode 120000
index 0000000..b41f2fd
--- /dev/null
+++ b/arch/arm/boards/pcm038/env/boot.d/03
@@ -0,0 +1 @@
+../boot/initrd
\ No newline at end of file
diff --git a/arch/arm/boards/tqma53/env/boot.d/01 b/arch/arm/boards/tqma53/env/boot.d/01
new file mode 120000
index 0000000..70b8ea3
--- /dev/null
+++ b/arch/arm/boards/tqma53/env/boot.d/01
@@ -0,0 +1 @@
+../boot/net
\ No newline at end of file
diff --git a/arch/arm/boards/tqma53/env/boot.d/02 b/arch/arm/boards/tqma53/env/boot.d/02
new file mode 120000
index 0000000..b41f2fd
--- /dev/null
+++ b/arch/arm/boards/tqma53/env/boot.d/02
@@ -0,0 +1 @@
+../boot/initrd
\ No newline at end of file
diff --git a/defaultenv-2/base/bin/boot b/defaultenv-2/base/bin/boot
index 103eb87..68e9e89 100644
--- a/defaultenv-2/base/bin/boot
+++ b/defaultenv-2/base/bin/boot
@@ -2,6 +2,8 @@
 
 verbose=
 dryrun=
+# ensure sequence is init at something
+sequence=t
 
 usage="
 $0 [OPTIONS] [source]\n
@@ -10,11 +12,27 @@ $0 [OPTIONS] [source]\n
  -l  list boot sources\n
  -h  help"
 
+. /env/data/ansi-colors
+
 for i in /env/boot/*; do
 	basename $i s
 	sources="$sources$s "
 done
 
+if [ -d /env/boot.d ]; then
+	sources="$sources\n\nboot sequence:"
+	for i in /env/boot.d/*; do
+		readlink -f $i s
+		basename $s link
+		basename $i s
+		sources="$sources\n ${YELLOW}${s}${NC} -> ${CYAN}${link}${NC}"
+	done
+else
+	sequence=n
+	sources="$sources\n\nboot sequence:\nnone"
+	echo "${RED}WARNING: boot sequence: none${NC}"
+fi
+
 while getopt "vdhl" opt; do
 	if [ ${opt} = v ]; then
 		if [ -n "$verbose" ]; then
@@ -23,7 +41,7 @@ while getopt "vdhl" opt; do
 			verbose="-v"
 		fi
 	elif [ ${opt} = d ]; then
-		dryrun=1
+		dryrun="-d"
 	elif [ ${opt} = l ]; then
 		echo -e "boot sources:\n$sources"
 		exit 0
@@ -37,18 +55,39 @@ done
 global -r linux.bootargs.dyn.
 global -r bootm.
 
-if [ $# = 0 ]; then
-	scr="$global.boot.default"
+if [ $# = 0 -a "x$sequence" = "xt" ]; then
+	sequence=y
 else
 	scr="$1"
 fi
 
+if [ "x$sequence" = "xy" ]; then
+	if [ ! -d /env/boot.d ]; then
+		echo -e "${GREEN}boot sequence ${RED}none${NC}"
+		exit 1
+	fi
+	echo -e "${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 -e "${msg}"
+		boot $dryrun $s
+		echo -e "${msg} ${RED}failled${NC}"
+		ret=$?
+	done
+	echo -e "${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..e7fffdd 100644
--- a/defaultenv-2/base/init/general
+++ b/defaultenv-2/base/init/general
@@ -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
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/7] globalbar: add inline when not enabled
  2012-09-05 12:28 ` [PATCH 1/7] globalbar: add inline when not enabled Jean-Christophe PLAGNIOL-VILLARD
                     ` (5 preceding siblings ...)
  2012-09-05 12:28   ` [PATCH 7/7] defaultenv-2: add boot sequence Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-07 17:33   ` Sascha Hauer
  6 siblings, 0 replies; 14+ messages in thread
From: Sascha Hauer @ 2012-09-07 17:33 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

sibject: s/globalbar/globalvar/

Sascha

On Wed, Sep 05, 2012 at 02:28:21PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> 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
> 

-- 
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] 14+ messages in thread

* Re: [PATCH 2/7] globalvar: add support to set a value to of all globalvars beginning with 'match'
  2012-09-05 12:28   ` [PATCH 2/7] globalvar: add support to set a value to of all globalvars beginning with 'match' Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-07 17:45     ` Sascha Hauer
  0 siblings, 0 replies; 14+ messages in thread
From: Sascha Hauer @ 2012-09-07 17:45 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Wed, Sep 05, 2012 at 02:28:22PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> 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)
> +{

I think globalvar_set_match would be a better name for this function
as resetting is just a special usecase.

How about changing the name and prototype of globalvar_add_simple
to:

int globalvar_set(const char *name, const char *value)

Then instead of duplicating code in the command you could do
a:

	if (match)
		globalvar_set_match(name, value);
	else
		globalvar_set(name, value);

Sascha

> +	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
> 

-- 
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] 14+ messages in thread

* Re: [PATCH 3/7] defaultenv-2: boot use global.linux.bootargs.dyn for dynamic globarvar
  2012-09-05 12:28   ` [PATCH 3/7] defaultenv-2: boot use global.linux.bootargs.dyn for dynamic globarvar Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-07 17:48     ` Sascha Hauer
  2012-09-08  5:41       ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 14+ messages in thread
From: Sascha Hauer @ 2012-09-07 17:48 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Wed, Sep 05, 2012 at 02:28:23PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> linux.bootargs.dyn.* will be clearer at the beginning of boot

By 'clearer' do you mean 'cleared'? If yes, I maybe understand the
intention of this patch.

Sascha

> 
> 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
> 

-- 
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] 14+ messages in thread

* Re: [PATCH 5/7] echo: always allow to pass -e option
  2012-09-05 12:28   ` [PATCH 5/7] echo: always allow to pass -e option Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-07 17:50     ` Sascha Hauer
  0 siblings, 0 replies; 14+ messages in thread
From: Sascha Hauer @ 2012-09-07 17:50 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Wed, Sep 05, 2012 at 02:28:25PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> This will allow to do not taint if not enabled
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  commands/echo.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/commands/echo.c b/commands/echo.c
> index a19d992..566f5c2 100644
> --- a/commands/echo.c
> +++ b/commands/echo.c
> @@ -66,11 +66,11 @@ static int do_echo(int argc, char *argv[])
>  				goto no_optarg_out;
>  			optind++;
>  			break;
> -#ifdef CONFIG_CMD_ECHO_E
>  		case 'e':
> +#ifdef CONFIG_CMD_ECHO_E
>  			process_escape = 1;

Better:
			process_escape = IS_ENABLED(CONFIG_CMD_ECHO_E);

Sascha

> -			break;
>  #endif
> +			break;
>  		default:
>  			goto exit_parse;
>  		}
> -- 
> 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] 14+ messages in thread

* Re: [PATCH 3/7] defaultenv-2: boot use global.linux.bootargs.dyn for dynamic globarvar
  2012-09-07 17:48     ` Sascha Hauer
@ 2012-09-08  5:41       ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 14+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-08  5:41 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 19:48 Fri 07 Sep     , Sascha Hauer wrote:
> On Wed, Sep 05, 2012 at 02:28:23PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > linux.bootargs.dyn.* will be clearer at the beginning of boot
> 
> By 'clearer' do you mean 'cleared'? If yes, I maybe understand the
> intention of this patch.
yes

Best Regards,
J.

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 5/7] echo: always allow to pass -e option
  2012-09-11 10:19 Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-11 10:19 ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 14+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-11 10:19 UTC (permalink / raw)
  To: barebox

This will allow to do not taint if not enabled

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 commands/echo.c |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/commands/echo.c b/commands/echo.c
index a19d992..4a5c981 100644
--- a/commands/echo.c
+++ b/commands/echo.c
@@ -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)
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2012-09-11 10:22 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-05 12:25 [PATCH 0/7 v2] defaultenv-2: add boot sequence Jean-Christophe PLAGNIOL-VILLARD
2012-09-05 12:28 ` [PATCH 1/7] globalbar: add inline when not enabled Jean-Christophe PLAGNIOL-VILLARD
2012-09-05 12:28   ` [PATCH 2/7] globalvar: add support to set a value to of all globalvars beginning with 'match' Jean-Christophe PLAGNIOL-VILLARD
2012-09-07 17:45     ` Sascha Hauer
2012-09-05 12:28   ` [PATCH 3/7] defaultenv-2: boot use global.linux.bootargs.dyn for dynamic globarvar Jean-Christophe PLAGNIOL-VILLARD
2012-09-07 17:48     ` Sascha Hauer
2012-09-08  5:41       ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-05 12:28   ` [PATCH 4/7] defaultenv-2: boot reset linux.bootargs.dyn. and bootm. globarvar Jean-Christophe PLAGNIOL-VILLARD
2012-09-05 12:28   ` [PATCH 5/7] echo: always allow to pass -e option Jean-Christophe PLAGNIOL-VILLARD
2012-09-07 17:50     ` Sascha Hauer
2012-09-05 12:28   ` [PATCH 6/7] defaultenv-2/ansi-colors: export color only if enable Jean-Christophe PLAGNIOL-VILLARD
2012-09-05 12:28   ` [PATCH 7/7] defaultenv-2: add boot sequence Jean-Christophe PLAGNIOL-VILLARD
2012-09-07 17:33   ` [PATCH 1/7] globalbar: add inline when not enabled Sascha Hauer
2012-09-11 10:19 Jean-Christophe PLAGNIOL-VILLARD
2012-09-11 10:19 ` [PATCH 5/7] echo: always allow to pass -e option 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