
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@0x00000000(bootstrap1)ro,0x0040000@0x00020000(uboot1)ro,0x01A0000@0x00060000(env1)ro,0x0200000@0x00200000(linux1),0x7C00000@0x00400000(rootfs1),0x0020000@0x08000000(bootstrap2)ro,0x0040000@0x08020000(uboot2)ro,0x01A0000@0x08060000(env2)ro,0x0200000@0x08200000(linux2),-@0x08400000(rootfs2);spi0.1-AT45DB642x:0x004200@0x0(bootstrap3)ro,0x004200@0x4200(env3)ro,0x039C00@0x8400(uboot3)ro,0x252000@0x42000(linux3),-@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?