Uboot Environment Variables

Source: Internet
Author: User

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$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_optscons_opts = console = tty0 console = ttys0, $ {baudrate} =>

 

Special characters $ and; escape with \ or'Include.

Use$ {Name} references the variable

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

Uboot command line Parsing

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:

There are two types: simple and hush.

14.2.17.1. Old, simple command line parser
  • Supports environment variables (throughSetenv/SaveenvCommands)
  • Several commands on one line, separated';'
  • Variable Substitution using"... $ {_ Variablename _}..."Syntax

    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'\', 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 _} is used as a variable reference. The old syntax is$ (...), To be eliminated.
 
Special characters ('$',';')'\'Escape, such as setenv bootcmd bootm \ $ {address}, or use single quotes, such
 
Setenv addip 'setenv bootargs $ {bootargs} IP =$ {ipaddr }:$ {serverip }:: {gatewayip }:: {netmask }:$ {hostname }: $ {netdev}: off'

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.