From mboxrd@z Thu Jan 1 00:00:00 1970 From: Detlev Zundel Date: Wed, 10 Mar 2010 11:22:31 +0100 Subject: [U-Boot] Question about fw_printenv settings In-Reply-To: <67a3f13e1003092150o19ed0f64y3c200378c73b55bf@mail.gmail.com> (Joe Culler's message of "Wed, 10 Mar 2010 13:50:46 +0800") References: <67a3f13e1003092150o19ed0f64y3c200378c73b55bf@mail.gmail.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Joe, > Hi, > > I have problems with fw_env.config in NOR flash. > Would anyone please help me solve it? Thanks. > > In my board config: > > ifdef CONFIG_NAND > #define CFG_NO_FLASH > #define CONFIG_ENV_IS_IN_NAND 1 > #define CONFIG_ENV_OFFSET 0x400000 /* add for 2008.10 */ > #define CONFIG_ENV_OFFSET_REDUND 0x404000 > #define CONFIG_ENV_SIZE 0x4000 > #else > #define CONFIG_ENV_IS_IN_FLASH 1 > #define CONFIG_ENV_ADDR (CFG_FLASH_BASE + 0x000c0000) > #define PHYS_FLASH_SIZE 0x1000000 /* 16 MB */ > #define CONFIG_ENV_SIZE 0x20000 > #define CONFIG_ENV_SECT_SIZE 0x20000 > #define CONFIG_ENV_ADDR_REDUND (CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE) > #endif Maybe you want to reconsider these settings after fixing your current problem. The idea that we have an CONFIG_ENV_SIZE additionally to CONFIG_ENV_SECT_SIZE is so that we can define an environment _smaller_ than a whole sector. This speeds up U-Boot when calculating the CRC over the environment. With your settings, U-Boot will need to read the whole 128k for this calculation. > # cat /proc/mtd > dev: size erasesize name > mtd0: 00dc0000 00020000 "Linux" > mtd1: 00100000 00020000 "User" > mtd2: 00100000 00020000 "Boot" Are you sure these partitions are correct? The sizes add to 15.75 MiB whereas above a comment says 16 MiB nor flash. Also the header above says that the first environment is at the FLASH_BASE + 768k and the second at FLASH_BASE + 896k. If the partitions here are all on nor in linear order, the environments would be somewhere in mtd0... > My fw_env.config setting: > /dev/mtd2 0x400000 0x20000 0x20000 How did you arrive at these settings? The second column is the offset into the mtd device. So you put 4 MiB there although mtd2 is only 1 MiB. > but it doesn't work :( > #fw_printenv > Read error on /dev/mtd2: Success