uboot环境变量

http://www.denx.de/wiki/view/DULG/UBootCmdGroupEnvironment#Section_5.9.6.3.

Remember standard shell quoting rules when the value of a variable shall contain characters that have a special meaning to the command line parser (like the $ character that is used for variable substitution or the semicolon which separates commands). Use the backslash (\) character to escape such special characters, or enclose the whole phrase in apstrophes ('). Use "${name}" for variable expansion (see 14.2.17. How the Command Line Parsing Works for details).

=> setenv cons_opts 'console=tty0 console=ttyS0,${baudrate}'
=> printenv cons_opts
cons_opts=console=tty0 console=ttyS0,${baudrate}
=>

 

特殊字符 $ 和 ; 要用\转义,或者用 '  包含。

${name}引用变量

http://www.denx.de/wiki/view/DULG/CommandLineParsing

uboot的命令行解析

14.2.17. How the Command Line Parsing Works

There are two different command line parsers available with U-Boot: the old "simple" one, and the much more powerful "hush" shell:

有两种,simple和hush

14.2.17.1. Old, simple command line parser
  • supports environment variables (through setenv / saveenv commands)
  • several commands on one line, separated by ';'
  • variable substitution using "... ${_variablename_} ..." syntax
    ALERT!NOTE: Older versions of U-Boot used "$(...)" for variable substitution. Support for this syntax is still present in current versions, but will be removed soon. Please use "${...}" instead, which has the additional benefit that your environment definitions are compatible with the Hush shell, too.
  • special characters ('$', ';') can be escaped by prefixing with '\', for example:
            setenv bootcmd bootm \${address}
  • You can also escape text by enclosing in single apostrophes, for example:
            setenv addip 'setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:${netdev}:off'
用${_variablename_}这种语法用变量引用,旧的语法是用$(...),要淘汰了。
特殊字符('$', ';') 要'\'转义,如setenv bootcmd bootm \${address} ,或者用单引号,如
setenv addip 'setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:${netdev}:off' 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值