All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Stile <john@stilen.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] mtdparts not agreeing wiht fw_printenv
Date: Tue, 05 Mar 2013 17:20:55 -0800	[thread overview]
Message-ID: <1362532855.20183.135.camel@genx> (raw)

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?

             reply	other threads:[~2013-03-06  1:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-06  1:20 John Stile [this message]
2013-03-07  6:52 ` [U-Boot] mtdparts not agreeing wiht fw_printenv Wolfgang Denk
2013-03-08  2:00   ` John Stile

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1362532855.20183.135.camel@genx \
    --to=john@stilen.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.