Environment

U-Boot configuration and startup behaviour is defined in it’s enviornment and therein held variables. While the environment’s default values are pre-defined in source, these setteings and values can be overwritten by editing the respecitive variables, either for short term till the next reboot or permantly by writing the changed values into area in the permanent memory (NVM: NAND or eMMC). Which in turn will loaded at boot time.

Comprehensive description of these features is available in the DENX’s online manual, there specifically in the U-Boot Environment Variables section.

http://www.denx.de/wiki/view/DULG/UBootEnvVariables

Default Environments

Following listings showing the default environment as given after factory installation, for the major groups of COM based on NVM (NAND/eMMC) used; also given commands how to reset variables and the enviroment as a whole.

  1. NAND default environment
  2. eMMC default environment
  3. Reset of Variables

NAND default environment

eMMC default environment

TX6S U-Boot > pr

autoload=no
autostart=no
baseboard=stk5-v3
baudrate=115200
boot_mode=nand
bootargs=init=/linuxrc console=ttymxc0,115200 ro debug panic=1
bootargs_jffs2=run default_bootargs;setenv bootargs ${bootargs} root=/dev/mtdblock3 rootfstype=jffs2
bootargs_mmc=run default_bootargs;setenv bootargs ${bootargs} root=/dev/mmcblk0p2 rootwait
bootargs_nfs=run default_bootargs;setenv bootargs ${bootargs} root=/dev/nfs nfsroot=${nfs_server}:${nfsroot},nolock ip=dhcp
bootargs_ubifs=run default_bootargs;setenv bootargs ${bootargs} ubi.mtd=rootfs root=ubi0:rootfs rootfstype=ubifs
bootcmd=run bootcmd_${boot_mode} bootm_cmd
bootcmd_jffs2=setenv autostart no;run bootargs_jffs2;nboot linux
bootcmd_mmc=setenv autostart no;run bootargs_mmc;fatload mmc 0 ${loadaddr} uImage
bootcmd_nand=setenv autostart no;run bootargs_ubifs;nboot linux
bootcmd_net=setenv autoload y;setenv autostart n;run bootargs_nfs;dhcp
bootdelay=1
bootfile=uImage
bootm_cmd=bootm ${loadaddr} - ${fdtaddr}
cpu_clk=792
default_bootargs=setenv bootargs init=/linuxrc console=ttymxc0,115200 ro debug panic=1 ${append_bootargs}
fdtaddr=11000000
fdtsave=fdt resize;nand erase.part dtb;nand write ${fdtaddr} dtb ${fdtsize}
loadaddr=18000000
mtdids=nand0=gpmi-nand
mtdparts=mtdparts=gpmi-nand:1024k@0x20000(u-boot),384k(env),6m(linux),32m(rootfs),89600k(userfs),512k@0x7f00000(dtb),512k@0x7f80000(bbt)ro
nfsroot=/tftpboot/rootfs
otg_mode=device
touchpanel=tsc2007
video_mode=VGA
Environment size: 1485/131068 bytes

eMMC default environment

NAND default environment

TX6Q U-Boot > pr

autoload=no
autostart=no
baseboard=stk5-v3
baudrate=115200
boot_mode=mmc
bootargs=init=/linuxrc console=ttymxc0,115200 ro debug panic=1
bootargs_jffs2=run default_bootargs;setenv bootargs ${bootargs} root=/dev/mtdblock3 rootfstype=jffs2
bootargs_mmc=run default_bootargs;setenv bootargs ${bootargs} root=PARTUUID=${rootpart_uuid} rootwait
bootargs_nfs=run default_bootargs;setenv bootargs ${bootargs} root=/dev/nfs nfsroot=${nfs_server}:${nfsroot},nolock ip=dhcp
bootargs_ubifs=run default_bootargs;setenv bootargs ${bootargs} ubi.mtd=rootfs root=ubi0:rootfs rootfstype=ubifs
bootcmd=run bootcmd_${boot_mode} bootm_cmd
bootcmd_jffs2=setenv autostart no;run bootargs_jffs2;nboot linux
bootcmd_mmc=setenv autostart no;run bootargs_mmc;fatload mmc 0 ${loadaddr} uImage
bootcmd_net=setenv autoload y;setenv autostart n;run bootargs_nfs;dhcp
bootdelay=1
bootfile=uImage
bootm_cmd=bootm ${loadaddr} - ${fdtaddr}
cpu_clk=792
default_bootargs=setenv bootargs init=/linuxrc console=ttymxc0,115200 ro debug panic=1 ${append_bootargs}
emmc_boot_ack=1
emmc_boot_part=1
fdtaddr=11000000
fdtsave=mmc partconf 0 ${emmc_boot_ack} ${emmc_boot_part} ${emmc_boot_part};mmc write ${fdtaddr} 0x680 80;mmc partconf 0 ${emmc_boot_ack} ${emmc_boot_part} 0
loadaddr=18000000
nfsroot=/tftpboot/rootfs
otg_mode=device
rootpart_uuid=0cc66cc0-02
touchpanel=tsc2007
video_mode=VGA
Environment size: 1410/131068 bytes

Reset of Variables

Users can reset the environment as a whole, or can reset just specific variables. Selectively resetting variables can be used to access variables or environment settings that have been updated or added between releases.

To unset an environment variable the same common procedure as setting is used; but instead setting it to an empty string.

Warning

As long as the command ‘saveenv’ is not executed, changes to the environment will be lost with the next reset. In development this should be the preferred method.

Examples:

  • Unset variable

    unset apppend_bootargs (set empty string)

    setenv apppend_bootargs
    saveenv
    
  • Reset whole environment

    env default -a
    saveenv
    
  • Reset specific variable

    env default <*variable*>
    saveenv
    

    e.g. resetting fdtsave

    env default fdtsave
    save
    

    Note

    Reseting a variable that’s not part of the compiled in default environment will be deleted, accompanied by the following message: WARNING: '<variable>' not in imported env, deleting it!