[U-Boot] [PATCH] tools/env: check flash length before probing
Bishop, Mark
Mark.Bishop at cooperindustries.com
Thu Apr 5 15:15:12 CEST 2012
> -----Original Message-----
> From: u-boot-bounces at lists.denx.de [mailto:u-boot-
> bounces at lists.denx.de] On Behalf Of Mike Frysinger
> Sent: Thursday, April 05, 2012 1:29 AM
> To: u-boot at lists.denx.de
> Subject: [U-Boot] [PATCH] tools/env: check flash length before probing
>
> If we attempt to probe beyond the end of flash, MEMGETBADBLOCK will
> fail
> (as well it should), but we end up erroring out with the distracting:
> Cannot read bad block mark: Invalid argument
>
> Instead of the correct error:
> Too few good blocks within range
>
> Re-order the tests so we check for the end of the flash before probing
> so we don't probe blocks that don't exist.
>
Applied the patch:
root:/bin> fw_printenv
Too few good blocks within range
root:/bin> strace fw_printenv
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,
0x2d9ccb4) = -1 ENOTTY (Inappropriate ioctl for device)
mmap2(NULL, 4096, PROT_READ|PROT_WRITE,
MAP_SHARED|MAP_ANONYMOUS|0x4000000, 0, 0) = 0x2d55000
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) = 0x2e00000
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
write(2, "Too few good blocks within range"..., 33Too few good blocks
within range
) = 33
close(3) = 0
_exit(1) = ?
root:/bin>
More information about the U-Boot
mailing list