U-boot environment: Difference between revisions

From embeddedTS Manuals
No edit summary
No edit summary
Line 1: Line 1:
On the SPI flash U-boot has both the U-boot application and the U-boot environment.  Our default build has 8KB of environment which can be used for variables and scripts to control booting your operating system.  These commands are relevant to manipulating the environment:
On the SPI flash U-boot has both the U-boot application and the U-boot environment.  Our default build has 8KB of environment which can be used for variables and boot scripts.  These commands are relevant to manipulating the environment:


<source lang=bash>
<source lang=bash>
Line 25: Line 25:
</source>
</source>


For a production environment the best option for setting depends on the number of units.  For a smaller number of units it may be simplest to update any required commands manually.  For example, a custom cmdline option like "debug":
For a production environment the best option for setting depends on the number of units.  For a smaller number of units it may be simplest to update any required commands by hand.  For example, a custom cmdline option like "debug":
<source lang=bash>
<source lang=bash>
env set cmdline_append 'console=ttymxc0,115200 ro init=/sbin/init debug'
env set cmdline_append 'console=ttymxc0,115200 ro init=/sbin/init debug'
env save
env save
</source>
</source>

Revision as of 13:15, 10 February 2017

On the SPI flash U-boot has both the U-boot application and the U-boot environment. Our default build has 8KB of environment which can be used for variables and boot scripts. These commands are relevant to manipulating the environment:

# Print all environment variables
env print -a

# Sets the variable bootdelay to 5 seconds
env set bootdelay 5;

# Variables can also contain commands
env set hellocmd 'led red on; echo Hello world; led green on;'

# Execute commands saved in a variable
env run hellocmd;

# Commit env changes to the spi flash
# Otherwise changes are lost
env save

# Restore env to default
env default -a

# Remove a variable
env delete emmcboot

For a production environment the best option for setting depends on the number of units. For a smaller number of units it may be simplest to update any required commands by hand. For example, a custom cmdline option like "debug":

env set cmdline_append 'console=ttymxc0,115200 ro init=/sbin/init debug'
env save