[U-Boot] error executing fw_printenv

Wolfgang Denk wd at denx.de
Mon Dec 14 00:03:12 CET 2009


Dear twebb,

In message <dbdb2ea60912110929y5a41b1a7yf3d8e35c74d5661f at 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

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The only perfect science is hind-sight.


More information about the U-Boot mailing list