User error with fw_printenv - I hope
Bishop, Mark
Mark.Bishop at cooperindustries.com
Mon Apr 2 13:37:34 EDT 2012
> -----Original Message-----
> From: Mike Frysinger [mailto:vapier.adi at gmail.com]
> Sent: Friday, March 30, 2012 6:30 PM
> To: Bishop, Mark
> Cc: linux-mtd at lists.infradead.org
> Subject: Re: User error with fw_printenv - I hope
>
> On Fri, Mar 30, 2012 at 16:54, Bishop, Mark wrote:
> > I am trying to read my uboot environment from userspace. Not too
> successful.
> >
> > root:/> cat /proc/mtd
> > dev: size erasesize name
> > mtd0: 00080000 00020000 "bootloader(nand)"
> > mtd1: 00800000 00020000 "linux kernel(nand)"
> > mtd2: 06400000 00020000 "file system(nand)"
> > mtd3: 09380000 00020000 "file system(ubifs)"
> >
> > From my uboot config:
> > #define CONFIG_ENV_OFFSET 0x60000
> > #define CONFIG_ENV_SIZE 0x20000
> >
> > Try #1
> > root:/> cat /etc/fw_env.config
> > /dev/mtd0 0x60000 0x20000
> 0x20000 1
> >
> > root:/> ./fw_printenv
> > Cannot read bad block mark: Invalid argument
>
> strace it to see what is actually complaining
> -mike
root:/> strace fw_printenv
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x4000000, -1, 0) = 0x886000
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) = 0x89f000
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) = 0x890000
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) = 0x270000
mmap2(NULL, 8184, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x892000
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(0x890000, 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) = 0x890000
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) = 0x800000
mmap2(NULL, 17920, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x888000
pread(3, "__get_myaddress: socket\0__get_my"..., 8840, 241664) = 8840
close(3) = 0
munmap(0x890000, 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(0x89f000, 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) = 0x89f000
read(3, "/dev/mtd0 0x60000 "..., 256) = 74
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) = 0x840000
open("/dev/mtd0", O_RDONLY) = 3
ioctl(3, MEMGETINFO or MFB_SET_CHROMA_KEY, 0x2dffc20) = 0
ioctl(3, MEMGETBADBLOCK, 0x2dffb9c) = 1
ioctl(3, MEMGETBADBLOCK, 0x2dffb9c) = -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:/>
More information about the linux-mtd
mailing list