Skip to contentSkip to conversation

defaultenv-2: add boot sequence

PATCH In review Jean-Christophe PLAGNIOL-VILLARD 2 participants 2 messages Feb 15, 2013 – Feb 18, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 defaultenv-2: add boot sequence

Boot will boot run sequentially the script in /env/boot.d

if not global.boot.default or global.boot.default == seq or -s is sepecified
start the boot sequence

we do not boot the boot sequence by default t keep retro compatibility

---
 common/Kconfig                              |    2 +
 defaultenv-2/base/bin/_boot                 |   42 +++++++++++++++
 defaultenv-2/base/bin/boot                  |   78 ++++++++++++++++++++-------
 defaultenv-2/menu/menu/boot-entries-collect |    6 +--
 4 files changed, 104 insertions(+), 24 deletions(-)
 create mode 100644 defaultenv-2/base/bin/_boot
common/Kconfig +2 -0
index 3a55e01..683460b 100644
@@ -532,6 +532,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 new file +42 -0

42 lines not on this page · raw message

defaultenv-2/base/bin/boot +59 -19

112 lines not on this page · raw message

defaultenv-2/menu/menu/boot-entries-collect +1 -5
index c066c93..b0d3d9f 100644
@@ -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
#1 lore raw
Quoted 7 lines · Jean-Christophe PLAGNIOL-VILLARD

Boot will boot run sequentially the script in /env/boot.d

if not global.boot.default or global.boot.default == seq or -s is sepecified
start the boot sequence

we do not boot the boot sequence by default t keep retro compatibility

This patch is too big, does multiple things and it's not clear to me how it's supposed to work. Trying it resulted in error messages from the basename command.

I also don't understand why you want to implement this using links which makes the whole stuff very complicated. Why don't you just allow to pass in multiple boot sources?

The following is not ready to be committed, but it should be able to boot in a sequence in a much more straight forward way.

Sascha

8<------------------------------------------------

From 656303af01f9a686aa33bbe353aff5d9ab5d58a5 Mon Sep 17 00:00:00 2001
From: Sascha Hauer <[email protected]>
Date: Mon, 18 Feb 2013 10:52:36 +0100
Subject: [PATCH] add bootsequence support

---
 common/hush.c              |   21 +++++++++++++++++++++
 defaultenv-2/base/bin/boot |   28 +++++++++++++++-------------
 2 files changed, 36 insertions(+), 13 deletions(-)
common/hush.c +21 -0
index 1f468f6..2d52372 100644
@@ -335,6 +335,19 @@ static int b_addchr(o_string *o, int ch)
 	return 0;
 }
 
+static int b_addstr(o_string *o, const char *str)
+{
+	int ret;
+
+	while (*str) {
+		ret = b_addchr(o, *str++);
+		if (ret)
+			return ret;
+	}
+
+	return 0;
+}
+
 static void b_reset(o_string *o)
 {
 	o->length = 0;
@@ -1406,6 +1419,14 @@ static int handle_dollar(o_string *dest, struct p_context *ctx, struct in_str *i
 			}
 			b_addchr(dest, SPECIAL_VAR_SYMBOL);
 			break;
+		case '*':
+			for (i = 1; i < ctx->global_argc; i++) {
+				b_addstr(dest, ctx->global_argv[i]);
+				b_addchr(dest, ' ');
+			}
+
+			advance = 1;
+			break;
 		default:
 			b_addchr(dest, '$');
 		}
defaultenv-2/base/bin/boot +15 -13
index ebbd951..d5cae0f 100644
@@ -33,26 +33,28 @@ 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
-	scr="$1"
+	scr="$*"
 fi
 
-if [ -n "$scr" ]; then
-	if [ ! -f /env/boot/$scr ]; then
+for i in $scr; do
+	echo $i
+
+	# clear linux.bootargs.dyn.* and bootm.*
+	global -r linux.bootargs.dyn.
+	global -r bootm.
+
+	if [ ! -f /env/boot/$i ]; then
 		echo -e "/env/boot/$scr does not exist. Valid choices:\n$sources"
 		exit
 	fi
-	/env/boot/$scr
-fi
+	/env/boot/$i
 
-if [ -n "$dryrun" ]; then
-	exit 0
-fi
+	if [ -n "$dryrun" ]; then
+		exit 0
+	fi
 
-bootm $verbose
+	bootm $verbose
+done
Signature · 12 lines
1.7.10.4

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