how to make “if” and comparison statement in uboot?

跟風遠走 提交于 2019-12-04 18:09:48

问题


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'
=>

回答1:


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.



来源:https://stackoverflow.com/questions/5646749/how-to-make-if-and-comparison-statement-in-uboot

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!