All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] bootdelay can be an environemt variable
@ 2010-04-27  6:13 Matthias Weisser
  2010-04-27  8:19 ` Wolfgang Denk
  0 siblings, 1 reply; 4+ messages in thread
From: Matthias Weisser @ 2010-04-27  6:13 UTC (permalink / raw)
  To: u-boot

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

Signed-off-by: Matthias Weisser <weisserm@arcor.de>
---
 common/main.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/common/main.c b/common/main.c
index f7e7c1c..f43802c 100644
--- a/common/main.c
+++ b/common/main.c
@@ -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);
 
-- 
1.5.6.3

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

* [U-Boot] [PATCH] bootdelay can be an environemt variable
  2010-04-27  6:13 [U-Boot] [PATCH] bootdelay can be an environemt variable Matthias Weisser
@ 2010-04-27  8:19 ` Wolfgang Denk
  2010-04-27  9:31   ` Matthias Weißer
  0 siblings, 1 reply; 4+ messages in thread
From: Wolfgang Denk @ 2010-04-27  8:19 UTC (permalink / raw)
  To: u-boot

Dear Matthias Weisser,

In message <1272348834-30161-1-git-send-email-weisserm@arcor.de> 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

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

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

* [U-Boot] [PATCH] bootdelay can be an environemt variable
  2010-04-27  8:19 ` Wolfgang Denk
@ 2010-04-27  9:31   ` Matthias Weißer
  2010-04-27 10:24     ` Wolfgang Denk
  0 siblings, 1 reply; 4+ messages in thread
From: Matthias Weißer @ 2010-04-27  9:31 UTC (permalink / raw)
  To: u-boot

Am 27.04.2010 10:19, schrieb Wolfgang Denk:
> Dear Matthias Weisser,
>
> In message<1272348834-30161-1-git-send-email-weisserm@arcor.de>  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.

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

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

* [U-Boot] [PATCH] bootdelay can be an environemt variable
  2010-04-27  9:31   ` Matthias Weißer
@ 2010-04-27 10:24     ` Wolfgang Denk
  0 siblings, 0 replies; 4+ messages in thread
From: Wolfgang Denk @ 2010-04-27 10:24 UTC (permalink / raw)
  To: u-boot

Dear Matthias Wei?er,

In message <4BD6AEF4.7080107@arcor.de> 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 ? 

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

> 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

> 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

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

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

end of thread, other threads:[~2010-04-27 10:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-27  6:13 [U-Boot] [PATCH] bootdelay can be an environemt variable Matthias Weisser
2010-04-27  8:19 ` Wolfgang Denk
2010-04-27  9:31   ` Matthias Weißer
2010-04-27 10:24     ` Wolfgang Denk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.