[U-Boot-Users] Error reading environment with fw_printenv

Hi,
I'm running fw_printenv tools on the target (ARM9 running Linux 2.6.9-rc2). MTD partitions work fine (tried to read some bytes with dd). I encounter the following problem. When the function flash_io (fw_env.c) tries to read the CRC and the flags, the function read reads just one byte instead of 5 as specified by len parameter ((line 538)):
if (read (fd, &environment, len) != len) { fprintf (stderr, "CRC read error on %s: %s\n", DEVNAME (curdev), strerror (errno)); return (-1); }
So the function quits even if errno==0.
Is it correct to assume that the read actually reads the specified number of bytes?
Regards,
llandre
DAVE Electronics System House - R&D Department web: http://www.dave-tech.it email: r&d2@dave-tech.it

In message 6.0.1.1.0.20050105115518.01ed50d8@192.168.2.1 you wrote:
I'm running fw_printenv tools on the target (ARM9 running Linux 2.6.9-rc2). MTD partitions work fine (tried to read some bytes with dd).
Can you read the envrionment sector (use a combination of bs+ and skip= options with "dd" to get the right offset) ?
When the function flash_io (fw_env.c) tries to read the CRC and the flags, the function read reads just one byte instead of 5 as specified by len parameter ((line 538)):
You mean the return code of read() is 1? Can you show me the strace output for this?
Is it correct to assume that the read actually reads the specified number of bytes?
On a MTD device it should, unless it encounteres EOF. Are yoiu sure your configuration is OK?
Best regards,
Wolfgang Denk

On a MTD device it should, unless it encounteres EOF. Are yoiu sure your configuration is OK?
I had an error in the fw_env.h file. I fixed it and now the environment is read correctly.
Thanks for your help,
llandre
DAVE Electronics System House - R&D Department web: http://www.dave-tech.it email: r&d2@dave-tech.it
participants (2)
-
llandre
-
Wolfgang Denk