Skip to main content.

5.9.6. Environment Variables Commands

5.9.6.1. printenv- print environment variables

Note: Included topic DULGData.canyonlandsUBootPrintenvHelp? does not exist yet

The printenv command prints one, several or all variables of the U-Boot environment. When argumens are given, these are interpreted as the names of environment variables which will be printed with their values:

Note: Included topic DULGData.canyonlandsUBootPrintenvWithArgs? does not exist yet

Without arguments, printenv prints all a list with all variables in the environment and their values, plus some statistics about the current usage and the total size of the memory available for the environment.

Note: Included topic DULGData.canyonlandsUBootPrintenvNoArgs? does not exist yet

5.9.6.2. saveenv - save environment variables to persistent storage

Note: Included topic DULGData.canyonlandsUBootSaveenvHelp? does not exist yet

All changes you make to the U-Boot environment are made in RAM only. They are lost as soon as you reboot the system. If you want to make your changes permanent you have to use the saveenv command to write a copy of the environment settings to persistent storage, from where they are autmatically loaded during startup:

Note: Included topic DULGData.canyonlandsUBootSaveenv? does not exist yet

5.9.6.3. setenv - set environment variables

Note: Included topic DULGData.canyonlandsUBootSetenvHelp? does not exist yet

To modify the U-Boot environment you have to use the setenv command. When called wih exactly one argument, it will delete any variable of that name from U-Boot's environment, if such a variable exists. Any storage occupied for such a variable will be automatically reclaimed:

Note: Included topic DULGData.canyonlandsUBootSetenvDelete? does not exist yet

When called with more arguments, the first one will agin be the name of the variable, and all following arguments will (concatenated by single space characters) form the value that gets stored for this variable. New variables will be automatically created, existing ones overwritten.

Note: Included topic DULGData.canyonlandsUBootSetenvSet? does not exist yet

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.

Note: Included topic DULGData.canyonlandsUBootSetenvQuote? does not exist yet

TIP There is no restriction on the characters that can be used in a variable name except the restrictions imposed by the command line parser (like using backslash for quoting, space and tab characters to separate arguments, or semicolon and newline to separate commands). Even strange input like "=-/|()+=" is a perfectly legal variable name in U-Boot.

ALERT! A common mistake is to write

setenv name=value

instead of

setenv name value

There will be no error message, which lets you believe everything went OK, but it didn't: instead of setting the variable name to the value value you tried to delete a variable with the name name=value - this is probably not what you intended! Always remember that name and value have to be separated by space and/or tab characters!

5.9.6.4. run - run commands in an environment variable

Note: Included topic DULGData.canyonlandsUBootRunHelp? does not exist yet

You can use U-Boot environment variables to store commands and even sequences of commands. To execute such a command, you use the run command:

Note: Included topic DULGData.canyonlandsUBootRun? does not exist yet

You can call run with several variables as arguments, in which case these commands will be executed in sequence:

Note: Included topic DULGData.canyonlandsUBootRunSequence? does not exist yet

TIP If a U-Boot variable contains several commands (separated by semicolon), and one of these commands fails when you "run" this variable, the remaining commands will be executed anyway.

TIP If you execute several variables with one call to run, any failing command will cause "run" to terminate, i. e. the remaining variables are not executed.

5.9.6.5. bootd - boot default, i.e., run 'bootcmd'

Note: Included topic DULGData.canyonlandsUBootBootdHelp? does not exist yet

The bootd (short: boot executes the default boot command, i. e. what happens when you don't interrupt the initial countdown. This is a synonym for the run bootcmd command.

all variables in the environment and their values, plus some statistics about the current usage and the total size of the memory available for the environment.

Note: Included topic DULGData.canyonlandsUBootPrintenvNoArgs? does not exist yet

5.9.6.6. saveenv - save environment variables to persistent storage

Note: Included topic DULGData.canyonlandsUBootSaveenvHelp? does not exist yet

All changes you make to the U-Boot environment are made in RAM only. They are lost as soon as you reboot the system. If you want to make your changes permanent you have to use the saveenv command to write a copy of the environment settings to persistent storage, from where they are autmatically loaded during startup:

Note: Included topic DULGData.canyonlandsUBootSaveenv? does not exist yet

5.9.6.7. setenv - set environment variables

Note: Included topic DULGData.canyonlandsUBootSetenvHelp? does not exist yet

To modify the U-Boot environment you have to use the setenv command. When called wih exactly one argument, it will delete any variable of that name from U-Boot's environment, if such a variable exists. Any storage occupied for such a variable will be automatically reclaimed:

Note: Included topic DULGData.canyonlandsUBootSetenvDelete? does not exist yet

When called with more arguments, the first one will agin be the name of the variable, and all following arguments will (concatenated by single space characters) form the value that gets stored for this variable. New variables will be automatically created, existing ones overwritten.

Note: Included topic DULGData.canyonlandsUBootSetenvSet? does not exist yet

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.

Note: Included topic DULGData.canyonlandsUBootSetenvQuote? does not exist yet

TIP There is no restriction on the characters that can be used in a variable name except the restrictions imposed by the command line parser (like using backslash for quoting, space and tab characters to separate arguments, or semicolon and newline to separate commands). Even strange input like -/|()+ is a perfectly legal variable name in U-Boot.

ALERT! A common mistake is to write

setenv name=value

instead of

setenv name value

There will be no error message, which lets you believe everything went OK, but it didn't: instead of setting the variable name to the value value you tried to delete a variable with the name name=value - this is probably not what you intended! Always remember that name and value have to be separated by space and/or tab characters!

5.9.6.8. run - run commands in an environment variable

Note: Included topic DULGData.canyonlandsUBootRunHelp? does not exist yet

You can use U-Boot environment variables to store commands and even sequences of commands. To execute such a command, you use the run command:

Note: Included topic DULGData.canyonlandsUBootRun? does not exist yet

You can call run with several variables as arguments, in which case these commands will be executed in sequence:

Note: Included topic DULGData.canyonlandsUBootRunSequence? does not exist yet

TIP If a U-Boot variable contains several commands (separated by semicolon), and one of these commands fails when you "run" this variabe, the remaining commands =will be executed anyway=.

TIP If you execute several variables with one call to run, any failing command will cause "run" to terminate, i. e. the remaining variables are not executed.

5.9.6.9. bootd - boot default, i.e., run 'bootcmd'

Note: Included topic DULGData.canyonlandsUBootBootdHelp? does not exist yet

The bootd (short: boot executes the default boot command, i. e. what happens when you don't interrupt the initial countdown. This is a synonym for the run bootcmd command.

5.9.5. Download Commands 1. Abstract 5.9.7. Flattened Device Tree support
Prev Home Next