Preparing an environment variable image

Discussion created by Aaronwu Employee on Sep 7, 2011
Latest reply on Oct 10, 2011 by Aaronwu


I am using a separate, dedicated sector to store the u-boot  environment variables. But when programming the SPI EEPROM for the first  time, this separate sector is blank and u-boot defaults to its default  environment. I have to enter u-boot command line and do a saveenv in  order to have a valid environment.

Is there a way to prepare an image file that contains all of my  environment variables, together with a valid CRC checksum? This way, I  can just write this image into the dedicated sector and u-boot will not  issue the "warning, using default environment" message...


I know that I can do a "saveenv" and then  dump the contents of the environment variable sector into a file, but I  am looking for a solution that can be integrated into the build process.  I am thinking about a C program that incorporates all u-boot  environment related code and that also includes the bfin_adi_common.h  header file, but is built for the HOST instead of for the blackfin  target. This way, this program can be executed as part of the u-boot  build process and it just creates a binary image that represents the  current default u-boot environment.