User manual
Linux Guide taskit GmbH
On the other hand, some are set by U-Boot, such as filesize and fileaddr when
downloading a file.
Printenv outputs the current contents of the environment variables.
To show specific variables, you can add their names as arguments.
printenv [name[ name[ ...]]]
During runtime, changes to variables or new variables are stored in RAM and not saved
permanently in flash memory. Saving is done explicitly with the saveenv command.
saveenv
Sets the environment variable name to the value value. If the variable already exists, its
current value is overwritten; if it does not yet exist, it is created. If no value is given, the
variable is erased (if it exists).
setenv name value
setenv name
The run command runs the environment variable name as if it were a command. This
makes it possible to store commands in environment variables and create simple boot
scripts.
run name
Using the run command, which makes it possible to run saved variables as a command
sequence, you can create simple scripts to automate regularly occurring processes. In U-
Boot, the characters $() are used to reference variables, ; is for creating command
sequences and \ is the escape character.
U-Boot generally interprets numerical arguments as hex values. In other words, 10000000
is 0x1000 0000 Hex.
For example: U-Boot> echo $(filesize)
U-Boot> 171a4
Entering this command outputs the contents of the filesize environment variable. The
same command without parentheses would be interpreted as a simple string:
U-Boot> echo $filesize
U-Boot> $filesize
If the $ character from the first example is marked with the escape character, the argument
is also interpreted as a string:
U-Boot> echo \$(filesize)
U-Boot> $(filesize)
Similarly, you can use a semicolon to indicate a sequence of commands:
U-Boot> echo $(filesize); echo Hello
U-Boot> 171a4
U-Boot> Hello
Escape the semicolon with the backslash escape character, and the argument will be
interpreted as a string:
Page 11 of 65 Version 1.26 (2008-04-30)