From: Wolfgang Denk Date: Wed, 07 Sep 2011 22:55:41 +0200 Subject: [U-Boot] [PATCH] Fix fw_env bug for multi-sector environments on NOR flash In-Reply-To: <1314730318-3070-1-git-send-email-yiyang.fei@barco.com> References: <1314730318-3070-1-git-send-email-yiyang.fei@barco.com> Message-ID: <20110907205541.DBAC5140875B@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear "Yiyang Fei", In message <1314730318-3070-1-git-send-email-yiyang.fei@barco.com> you wrote: > When storing u-boot environment variables on a NOR flash using multiple > sectors, the following error occurs when writing changes using > fw_setenv. > > /etc # cat fw_env.config > /dev/mtd12 0x0000 0x20000 0x10000 2 > > /etc # fw_setenv test test > End of range reached, aborting > Error: can't write fw_env to flash > > The reason for the error is that although both sectors are written in > one pass, the loop for the write is executed twice because the > "processed" variable is incremented by the incorrect amount. > > Signed-off-by: Yiyang Fei > --- > tools/env/fw_env.c | 5 ++--- > 1 files changed, 2 insertions(+), 3 deletions(-) > > diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c > index ed6b53f..e6b2cae 100644 > --- a/tools/env/fw_env.c > +++ b/tools/env/fw_env.c > @@ -880,9 +880,8 @@ static int flash_write_buf (int dev, int fd, void > *buf, size_t count, Line wrapped and does not apply. Please fix your mailer and resubmit. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "I may be synthetic, but I'm not stupid" - the artificial person, from _Aliens_