Skip to contentSkip to conversation

Question about the setenv command

U-Boot-Users Dave Hylands 3 participants 7 messages Jun 26, 2006

lore
Share & tools
lore
#0 lore raw

Hi,

I'm using u-boot 1.1.4 on a gumstix (PXA255).

In version 1.1.2, I was able to use a command like this:

setenv linux "$bootcmd"

and this would make the variable 'linux' have the same value as the variable 'bootcmd'

This doesn't seem to work in 1.1.4. Is there another way of setting the contents of one variable to be equal to the contents of another variable?

Signature · 3 lines
Dave Hylands
Vancouver, BC, Canada
http://www.DaveHylands.com/
#1 lore raw
Quoted 5 lines · Dave Hylands

This doesn't seem to work in 1.1.4. Is there another way of setting
the contents of one variable to be equal to the contents of another
variable?

setenv linux bootcmd

Best regards,

Sam

___________________________________________________________
Mp3???-???????
http://music.yahoo.com.cn/?source=mail_mailbox_footer

#3 lore raw
In reply to Dave Hylands
Quoted 4 lines

I'm using u-boot 1.1.4 on a gumstix (PXA255).

In version 1.1.2, I was able to use a command like this:

Quoted 8 lines

setenv linux "$bootcmd"

and this would make the variable 'linux' have the same value as the variable 'bootcmd'

This doesn't seem to work in 1.1.4. Is there another way of setting the contents of one variable to be equal to the contents of another variable?

Hmmm. It seems to work for simple variables. My bootcmd looks like this:

bootcmd=icache on;setenv stderr nulldev; setenv stdout nulldev; if mmcinit && fatload mmc 0 a2000000 gumstix-factory.script; then setenv stdout serial; setenv stderr serial; echo Found gumstix-factory script...; autoscr; else setenv stdout serial;setenv stderr serial;fsload && bootm; fi

Signature · 3 lines
Dave Hylands
Vancouver, BC, Canada
http://www.DaveHylands.com/
#4 lore raw
In reply to Dave Hylands
Quoted 2 lines · In message <[email protected]> you…

I'm using u-boot 1.1.4 on a gumstix (PXA255).

Where did you get the sources from? I understand that this is not the official source tree?

Quoted 6 lines

In version 1.1.2, I was able to use a command like this:

setenv linux "$bootcmd"

and this would make the variable 'linux' have the same value as the variable 'bootcmd'

Yes. Thisis standard use and must work on all systems.

Quoted 3 lines

This doesn't seem to work in 1.1.4. Is there another way of setting the contents of one variable to be equal to the contents of another variable?

Your command is absolutely correct. If it doesn't work on your board then there is amajor bug in your code.

Best regards,

Wolfgang Denk

Signature · 4 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
First study the enemy.  Seek weakness.
	-- Romulan Commander, "Balance of Terror", stardate 1709.2
#2 lore raw
In reply to Sam Song
Quoted 8 lines · In message <[email protected]> you wrote:
Quoted 6 lines

This doesn't seem to work in 1.1.4. Is there another way of setting
the contents of one variable to be equal to the contents of another
variable?

setenv linux bootcmd

No, this is wrong. This will set the variable "linux" to the value "bootcmd", bot not to the content of that variable.

Best regards,

Wolfgang Denk

Signature · 5 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
...computer hardware progress is so fast. No other  technology  since
civilization  began  has seen six orders of magnitude in performance-
price gain in 30 years.                             - Fred Brooks, Jr.
#5 lore raw
In reply to Wolfgang Denk

HI Wolfgang,

Quoted 2 lines

Where did you get the sources from? I understand that this is not the official source tree?

It starts out using the official 1.1.4 source and adds a bunch of patches which appear to be specific to the gumstix hardware.

Quoted 8 lines
Quoted 6 lines

In version 1.1.2, I was able to use a command like this:

setenv linux "$bootcmd"

and this would make the variable 'linux' have the same value as the variable 'bootcmd'

Yes. Thisis standard use and must work on all systems.

It turns out that this does in fact work as before using simple variables.

I think that the issue has nothing to do with the 1.1.2 versus 1.1.4 but rather that

setenv linux "$bootcmd"

doesn't work when bootcmd is set to this (all on one line):

setenv bootcmd "icache on;setenv stderr nulldev; setenv stdout nulldev; if mmcinit && fatload mmc 0 a2000000 gumstix-factory.script; then setenv stdout serial; setenv stderr serial; echo Found gumstix-factory script...; autoscr; else setenv stdout serial;setenv stderr serial;fsload && bootm; fi"

I get the following output:

GUM> setenv linux "$bootcmd"
Usage:
setenv - set environment variables

But if I copy and paste the contents (using my terminal program) then everything works fine. Or if I simplify bootcmd then everything works fine.

Signature · 3 lines
Dave Hylands
Vancouver, BC, Canada
http://www.DaveHylands.com/
#6 lore raw
Quoted 3 lines · In message <[email protected]> you…

It starts out using the official 1.1.4 source and adds a bunch of patches which appear to be specific to the gumstix hardware.

Then complain with thye guys who provided the gumstix patches. Also complain that they did not send their patches back to the U-Boot project.

Quoted 1 line

It turns out that this does in fact work as before using simple variables.

I'm afraid I can't help you as I have no idea what the patches changed. The behaviour you describe has to be called broken. PLease call gumstix support...

Quoted 7 lines

doesn't work when bootcmd is set to this (all on one line):

setenv bootcmd "icache on;setenv stderr nulldev; setenv stdout nulldev; if mmcinit && fatload mmc 0 a2000000 gumstix-factory.script; then setenv stdout serial; setenv stderr serial; echo Found gumstix-factory script...; autoscr; else setenv stdout serial;setenv stderr serial;fsload && bootm; fi"

They must have tweaked a couple of parameters, because in the standard configuration (CFG_CBSIZE set to 256) you wouldn't even be able to enter such a line. So who knows what else they changed (and broke).

Do you happen to know if the gumstix patches are somewhere available for download? URL?

I recommend to re-write this in any case, for example into something like this:

=> setenv script_test 'mmcinit && fatload mmc 0 a2000000 gumstix-factory.script'
=> setenv script_exec 'setenv stdout serial;setenv stderr serial;echo Found gumstix-factory script...;autoscr' => setenv script_none 'setenv stdout serial;setenv stderr serial;fsload && bootm'
=> setenv bootcmd 'if run script_test;then run script_exec;else run script_none'

...or so.

Best regards,

Wolfgang Denk

Signature · 4 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"There is nothing new under the sun, but there are lots of old things
we don't know yet."                                  - Ambrose Bierce