[U-Boot] fw_printenv can't read the uboot enviroment from NAND

Bishop, Mark Mark.Bishop at cooperindustries.com
Wed Apr 4 21:50:21 CEST 2012


> -----Original Message-----
> From: Mike Frysinger [mailto:vapier at gentoo.org]
> Sent: Wednesday, April 04, 2012 1:15 PM
> To: u-boot at lists.denx.de
> Cc: Bishop, Mark
> Subject: Re: [U-Boot] fw_printenv can't read the uboot enviroment from
> NAND
> 
> On Wednesday 04 April 2012 12:00:42 Bishop, Mark wrote:
> > root:/> cat /etc/fw_env.config
> > /dev/mtd0               0x60000         0x20000         0x20000 1
> >
> > ioctl(3, MEMGETINFO, {type=MTD_NANDFLASH, flags=MTD_WRITEABLE,
> > size=0x80000, erasesize=0x20000, writesize=0x800, oobsize=0x40,
> > padding=0xffffffff}) = 0
> > ioctl(3, MEMGETBADBLOCK, [0x60000])      = 1
> > ioctl(3, MEMGETBADBLOCK, [0x80000])      = -1 EINVAL (Invalid
> argument)
> 
> to summarize further: the flash is 0x80000 bytes long, and he's using
> the last sector in flash to hold his env, and fw_printenv seems to
have
> an off-by-one in the badblock check.  there's no reason it should be
> checking 0x80000.
> -mike

Don't know if this helps:
root:/> cat /etc/fw_env.config
# Configuration file for fw_(printenv/saveenv) utility.
# MTD device name       Device offset   Env. size       Flash sector
size       Number of sectors
/dev/mtd0               0x60000         0x1ffff         0x1ffff
1

root:/> fw_printenv
Too few good blocks within range

root:/> strace  fw_printenv
mmap2(NULL, 4096, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_ANONYMOUS|0x4000000, -1, 0) = 0x2d5c000
stat("/etc/ld.so.cache", {st_mode=S_IFREG|0644, st_size=1108, ...}) = 0
open("/etc/ld.so.cache", O_RDONLY)      = 3
mmap2(NULL, 1108, PROT_READ, MAP_PRIVATE, 3, 0) = 0x209a000
close(3)                                = 0
open("/lib/libgcc_s.so.1", O_RDONLY)    = 3
fstat(3, {st_mode=S_IFREG|0755, st_size=62416, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_ANONYMOUS|0x4000000, -1, 0) = 0x2d5f000
read(3,
"\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0j\0\1\0\0\0\324#\0\0004\0\0\0"...,
4096) = 4096
mmap2(NULL, 57256, PROT_READ|PROT_EXEC,
MAP_PRIVATE|MAP_DENYWRITE|MAP_EXECUTABLE, 3, 0) = 0x2e00000
mmap2(NULL, 8184, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0x2e10000
pread(3,
"\17d\325/\0h\5h;/\353\2708\242\202\316\6\302\322\270\0\0\377\343\35\372
\216/8\256\302\254"..., 8024, 53248) = 8024
close(3)                                = 0
munmap(0x2d5f000, 4096)                 = 0
open("/lib/libc.so.0", O_RDONLY)        = 3
fstat(3, {st_mode=S_IFREG|0755, st_size=252236, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_ANONYMOUS|0x4000000, -1, 0) = 0x2d5f000
read(3,
"\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0j\0\1\0\0\0\f\313\0\0004\0\0\0"...,
4096) = 4096
mmap2(NULL, 243908, PROT_READ|PROT_EXEC,
MAP_PRIVATE|MAP_DENYWRITE|MAP_EXECUTABLE, 3, 0) = 0x2e40000
mmap2(NULL, 17920, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0x2e18000
pread(3, "__get_myaddress: socket\0__get_my"..., 8840, 241664) = 8840
close(3)                                = 0
munmap(0x2d5f000, 4096)                 = 0
open("/lib/libc.so.0", O_RDONLY)        = 3
fstat(3, {st_mode=S_IFREG|0755, st_size=252236, ...}) = 0
close(3)                                = 0
munmap(0x209a000, 1108)                 = 0
stat("/lib/ld-uClibc.so.0", {st_mode=S_IFREG|0755, st_size=20348, ...})
= 0
ioctl(0, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS,
{B57600 opost isig icanon echo ...}) = 0
ioctl(1, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS,
{B57600 opost isig icanon echo ...}) = 0
open("/etc/fw_env.config", O_RDONLY)    = 3
ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS,
0x2dffb78) = -1 ENOTTY (Inappropriate ioctl for device)
mmap2(NULL, 4096, PROT_READ|PROT_WRITE,
MAP_SHARED|MAP_ANONYMOUS|0x4000000, 0, 0) = 0x209a000
read(3, "# Configuration file for fw_(pri"..., 256) = 256
read(3, "Flash sector size\tNumber of sect"..., 256) = 163
read(3, "", 256)                        = 0
close(3)                                = 0
stat("/dev/mtd0", {st_mode=S_IFCHR|0660, st_rdev=makedev(90, 0), ...}) =
0
mmap2(NULL, 135168, PROT_READ|PROT_WRITE,
MAP_SHARED|MAP_ANONYMOUS|0x4000000, 0, 0) = 0x2e80000
open("/dev/mtd0", O_RDONLY)             = 3
ioctl(3, MEMGETINFO or MFB_SET_CHROMA_KEY, {type=MTD_NANDFLASH,
flags=MTD_WRITEABLE, size=0x80000, erasesize=0x20000, writesize=0x800,
oobsize=0x40, padding=0xffffffff}) = 0
ioctl(3, MEMGETBADBLOCK, [393216])      = 1
ioctl(3, MEMGETBADBLOCK, [524287])      = 1
write(2, "Too few good blocks within range"..., 33Too few good blocks
within range
) = 33
close(3)                                = 0
_exit(1)




More information about the U-Boot mailing list