开发者

how to make "if" and comparison statement in uboot?

开发者 https://www.devze.com 2023-02-25 09:14 出处:网络
i\'m newbie in uboot and tftp programing based on this url, there is how to make if statement like this if imi $addr; then echo Image OK; else echo Image corrupted!!; fi

i'm newbie in uboot and tftp programing

based on this url, there is how to make if statement like this if imi $addr; then echo Image OK; else echo Image corrupted!!; fi

and this is my "if" :

开发者_开发技巧
=> setenv a true
=> printenv a
a=true
=> setenv b true
=> printenv b
b=true
=> if a b; then echo 'same';fi
Unknown command 'a' - try 'help'
=> if $a $b; then echo 'same';fi
Unknown command 'true' - try 'help'
=> if ${a} ${b}; then echo 'same';fi
Unknown command 'true' - try 'help'
=>


I am not sure if it is in all u-boot versions or not, but there should be a test command for comparison. Can you try:

if test "${a}" = "${b}"; then echo "same"; fi

Unfortunately I don't have access to u-boot, so this is all from memory.

0

精彩评论

暂无评论...
验证码 换一张
取 消