DENX . U-Bootdoc . EnvironmentVariables

1.8. Environment Variables

Environment Variables (EV) can be used to configure the system and to store parameters for commands, and even commands and sequences of commands (simple scripts).

The real power of EVs results from the fact that Unix shell like variable expansion is available. For example:

=> setenv ipaddr
=> setenv serverip
=> setenv netdev eth0
=> setenv hostname testbox
=> setenv rootpath /opt/eldk/ppc_8xx
=> setenv ramargs setenv bootargs root=/dev/ram rw
=> setenv nfsargs 'setenv bootargs root=/dev/nfs rw nfsroot=${serverip}:${rootpath}'
=> setenv addip 'setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:${netdev}:off'
=> setenv kernel_addr  40040000
=> setenv ramdisk_addr 40100000
=> setenv flash_ram 'run ramargs addip;bootm ${kernel_addr} ${ramdisk_addr}'
=> setenv flash_nfs 'run nfsargs addip;bootm ${kernel_addr}'
=> setenv net_nfs 'tftp 200000 ${bootfile};run nfsargs addip;bootm'
=> setenv net_ram 'tftp 200000 ${bootfile};run ramargs addip;bootm 200000 ${ramdisk_addr}'

Boot Kernel Image in flash with ramdisk in flash:

=> run flash_ram

Boot Kernel Image in flash with root filesystem over NFS:

=> run flash_nfs

Download Kernel Image over network and use root filesystem over NFS:

=> run net_nfs

Download Kernel Image over network with ramdisk in flash:

=> run net_ram

Step by step:

=> run flash_nfs

Step Action Result in bootargs
run nfsargs setenv bootargs root=/dev/nfs rw nfsroot=${serverip}:${rootpath} root=/dev/nfs rw nfsroot=
run addip setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:\
root=/dev/nfs rw nfsroot= ip=\
bootm 40040000 boot Linux kernel

Example: simple recovery strategy:

=> setenv bootcmd 'run flash_ram; setenv kernel_addr ${alt_kernel}; run flash_ram; run net_ram'

----- Revision r1.5 - 04 Jun 2004 - 16:43 - WolfgangDenk
Copyright © 2002-2018 by DENX Software Engineering