Skip to main content.

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 192.168.3.71
=> setenv serverip 192.168.3.1
=> 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 up Result in bootargs
bootm 40040000 boot Linux kernel
run nfsargs setenv bootargs root=/dev/nfs rw nfsroot=${serverip}:${rootpath} root=/dev/nfs rw nfsroot=192.168.3.1:/opt/eldk/ppc_8xx
run addip setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:\
${gatewayip}:${netmask}:\
${hostname:${netdev}:off
root=/dev/nfs rw nfsroot=192.168.3.1:/opt/eldk/ppc_8xx ip=192.168.3.71:192.168.3.1:::\
testbox:eth0:off

Example: simple recovery strategy:

=> setenv bootcmd 'run flash_ram; setenv kernel_addr ${alt_kernel}; run flash_ram; run net_ram'
1.7.3. POST - Hardware Diagnose Commands 1. Abstract 1.9. Boot Options
Prev Home Next