From: Phil Sutter Date: Fri, 7 Dec 2012 17:58:53 +0100 Subject: [U-Boot] [PATCH 2/4] env_nand.c: support falling back to redundant env when writing In-Reply-To: <20121207115334.GB9226@philter.vipri.net> References: <20121128210600.GA3220@philter.vipri.net> <1354817919.8062.8@snotra> <20121207115334.GB9226@philter.vipri.net> Message-ID: <20121207165853.GE22029@philter.vipri.net> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Scott, On Fri, Dec 07, 2012 at 12:53:34PM +0100, Phil Sutter wrote: > On Thu, Dec 06, 2012 at 12:18:39PM -0600, Scott Wood wrote: > > On 11/28/2012 03:06:00 PM, Phil Sutter wrote: > > > Hi, > > > > > > On Tue, Nov 27, 2012 at 04:04:15PM -0600, Scott Wood wrote: > > > > On 11/21/2012 06:59:19 AM, Phil Sutter wrote: > > > > > Without this patch, when the currently chosen environment to be > > > > > written > > > > > has bad blocks, saveenv fails completely. Instead, when there is > > > > > redundant environment fall back to the other copy. Environment > > > reading > > > > > needs no adjustment, as the fallback logic for incomplete writes > > > > > applies > > > > > to this case as well. > > > > > > > > > > Signed-off-by: Phil Sutter > > > > > > > > Isn't this what CONFIG_ENV_RANGE is supposed to deal with? > > > > > > Yes, that is more or less what is supposed to help for cases like > > > this. > > > But given the fact that CONFIG_ENV_RANGE needs to span multiple erase > > > pages which in our case are 128k in size, this is quite a deal. > > > Especially since one needs to have multiple pages for both normal and > > > redundant environment to be really sure. > > > > And *that* is what CONFIG_ENV_OFFSET_OOB is supposed to deal with. :-) > > Good to know, I already wondered what exactly this option is there for. Hmm. Does not look like CONFIG_ENV_OFFSET_OOB is used to select the block(s) within the erase page to save the environment. Looking at common/env_nand.c:318, the environment offset saved in the OOB seems to be in erase page unit. On the other hand, I could not find code that alters this setting based on bad blocks found or whatever. This seems to simply be an alternative to setting CONFIG_ENV_OFFSET at build-time. Best wishes, Phil Sutter Software Engineer -- Viprinet Europe GmbH Mainzer Str. 43 55411 Bingen am Rhein Germany Phone/Zentrale: +49 6721 49030-0 Direct line/Durchwahl: +49 6721 49030-134 Fax: +49 6721 49030-109 phil.sutter at viprinet.com http://www.viprinet.com Registered office/Sitz der Gesellschaft: Bingen am Rhein, Germany Commercial register/Handelsregister: Amtsgericht Mainz HRB44090 CEO/Gesch?ftsf?hrer: Simon Kissel