Skip to contentSkip to conversation

bootdelay can be an environemt variable

PATCH New Matthias Weisser 2 participants 4 messages Apr 27, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bootdelay can be an environemt variable

This patch allows the bootdelay variable contain the name of another variable holding the actual bootdelay value.

---
 common/main.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
common/main.c +8 -1
index f7e7c1c..f43802c 100644
@@ -371,7 +371,14 @@ void main_loop (void)
 
 #if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0)
 	s = getenv ("bootdelay");
-	bootdelay = s ? (int)simple_strtol(s, NULL, 10) : CONFIG_BOOTDELAY;
+	if (s != NULL) {
+		char *v = getenv (s);
+		if (v != NULL)
+			bootdelay = (int)simple_strtol(v, NULL, 10);
+		else
+			bootdelay = (int)simple_strtol(s, NULL, 10);
+	} else
+		bootdelay = CONFIG_BOOTDELAY;
 
 	debug ("### main_loop entered: bootdelay=%d\n\n", bootdelay);
 
Signature · 1 line
1.5.6.3
#1 lore raw

PATCH 1/1 bootdelay can be an environemt variable

Dear Matthias Weisser,

Quoted 2 lines · In message <[email protected]> you wrote:

This patch allows the bootdelay variable contain the name of another variable holding the actual bootdelay value.

Why make the "bootdelay" variable in any way special, compared to all other variables? Such inconsistent handling makes no sense to me and will only confuse users (not to mentiuon that you don't even attempt to document the change).

NAK.

If you need any such evaluation, then perform it for example as part of a PREBOOT command. This allows you to do the same thing, in a clean way.

Best regards,

Wolfgang Denk

Signature · 7 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The word "fit", as I understand it, means "appropriate to a purpose",
and I would say the body of the Dean is supremely appropriate to  the
purpose of sitting around all day and eating big heavy meals.
                                 - Terry Pratchett, _Moving Pictures_
#2 lore raw

PATCH 1/1 bootdelay can be an environemt variable

Am 27.04.2010 10:19, schrieb Wolfgang Denk:

Quoted 11 lines

Dear Matthias Weisser,

Quoted 2 lines · In message<[email protected]> you wrote:

This patch allows the bootdelay variable contain the name of another variable holding the actual bootdelay value.

Why make the "bootdelay" variable in any way special, compared to all other variables? Such inconsistent handling makes no sense to me and will only confuse users (not to mentiuon that you don't even attempt to document the change).

Quoted 5 lines

NAK.

If you need any such evaluation, then perform it for example as part of a PREBOOT command. This allows you to do the same thing, in a clean way.

It was an attempt to get the bootdelay in an environment variable which can be overridden by board specific code.

With this I tried to follow your suggestion in
http://lists.denx.de/pipermail/u-boot/2010-April/070431.html where you NAKed the direct override of bootdelay in board_late_init. So, currently my setup is:

bootdelay=gs_bootdelay

and in board.c I set gs_bootdelay according to some GPIO states. Another user of the board could simply change bootdelay to an integer and get rid of the boards behavior.

I don't see a way to achieve this with a PREBOOT command.

Is there a way that you accept the patch if I add a sentence or two to the README?

Regards,
Matthias

#3 lore raw

PATCH 1/1 bootdelay can be an environemt variable

Dear Matthias Wei?er,

Quoted 3 lines · In message <[email protected]> you wrote:

It was an attempt to get the bootdelay in an environment variable which can be overridden by board specific code.

You can #define BOOTDELAY in your board config file ?

Quoted 4 lines

With this I tried to follow your suggestion in
http://lists.denx.de/pipermail/u-boot/2010-April/070431.html where you NAKed the direct override of bootdelay in board_late_init. So, currently my setup is:

Please re-read the thread. What I NAKed was changes that introduce unexpected behaviour that cannot even be undone by the end user.

Quoted 7 lines

bootdelay=gs_bootdelay

and in board.c I set gs_bootdelay according to some GPIO states. Another user of the board could simply change bootdelay to an integer and get rid of the boards behavior.

I don't see a way to achieve this with a PREBOOT command.

Define for example

setenv short_delay 'setenv bootdelay 1'
setenv long_delay 'setenv bootdelay 10'

In your board code you can for example

setenv preboot run long_delay
or
setenv preboot run short_delay

or similar.

Of course you could even generalize this approach and make it fully flexible; see for example the code to handle programmable keyboard commands descrived in board/lwmon/README.keybd

Quoted 2 lines

Is there a way that you accept the patch if I add a sentence or two to the README?

No chance, sorry.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Backed up the system lately?