16aff3115Swdenk 26aff3115SwdenkThis is a demo implementation of a Linux command line tool to access 36aff3115Swdenkthe U-Boot's environment variables. 46aff3115Swdenk 5d0fb80c3SwdenkFor the run-time utiltity configuration uncomment the line 6d0fb80c3Swdenk#define CONFIG_FILE "/etc/fw_env.config" 7d0fb80c3Swdenkin fw_env.h. 8d0fb80c3Swdenk 9*6de66b35SMarkus KlotzbücherFor building against older versions of the MTD headers (meaning before 10*6de66b35SMarkus Klotzbücherv2.6.8-rc1) it is required to pass the argument "MTD_VERSION=old" to 11*6de66b35SMarkus Klotzbüchermake. 12*6de66b35SMarkus Klotzbücher 13d0fb80c3SwdenkSee comments in the fw_env.config file for definitions for the 14d0fb80c3Swdenkparticular board. 15d0fb80c3Swdenk 16d0fb80c3SwdenkConfiguration can also be done via #defines in the fw_env.h file. The 176aff3115Swdenkfollowing lines are relevant: 186aff3115Swdenk 196aff3115Swdenk#define HAVE_REDUND /* For systems with 2 env sectors */ 206aff3115Swdenk#define DEVICE1_NAME "/dev/mtd1" 216aff3115Swdenk#define DEVICE2_NAME "/dev/mtd2" 22d0fb80c3Swdenk#define DEVICE1_OFFSET 0x0000 236aff3115Swdenk#define ENV1_SIZE 0x4000 246aff3115Swdenk#define DEVICE1_ESIZE 0x4000 25d0fb80c3Swdenk#define DEVICE2_OFFSET 0x0000 266aff3115Swdenk#define ENV2_SIZE 0x4000 276aff3115Swdenk#define DEVICE2_ESIZE 0x4000 286aff3115Swdenk 296aff3115SwdenkCurrent configuration matches the environment layout of the TRAB 306aff3115Swdenkboard. 316aff3115Swdenk 326aff3115SwdenkUn-define HAVE_REDUND, if you want to use the utlities on a system 33d0fb80c3Swdenkthat does not have support for redundant environment enabled. 34d0fb80c3SwdenkIf HAVE_REDUND is undefined, DEVICE2_NAME is ignored, 35d0fb80c3Swdenkas is ENV2_SIZE and DEVICE2_ESIZE. 36d0fb80c3Swdenk 37d0fb80c3SwdenkThe DEVICEx_NAME constants define which MTD character devices are to 38d0fb80c3Swdenkbe used to access the environment. 39d0fb80c3Swdenk 40d0fb80c3SwdenkThe DEVICEx_OFFSET constants define the environment offset within the 41d0fb80c3SwdenkMTD character device. 42d0fb80c3Swdenk 43d0fb80c3SwdenkENVx_SIZE defines the size in bytes taken by the environment, which 44d0fb80c3Swdenkmay be less then flash sector size, if the environment takes less 45d0fb80c3Swdenkthen 1 sector. 46d0fb80c3Swdenk 476aff3115SwdenkDEVICEx_ESIZE defines the size of the first sector in the flash 48d0fb80c3Swdenkpartition where the environment resides. 49