U-Boot环境变量

909阅读 0评论2009-05-13 nlchjian
分类:

U-Boot环境变量

U-Boot Environment Variables

1.4. U-Boot Environment Variables


The U-Boot environment is a block of memory that is kept on NAND flash and copied to SDRAM when u-boot starts. It is used to store environment variables which can be used to configure the system. The environment is protected by a CRC32 checksum. It is much like a traditional Linux shell, the U-Boot shell uses environment variables to tailor its operation. The U-Boot commands to manipulate environment variables have the same names as the BASH shell. For instance printenv and setenv behave the same as their BASH shell counterparts.

This section lists the most important environment variables, some of which have a special meaning to u-boot. You can use these variables to configure the behaviour of u-boot to your liking.

The real power of environment variable 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 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 flash_ram
Download Kernel Image over network with ramdisk in flash:
=> run flash_ram

U-Boot also allows to store commands or command sequences in a plain text file. Using the mkimage tool you can then convert this file into a script image which can be executed using u-boot's autoscr command. Nevertheless; U-Boot allows to dynamically load and run "standalone" applications, which can use some resources of U-Boot like console I/O functions, memory allocation or interrupt services. U-Boot supports the concept of a splash screen for booting image. If developers would like to learn more, please refer to DENX U-Boot manual.

We will detail how to download firmware (u-boot, Linux kernel and rescue root filesystems) into NAND flash using the tftp command of u-boot via Ethernet.


上一篇:tftp
下一篇:u-boot 引导内核