Skip to contentSkip to conversation

Very confusing variable=name behaviour

U-Boot Pavel Machek 2 participants 2 messages Dec 12, 2015

lore
Share & tools
lore
#0 lore raw

Hi!

I'm getting quite crazy behaviour of variables in recent u-boot:

VERSION = 2016
PATCHLEVEL = 01
SUBLEVEL =
EXTRAVERSION = -rc1

Bytes transferred = 104656 (198d0 hex)
=> bootm_boot_mode=nonsec
=> echo $bootm_boot_mode
nonsec
=> prinetenv bootm_boot_mode
Unknown command 'prinetenv' - try 'help'
=> printenv bootm_boot_mode
## Error: "bootm_boot_mode" not defined
=> echo $bootm_boot_mode
nonsec
=>

What is going on there? C-level "getenv" fails on such variable, too.

bootm_boot_mode = '<NULL>'

Explicit setenv behaves as expected:

=> setenv bootm_boot_mode nonsec
=> echo $bootm_boot_mode
nonsec
=> printenv bootm_boot_mode
bootm_boot_mode=nonsec
=>

Best regards,

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#1 lore raw

In u-boot there are two types of variables, local and persistent variables.

Persistent variables are assigned via "setenv", can be saved (the whole environment) via "saveenv", restored (to default values) via "env default -f".

Hush variables are assigned via "=" and can aren't saved.

Both are accessed via "$variable" or "${variable}"

What you are seeing is normal.

Quoted 38 lines · Pavel Machek

Hi!

I'm getting quite crazy behaviour of variables in recent u-boot:

VERSION = 2016
PATCHLEVEL = 01
SUBLEVEL =
EXTRAVERSION = -rc1

Bytes transferred = 104656 (198d0 hex)
=> bootm_boot_mode=nonsec
=> echo $bootm_boot_mode
nonsec
=> prinetenv bootm_boot_mode
Unknown command 'prinetenv' - try 'help'
=> printenv bootm_boot_mode
## Error: "bootm_boot_mode" not defined
=> echo $bootm_boot_mode
nonsec
=>

What is going on there? C-level "getenv" fails on such variable, too.

bootm_boot_mode = '<NULL>'

Explicit setenv behaves as expected:

=> setenv bootm_boot_mode nonsec
=> echo $bootm_boot_mode
nonsec
=> printenv bootm_boot_mode
bootm_boot_mode=nonsec
=>

Best regards,

Pavel

Signature · 2 lines
Peter Barada
peter.barada at logicpd.com