User error with fw_printenv - I hope
Bishop, Mark
Mark.Bishop at cooperindustries.com
Tue Apr 3 19:09:41 EDT 2012
> -----Original Message-----
> From: Mike Frysinger [mailto:vapier.adi at gmail.com]
> Sent: Tuesday, April 03, 2012 3:22 PM
> To: Bishop, Mark
> Cc: linux-mtd at lists.infradead.org
> Subject: Re: User error with fw_printenv - I hope
>
> On Tue, Apr 3, 2012 at 08:59, Bishop, Mark wrote:
> > I don't have a print_loff_t(). I have a ioctl_decode() instead and I
> am trying to cram your patch into it.
>
> all the print_loff_t does is process a pointer to an int. you could
> probably do the same thing by changing the mtd.c file to process the
> int directly (look at the other ioctls that do umove() with &i).
> -mike
Thanks Mike. Hopefully you can tell me what I need to do here:
root:/> strace fw_printenv
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x4000000, -1, 0) = 0x2950000
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) = 0x2d18000
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) = 0x2d19000
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) = 0x2d90000
mmap2(NULL, 8184, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2d50000
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(0x2d19000, 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) = 0x2d19000
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) = 0x2d48000
pread(3, "__get_myaddress: socket\0__get_my"..., 8840, 241664) = 8840
close(3) = 0
munmap(0x2d19000, 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(0x2d18000, 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, 0x2e1fb78) = -1 ENOTTY (Inappropriate ioctl for device)
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS|0x4000000, 0, 0) = 0x2d18000
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, [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:/>
root:/> cat /etc/fw_env.config
# Configuration file for fw_(printenv/saveenv) utility.
# Up to two entries are valid, in this case the redundant
# environment sector is assumed present.
# Notice, that the "Number of sectors" is ignored on NOR.
# MTD device name Device offset Env. size Flash sector size Number of sectors
#/dev/mtd1 0x0000 0x4000 0x4000
#/dev/mtd2 0x0000 0x4000 0x4000
# NAND example
/dev/mtd0 0x60000 0x20000 0x20000 1
root:/>
More information about the linux-mtd
mailing list