Using U-Boot Environment Print

 

U-Boot makes use of the so-called environment variables to define various aspects of the target functionality. On the VF6 SOM, the U-Boot environment is stored in the on-module NAND Flash and is persistent across power or reset cycles. Parameters defined by the U-boot environment variables include: target IP address, target MAC address, location in RAM where a Linux bootable image will be loaded, and many others.

To manipulate the U-Boot environment the following commands are used:

  • printenv <var> - print the value of the variable var. Without arguments, prints all environment variables:
  • Vybrid U-Boot > printenv
    addip=setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:eth0:off  fec_mac=${ethaddr}
    args=run args_quiet
    args_common=console=ttymxc0,115200 lpj=1646592
    ...
    Environment size: 2040/65531 bytes

  • setenv <var> <val> - set the variable var to the value val:
  • Vybrid SOM > setenv image vlad/rootfs.uImage
    Vybrid-SOM >

    Running setenv <var> will unset (undefine) a specified U-Boot variable, so it won't be shown as available next time you run printenv.

  • saveenv - save the up-to-date U-Boot environment, possibly updated using setenv commands, into internal Flash. Running saveenv makes sure that any updates you have made to the U-Boot environment are persistent across power cycles and resets. If you don't run saveenv, any updates you may have made to the U-Boot environment will be lost on next reboot.
  • Vybrid-SOM > saveenv
    Saving Environment to NAND...
    Erasing NAND...
    Erasing at 0xa0000 -- 100% complete.
    Writing to NAND... done
    Vybrid U-Boot >