Forum Discussion
Altera_Forum
Honored Contributor
21 years ago> *** Warning - bad CRC, using default environment
This is normal behavior when the environment has not been saved to flash. u-boot supports environment variables. These variables are simply name-value pairs. If you execute the 'printenv' command, you should see something like: stdin=serial stdout=serial ipaddr=192.168.2.21 You can add variables to the u-boot environment using the 'setenv' command. For example, to set the environment variable 'netmask' to '255.255.255.0': ==> setenv netmask 255.255.255.0 When u-boot starts up, it trys to read saved environment variables from a configured address. In the case of the PK1C20 configuration, it uses the flash sector at 0x0000_3000. The environment is stored as a 32-bit CRC, followed by strings formatted as "name=value\0". If the CRC is good, u-boot uses the variables from flash, otherwise it uses a set of default variables that are created at compile time. To save your environment to flash (and prevent subsequent warnings at startup), just use the 'saveenv' command. Provided that you flash programming implementation is correct, u-boot will copy the variables to flash and write the 32-bit CRC. The enviroment variables are quite handy for storing things such as serial numbers, default ip addresses, etc. They may also be used in commands and u-boot scripts. For example: ==> setenv serverip 10.0.41.40 ==> ping $serverip A more complicated example would be to set the bootcmd variable to load a kernel image via tftp, then boot the kernel. The bootcmd variable can be configured to automatically run at startup after a configured delay (in this case 5 seconds): ==> setenv bootcmd "tftpboot 800000 linux.img; bootm 800000" ==> setenv bootdelay 5 ==> saveenv Anyway, there's a long-winded description ;-) of some things you can do with the environment. Regards, --Scott