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_} ..."
syntaxNOTE: 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'