Trying to read (and then modify) the uboot environment in NAND from linux userspace and I am running into some issues.
I downloaded the latest uboot and I am first trying only the latest fw_printenv on my current system: 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 # NAND example /dev/mtd0 0x60000 0x20000 0x20000 1 root:/> >From my uboot config header: #define CONFIG_ENV_OFFSET 0x60000 #define CONFIG_ENV_SIZE 0x20000 root:/> fw_printenv Cannot read bad block mark: Invalid argument root:/> 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, 0x2decca8) = -1 ENOTTY (Inappropriate ioctl for device) mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS|0x4000000, 0, 0) = 0x203b000 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 ioctl(3, MEMGETBADBLOCK, [524288]) = -1 EINVAL (Invalid argument) write(2, "Cannot read bad block mark", 26Cannot read bad block mark) = 26 write(2, ": ", 2: ) = 2 write(2, "Invalid argument", 16Invalid argument) = 16 write(2, "\n", 1 ) = 1 close(3) = 0 _exit(1) = ? root:/> I've been dealing with Mike Frysinger on the linux-mtd list and he recommended that I shoot this up to you guys. His comment was "your config though says you only have 1 block starting at 0x60000 with a length of 0x20000. so there's no reason it should be testing 0x80000 -- after all, you only care about bytes 0x60000 - 0x7ffff." I am hoping there is something that I am doing that is causing this. I would appreciate some info. Thank you. _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot