Skip to contentSkip to conversation

Duplicate environment variables in RAM?!?

U-Boot dbrazeau 1 participant 2 messages Sep 1, 2010

lore
Share & tools
lore

dbrazeau

author
#0 lore raw

For some variables, for example "ipaddr", when I try to change them using "setenv" it does not update the current "ipaddr" variable in RAM it creates a new one and append it to the end of the variable list. As a result I end up having two "ipaddr" variables in RAM, one with the original value and one with the new value at the end of the list. If I try to set the variable a second time it deletes the first instance (the original) and adds the second new one to the end of the variable list.

This may be a little confusing so here is an abbreviated example. The '.....' represent the rest of the variables in the list.

Original list of variables
---------------------
.......
ipaddr=10.0.5.2
.......
---------------------

=>setenv ipaddr 10.0.16.4
Now the variables look like this
---------------------
.......
ipaddr=10.0.5.2
.......
ipaddr=10.0.16.4
---------------------

=>setenv ipaddr 10.0.28.7
And now the variables look like this
---------------------
.......
.......
ipaddr=10.0.16.4
ipaddr=10.0.28.7
---------------------

Is this the intended behavior? I am running an older version (U-Boot 1.3.4) so maybe this has been fixed. If this is the case could you point me to the version that it is fixed in.

Thanks.

Signature · 2 lines
View this message in context: http://old.nabble.com/Duplicate-environment-variables-in-RAM-%21--tp29588954p29588954.html
Sent from the Uboot - Users mailing list archive at Nabble.com.
author
#1 lore raw

So I figured out what my issue was. I was defining CONFIG_IPADDR in my config .h file and also added ipaddr=xxx.xxx.xxx.xxx to my defined environment variables list in the config .h file. I did not realize that the ipaddr environment variabe (along with others) are added in the variable list in the env_common.c file. As a result I was starting out with duplicate variables before every setting 'ipaddr'.

Quoted 43 lines · dbrazeau

For some variables, for example "ipaddr", when I try to change them using "setenv" it does not update the current "ipaddr" variable in RAM it creates a new one and append it to the end of the variable list. As a result I end up having two "ipaddr" variables in RAM, one with the original value and one with the new value at the end of the list. If I try to set the variable a second time it deletes the first instance (the original) and adds the second new one to the end of the variable list.

This may be a little confusing so here is an abbreviated example. The '.....' represent the rest of the variables in the list.

Original list of variables
---------------------
.......
ipaddr=10.0.5.2
.......
---------------------

=>setenv ipaddr 10.0.16.4
Now the variables look like this
---------------------
.......
ipaddr=10.0.5.2
.......
ipaddr=10.0.16.4
---------------------

=>setenv ipaddr 10.0.28.7
And now the variables look like this
---------------------
.......
.......
ipaddr=10.0.16.4
ipaddr=10.0.28.7
---------------------

Is this the intended behavior? I am running an older version (U-Boot 1.3.4) so maybe this has been fixed. If this is the case could you point me to the version that it is fixed in.

Thanks.

Signature · 2 lines
View this message in context: http://old.nabble.com/Duplicate-environment-variables-in-RAM-%21--tp29588954p29592447.html
Sent from the Uboot - Users mailing list archive at Nabble.com.