diff mbox

[U-Boot,24/30] km/common: add pnvramsize to default environment

Message ID ba20e078a0b5ac55510f321b282dbff192ffba15.1302272395.git.valentin.longchamp@keymile.com
State Superseded
Headers show

Commit Message

Valentin Longchamp April 8, 2011, 2:24 p.m. UTC
From: Holger Brunck <holger.brunck@keymile.com>

The pnvram size was used later from start scripts in linux. Therefore
it must be set inside u-boot.

Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
Acked-by: Heiko Schocher <hs@denx.de>
cc: Wolfgang Denk <wd@denx.de>
cc: Detlev Zundel <dzu@denx.de>
cc: Valentin Longchamp <valentin.longchamp@keymile.com>
Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>
---
 board/keymile/common/common.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Comments

Wolfgang Denk April 30, 2011, 8:32 a.m. UTC | #1
Dear Valentin Longchamp,

In message <ba20e078a0b5ac55510f321b282dbff192ffba15.1302272395.git.valentin.longchamp@keymile.com> you wrote:
> From: Holger Brunck <holger.brunck@keymile.com>
> 
> The pnvram size was used later from start scripts in linux. Therefore
> it must be set inside u-boot.

How does this work?  A plain setenv() here just adds an entry to the
hash table where U-Boot stores the variables.  This data is not
accessable in Linux ("start scripts in linux" being init scripts?)

Best regards,

Wolfgang Denk
Holger Brunck May 2, 2011, 7:41 a.m. UTC | #2
Hi Mr. Denk,

On 04/30/2011 10:32 AM, Wolfgang Denk wrote:
> Dear Valentin Longchamp,
> 
> In message <ba20e078a0b5ac55510f321b282dbff192ffba15.1302272395.git.valentin.longchamp@keymile.com> you wrote:
>> From: Holger Brunck <holger.brunck@keymile.com>
>>
>> The pnvram size was used later from start scripts in linux. Therefore
>> it must be set inside u-boot.
> 
> How does this work?  A plain setenv() here just adds an entry to the
> hash table where U-Boot stores the variables.  This data is not
> accessable in Linux ("start scripts in linux" being init scripts?)
> 

Argh. Good catch. It actually works because we do initially one time a saveenv
when we start a boot with the "release environment". But it isn't good to be
dependent to a previously saveenv. I will remove it there and add this variable
to the default environment.

Best regards
Holger Brunck
diff mbox

Patch

diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c
index 72278a0..da73f66 100644
--- a/board/keymile/common/common.c
+++ b/board/keymile/common/common.c
@@ -100,6 +100,9 @@  int set_km_env(void)
 	sprintf((char *)buf, "0x%x", pnvramaddr);
 	setenv("pnvramaddr", (char *)buf);
 
+	sprintf((char *)buf, "0x%x", CONFIG_KM_PNVRAM);
+	setenv("pnvramsize", (char *)buf);
+
 	pram = (CONFIG_KM_RESERVED_PRAM + CONFIG_KM_PHRAM + CONFIG_KM_PNVRAM) /
 		0x400;
 	sprintf((char *)buf, "0x%x", pram);