[U-Boot] error executing fw_printenv

I've cross-compiled and am running fw_printenv on an ARM system using linux-2.6.28. The u-boot environment is kept in SPI-based NOR flash. The configuration within fw_env.h is...
//#define CONFIG_FILE "/etc/fw_env.config" //#define HAVE_REDUND /* For systems with 2 env sectors */ #define DEVICE1_NAME "/dev/mtd7" #define DEVICE1_OFFSET 0x00080000 #define ENV1_SIZE 0x00020000 #define DEVICE1_ESIZE 0x00010000 #define DEVICE1_ENVSECTORS 0 /* should be ignored for NOR */
I get the following error when executing fw_printenv...
Read error on /dev/mtd7: Success
Adding some debug, I've determined that the error results from the read of mtd7 returning 0 bytes read.
*** mtdinfo.type = NOR *** Read 0 bytes, readlen = 131072, seek = 524288 Read error on /dev/mtd7: Success
However, using the command...
dd if=/dev/mtd7 of=/tmp/dummy bs=512 count=1 skip=1024
dummy contains the u-boot environment area as I would expect. Any ideas why the read is returning 0?
Thanks, twebb

Dear twebb,
In message dbdb2ea60912110929y5a41b1a7yf3d8e35c74d5661f@mail.gmail.com you wrote:
I've cross-compiled and am running fw_printenv on an ARM system using linux-2.6.28. The u-boot environment is kept in SPI-based NOR flash. The configuration within fw_env.h is...
...
//#define CONFIG_FILE "/etc/fw_env.config" //#define HAVE_REDUND /* For systems with 2 env sectors */ #define DEVICE1_NAME "/dev/mtd7" #define DEVICE1_OFFSET 0x00080000 #define ENV1_SIZE 0x00020000 #define DEVICE1_ESIZE 0x00010000
This is 512, 128 and 64 KiB, respective.
I get the following error when executing fw_printenv...
Read error on /dev/mtd7: Success
Adding some debug, I've determined that the error results from the read of mtd7 returning 0 bytes read.
*** mtdinfo.type = NOR *** Read 0 bytes, readlen = 131072, seek = 524288 Read error on /dev/mtd7: Success
This is an attempt to read 128 KiB at offset 512 KiB, as configured.
However, using the command...
dd if=/dev/mtd7 of=/tmp/dummy bs=512 count=1 skip=1024
This is reading 0.5 KiB at offset 512 KiB.
dummy contains the u-boot environment area as I would expect. Any ideas why the read is returning 0?
Maybe reading 512 bytes is possible with your driver, but reading 128 KiB is not?
Best regards,
Wolfgang Denk

Maybe reading 512 bytes is possible with your driver, but reading 128 KiB is not?
That turned out to be true. I wondered if others had run into this problem and whether any work had been done towards breaking up the read (and write too) into a loop that read a smaller chunk at a time.

Dear twebb,
In message dbdb2ea60912131644n347ca646n3d6942d0c45f4108@mail.gmail.com you wrote:
Maybe reading 512 bytes is possible with your driver, but reading 128 KiB is not?
That turned out to be true. I wondered if others had run into this problem and whether any work had been done towards breaking up the read (and write too) into a loop that read a smaller chunk at a time.
Why don't you fix the Linux MTD driver instead?
Best regards,
Wolfgang Denk
participants (2)
-
twebb
-
Wolfgang Denk