[U-Boot] Problems with fw_printenv

Ronald Kortekaas Ronald.Kortekaas at CHESS.NL
Wed Mar 3 10:14:24 CET 2010


I have some problems with the fw_printenv tool. I use the following versions of u-boot, kernel and compiler:


-       u-boot-2009.11.1

-       linux-2.6.22

-       gcc-3.4.3-glibc-2.3.2 arm-linux-

The problem is that the fw_printenv complains about: "Warning: Bad CRC, using default environment".

My U-boot configuration for the environment is:

#define PHYS_FLASH_1                                   0xc0000000
#define CONFIG_ENV_IS_IN_FLASH
#define CONFIG_ENV_OFFSET                      (0x40000)
#define CONFIG_ENV_SECT_SIZE                 0x20000                 /* Env sector Size */
#define CONFIG_ENV_SIZE                             CONFIG_ENV_SECT_SIZE

#define MTDIDS_DEFAULT                              "nor0=physmap-flash.0"
#define MTDPARTS_DEFAULT        "mtdparts=physmap-flash.0:256k(uboot)ro,128k(ubootenv),4096k(kernel)"

Mtd in u-boot prints:

device nor0 <physmap-flash.0>, # parts = 3
 #: name                size            offset          mask_flags
 0: uboot               0x00040000      0x00000000      1
 1: ubootenv            0x00020000      0x00040000      0
 2: kernel              0x00400000      0x00060000      0

active partition: nor0,0 - (uboot) 0x00040000 @ 0x00000000

defaults:
mtdids  : nor0=physmap-flash.0
mtdparts: mtdparts=physmap-flash.0:256k(uboot)ro,128k(ubootenv),4096k(kernel)

So my environment is located at 0xc0040000. My /proc/mtd is:

dev:    size   erasesize  name
mtd0: 00800000 00020000 "NOR flash on Clever"
mtd1: 00040000 00020000 "uboot"
mtd2: 00020000 00020000 "ubootenv"
mtd3: 00400000 00020000 "Kernel"

My fw_env.config is:

/dev/mtd2               0x0000          0x20000         0x20000

When I copy the /dev/mtd2 to a file I see the environment variables from U-Boot. This starts with "Gøwbootdelay=5"
When I do a fw_setenv bootdelay 4, it says "Warning: Bad CRC, using default environment". But if I use then fw_printenv everything is fine.
If I copy the contents of /dev/mtd2 to a file is starts with: "Ð       U(bootcmd=bootp". So I can write the environment from linux but not read it from u-boot.

If I restarts my board U-boot compains about a bad CRC (this is the expected result). So I looks like the offsets are wrong because my kernel image get damaged after saving the environment from linux.



More information about the U-Boot mailing list