From mboxrd@z Thu Jan 1 00:00:00 1970 From: Grant Erickson Date: Sun, 06 Feb 2011 13:33:48 -0800 Subject: [U-Boot] U-Boot 2010.12 Cannot Successfully Save Variables with Redundant NAND Environment In-Reply-To: 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 On 2/6/11 12:41 PM, Grant Erickson wrote: > I recently updated my TI AM37x EVM from U-Boot 2010.09 to 2010.12 and noticed > that, in doing so, saveenv / env save no longer seems to work. The following > example demonstrates [ELIDED]: I subsequently found the following patch and commit: http://www.mail-archive.com/u-boot at lists.denx.de/msg46834.html http://git.denx.de/?p=u-boot.git;a=commitdiff;h=920a5dd2325438a82b6ac8102c5a 5e0c43276fd;hp=42d44f631c4e8e5359775bdc098f2fffde4e5c05 However, it's not clear how this patch can reasonably work outside of random chance: // Allocate a new environment on the stack. The environment structure is // whatever random data is already on the stack. env_t env_new; ... // At this point, the data field will be initialized; however, crc and // flags are still random data. res = (char *)&env_new.data; len = hexport_r(&env_htab, '\0', &res, ENV_SIZE); // The crc field is now set. env_new.crc = crc32(0, env_new.data, ENV_SIZE); // Preincrement random data. ++env_new.flags; /* increase the serial */ Unfortunately, preincrementing random data won't replicate the behavior of 2010.09, where the flags field was referenced through a global env_ptr such that flag manipulation was handled (more) coherently as the environment was read and written. Best, Grant