I plan to use fw_printenv to modify u-boot envirioment variables like ethaddr,ipaddr, etc.
u-boot version: 1.3.4, kernel verion: 2.6.18 from lsp2.0
after fw_printenv tool was configed and builded, it says : Warning: "Bad CRC, using default environment" when running.
I failed to resovle the problem after reading the codes and gdb debugging in ccs5 for the whole afternoon.
I believe the result should be ok as long as the offset and size are correst.
offset in nand is 0 and size is 0x20000 in my configuration.
The offset can be verified in u-boot command line by following command:
nand read 0x80800000 0 0x20000
md 0x80800000
80800000: 2217238b 746f6f62 616c6564 00323d79 .#."bootdelay=2.
80800010: 64756162 65746172 3531313d 00303032 baudrate=115200.
80800020: 61687465 3d726464 303a3030 39393a45 ethaddr=00:0E:99
80800030: 3a46453a 323a4645 666e0032 736f6873 :EF:EF:22.nfshos
80800040: 39313d74 36312e32 2e302e38 6f620033 t=192.168.0.3.bo
.........
The length can read in the end of printenv command:
Environment size: 955/131068 bytes
GDB debuging fw_printenv in ccs, I found fw_printenv read first 4 bytes in environment.crc, and following 0x20000-4 in environment.data.
function crc32 run through environment.data,len = 0x20000-4=131068 bytes.
Why still got Bad CRC when both offset and length are correct?Did i miss some key point?
Following are configurations:
Best regards,
Zhang Jianjun