[U-Boot] hush while confusion

Wolfgang Denk wd at denx.de
Thu Oct 22 13:31:39 CEST 2009


Dear "David Collier",

In message <memo.20091022093854.2092B at postmaster+dexdyne.com.cix.co.uk> you wrote:
> 
> what I'd like to do is put it in a while loop - this is an embedded
> system and it has nothing better to do than to try again.
> 
> but if I set up 
> 
> bootcmd=while [ .... ]; do ; mmcinit && ext2load mmc 0:1 0x10400000
> /boot/uImage && bootm 0x10400000 ; done
> 
> no matter what I have put in or around the [..] area, it barfs.

Did you understand why it barfs? The '[' is actually a command name,
which usually is a synonym for the 'test' command. U-Boot does not
provide such a coimmand, and the hush shell does not provide it as
shell builtin either, so this _must_ fail.

I am surprised that you did not find this out yourself - U-Boot should
issue a pretty clear error message, something like

	Unknown command '[' - try 'help'

> Could anyone show me a working example of a hush while loop please? Or
> tell me what I'm doing wrong :-)

Here is a (tested and working) example:

	=> mw 200000 0
	=> while itest *200000 == 0 ; do
	> tftp 200000 tqm5200/uImage
	> echo === done ====
	> done
	Using FEC ETHERNET device
	TFTP from server 192.168.1.1; our IP address is 192.168.160.4
	Filename 'tqm5200/uImage'.
	Load address: 0x200000
	Loading: #################################################################
	         ############################################################
	done
	Bytes transferred = 1830503 (1bee67 hex)
	=== done ====
	=> 

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
"Where shall I begin, please your Majesty?" he asked. "Begin  at  the
beginning,"  the  King said, gravely, "and go on till you come to the
end: then stop."    - Alice's Adventures in Wonderland, Lewis Carroll


More information about the U-Boot mailing list