* [U-Boot] mtdparts not agreeing wiht fw_printenv
@ 2013-03-06 1:20 John Stile
2013-03-07 6:52 ` Wolfgang Denk
0 siblings, 1 reply; 3+ messages in thread
From: John Stile @ 2013-03-06 1:20 UTC (permalink / raw)
To: u-boot
I am quite confused about partitions in my NAND flash.
Linux can mount my rootfs, so partitions make sense to the kernel, but
from the shell fw_printenv can't read the uboot environment, not matter
what I use in /etc/fw_env.config.
uboot is reading the proper uboot env, and booting the system.
I am using u-boot-2013.01, buildroot-2011.11, 2.6.30 kernel,
at91sam9g20ek.
/proc/cmdline:
mem=64M console=ttyS0,115200 mtdparts=atmel_nand:0x0020000 at 0x00000000(bootstrap1)ro,0x0040000 at 0x00020000(uboot1)ro,0x01A0000 at 0x00060000(env1)ro,0x0200000 at 0x00200000(linux1),0x7C00000 at 0x00400000(rootfs1),0x0020000 at 0x08000000(bootstrap2)ro,0x0040000 at 0x08020000(uboot2)ro,0x01A0000 at 0x08060000(env2)ro,0x0200000 at 0x08200000(linux2),- at 0x08400000(rootfs2);spi0.1-AT45DB642x:0x004200 at 0x0(bootstrap3)ro,0x004200 at 0x4200(env3)ro,0x039C00 at 0x8400(uboot3)ro,0x252000 at 0x42000(linux3),- at 0x294000(rootfs3) root=/dev/mtdblock9 rw rootfstype=jffs2
/proc/mtd
dev: size erasesize name
mtd0: 00020000 00020000 "bootstrap1"
mtd1: 00040000 00020000 "uboot1"
mtd2: 001a0000 00020000 "env1"
mtd3: 00200000 00020000 "linux1"
mtd4: 07c00000 00020000 "rootfs1"
mtd5: 00020000 00020000 "bootstrap2"
mtd6: 00040000 00020000 "uboot2"
mtd7: 001a0000 00020000 "env2"
mtd8: 00200000 00020000 "linux2"
mtd9: 07c00000 00020000 "rootfs2"
mtd10: 00004200 00000420 "bootstrap3"
mtd11: 00004200 00000420 "env3"
mtd12: 00039c00 00000420 "uboot3"
mtd13: 00252000 00000420 "linux3"
mtd14: 005ac000 00000420 "rootfs3"
dmesg shows:
NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda (Micron NAND 256MiB
3,3V 8-bit)
AT91 NAND: 8-bit, Software ECC
Scanning device for bad blocks
10 cmdlinepart partitions found on MTD device atmel_nand
Creating 10 MTD partitions on "atmel_nand":
0x000000000000-0x000000020000 : "bootstrap1"
0x000000020000-0x000000060000 : "uboot1"
0x000000060000-0x000000200000 : "env1"
0x000000200000-0x000000400000 : "linux1"
0x000000400000-0x000008000000 : "rootfs1"
0x000008000000-0x000008020000 : "bootstrap2"
0x000008020000-0x000008060000 : "uboot2"
0x000008060000-0x000008200000 : "env2"
0x000008200000-0x000008400000 : "linux2"
0x000008400000-0x000010000000 : "rootfs2"
atmel_spi atmel_spi.0: Atmel SPI Controller at 0xfffc8000 (irq 12)
mtd_dataflash spi0.1: AT45DB642x (8448 KBytes) pagesize 1056 bytes (OTP)
5 cmdlinepart partitions found on MTD device spi0.1-AT45DB642x
Creating 5 MTD partitions on "spi0.1-AT45DB642x":
0x000000000000-0x000000004200 : "bootstrap3"
0x000000004200-0x000000008400 : "env3"
0x000000008400-0x000000042000 : "uboot3"
0x000000042000-0x000000294000 : "linux3"
0x000000294000-0x000000840000 : "rootfs3"
I purposefully created more /dev/mtd devices than mtdparts would
require, in order to find which partitions actually contain the uboot
env.
I used
od -t xz /dev/mtd#
to find the uboot environment partitions,
Then used
dd if=/dev/mtd# of=mtd#_env.bin
to store the contents, so I could compare them.
/dev/mtd4 and /dev/mtd5 create binary equivalent dumps of env1
/dev/mtd14 and /dev/mtd15 create binary equivalent dumps of env2.
/etc/fw_env.config does not like either of those, saying the crc does
not checkout.
/etc/fw_env.config:
/dev/mtd2 0x0 0x20000 0x20000
/dev/mtd2 0x20000 0x20000 0x20000
fw_printenv Output:
Warning: Bad CRC, using default environment
....
Can someone help explain this or what I might be doing wrong?
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] mtdparts not agreeing wiht fw_printenv
2013-03-06 1:20 [U-Boot] mtdparts not agreeing wiht fw_printenv John Stile
@ 2013-03-07 6:52 ` Wolfgang Denk
2013-03-08 2:00 ` John Stile
0 siblings, 1 reply; 3+ messages in thread
From: Wolfgang Denk @ 2013-03-07 6:52 UTC (permalink / raw)
To: u-boot
Dear John Stile,
In message <1362532855.20183.135.camel@genx> you wrote:
> I am quite confused about partitions in my NAND flash.
>
> Linux can mount my rootfs, so partitions make sense to the kernel, but
> from the shell fw_printenv can't read the uboot environment, not matter
> what I use in /etc/fw_env.config.
That means that all settings were incorrect.
> dev: size erasesize name
> mtd0: 00020000 00020000 "bootstrap1"
> mtd1: 00040000 00020000 "uboot1"
> mtd2: 001a0000 00020000 "env1"
^^^^^^ mtd2
> mtd3: 00200000 00020000 "linux1"
> mtd4: 07c00000 00020000 "rootfs1"
> mtd5: 00020000 00020000 "bootstrap2"
> mtd6: 00040000 00020000 "uboot2"
> mtd7: 001a0000 00020000 "env2"
^^^^^^ mtd7
> mtd8: 00200000 00020000 "linux2"
> mtd9: 07c00000 00020000 "rootfs2"
> mtd10: 00004200 00000420 "bootstrap3"
> mtd11: 00004200 00000420 "env3"
^^^^^^ mtd11
> mtd12: 00039c00 00000420 "uboot3"
> mtd13: 00252000 00000420 "linux3"
> mtd14: 005ac000 00000420 "rootfs3"
>
What's that? This makes no sense to me - either you have a single copy
of the environment, or two (in case of redudant env). Three copies is
not a supported configuration.
> I purposefully created more /dev/mtd devices than mtdparts would
> require, in order to find which partitions actually contain the uboot
> env.
mtdparts does not "require" anything. You configure your systems as
needed, and then set mtdparts to match that setting. SO the setting
comes first (starting in your head or - probably better - on a sheet
of paper), and then you set mtdparts as needed.
> /dev/mtd4 and /dev/mtd5 create binary equivalent dumps of env1
> /dev/mtd14 and /dev/mtd15 create binary equivalent dumps of env2.
The names and use of your partitions is in serious mismatch. Fix this
first!
> /etc/fw_env.config does not like either of those, saying the crc does
> not checkout.
>
> /etc/fw_env.config:
> /dev/mtd2 0x0 0x20000 0x20000
> /dev/mtd2 0x20000 0x20000 0x20000
Well, if you find the environment in /dev/mtd4 and /dev/mtd5, then you
should use these in the fw_env.config
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Making files is easy under the UNIX operating system. Therefore,
users tend to create numerous files using large amounts of file
space. It has been said that the only standard thing about all UNIX
systems is the message-of-the-day telling users to clean up their
files. - System V.2 administrator's guide
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] mtdparts not agreeing wiht fw_printenv
2013-03-07 6:52 ` Wolfgang Denk
@ 2013-03-08 2:00 ` John Stile
0 siblings, 0 replies; 3+ messages in thread
From: John Stile @ 2013-03-08 2:00 UTC (permalink / raw)
To: u-boot
Dear Wolfgang Denk ,
On Thu, 2013-03-07 at 07:52 +0100, Wolfgang Denk wrote:
> Dear John Stile,
>
> In message <1362532855.20183.135.camel@genx> you wrote:
> > I am quite confused about partitions in my NAND flash.
> >
> > Linux can mount my rootfs, so partitions make sense to the kernel, but
> > from the shell fw_printenv can't read the uboot environment, not matter
> > what I use in /etc/fw_env.config.
>
> That means that all settings were incorrect.
All settings where not incorrect.
>
> > dev: size erasesize name
> > mtd0: 00020000 00020000 "bootstrap1"
> > mtd1: 00040000 00020000 "uboot1"
> > mtd2: 001a0000 00020000 "env1"
> ^^^^^^ mtd2
> > mtd3: 00200000 00020000 "linux1"
> > mtd4: 07c00000 00020000 "rootfs1"
> > mtd5: 00020000 00020000 "bootstrap2"
> > mtd6: 00040000 00020000 "uboot2"
> > mtd7: 001a0000 00020000 "env2"
> ^^^^^^ mtd7
> > mtd8: 00200000 00020000 "linux2"
> > mtd9: 07c00000 00020000 "rootfs2"
> > mtd10: 00004200 00000420 "bootstrap3"
> > mtd11: 00004200 00000420 "env3"
> ^^^^^^ mtd11
> > mtd12: 00039c00 00000420 "uboot3"
> > mtd13: 00252000 00000420 "linux3"
> > mtd14: 005ac000 00000420 "rootfs3"
> >
> What's that? This makes no sense to me - either you have a single copy
> of the environment, or two (in case of redudant env). Three copies is
> not a supported configuration.
>
> > I purposefully created more /dev/mtd devices than mtdparts would
> > require, in order to find which partitions actually contain the uboot
> > env.
>
> mtdparts does not "require" anything. You configure your systems as
> needed, and then set mtdparts to match that setting. SO the setting
> comes first (starting in your head or - probably better - on a sheet
> of paper), and then you set mtdparts as needed.
>
Right. Even without the /dev/mtd character device files, the system
boots.
This post comes way after a lot of work on paper.
> > /dev/mtd4 and /dev/mtd5 create binary equivalent dumps of env1
> > /dev/mtd14 and /dev/mtd15 create binary equivalent dumps of env2.
>
> The names and use of your partitions is in serious mismatch. Fix this
> first!
The problem turned out to be due to my /dev/mtd character device files
had sequential minor numbers.
> > /etc/fw_env.config does not like either of those, saying the crc does
> > not checkout.
> >
> > /etc/fw_env.config:
> > /dev/mtd2 0x0 0x20000 0x20000
> > /dev/mtd2 0x20000 0x20000 0x20000
>
> Well, if you find the environment in /dev/mtd4 and /dev/mtd5, then you
> should use these in the fw_env.config
>
> Best regards,
>
> Wolfgang Denk
>
Like I said, I think, even those did not work.
When I created my /dev/mtd character device files to use even minor
numbers, I was able to see my env in /dev/mtd2 /dev/mtd7 using od:
od -t xz /dev/mtd2
od -t xz /dev/mtd7
And fw_printenv also worked.
One site said read-write device will have even minor numbers.
Since I am using a 2.6.30 kernel, without tmpdevfs, I rely on
buildroot's target/generic/device_table_dev.txt to generate my devices,
and it was there I had not set the proper values:
# MTD stuff
# <name> <type> <mode> <uid> <gid> <major> <minor> <start> <inc> <count>
/dev/mtd c 640 0 0 90 0 0 2 20
Thank you for your help.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-03-08 2:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-06 1:20 [U-Boot] mtdparts not agreeing wiht fw_printenv John Stile
2013-03-07 6:52 ` Wolfgang Denk
2013-03-08 2:00 ` John Stile
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox