[U-Boot] env_flash.c:saveenv() broken when env is smaller than a sector

Wolfgang Denk wd at denx.de
Mon Jan 17 21:23:57 CET 2011


Dear Mike Frysinger,

In message <201012292139.05901.vapier at gentoo.org> you wrote:
>
> seems the new saveenv code in the non-redund case has been rewritten 
> completely and doesn't support the same feature set as it used to.
...
> so the difference is that the new code no longer supports envs which do not
> start on a sector boundary.  it does this so that it doesn't memcpy() as much 
> data out of the flash at the expense of doing more CPU bound math operations 
> (mostly bit twiddling).
> 
> so the question is whether the old behavior should be restored.  if it not,

The change was not intentional. Sorry.

I don't have a clear opinion if it's worth the effort to restore
the old behavior - it seems it has never been used much (OK, you did).

> the documentation should be tweaked to note these requirements and some simple 
> CPP checks added to environment.h so that this issue turns into a build 
> failure.  after all, it's easy to detect an env offset that isnt at the start 
> of the sector:
> 	#if (CONFIG_ENV_OFFSET & (CONFIG_ENV_SECT_SIZE - 1))
> 	# error env offset not sector aligned
> 	#endif

I agree that adding such a test would be a good thing - please submit
a patch.  Or one to restore the old behaviour, if you prefer.

Thanks.


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
e-credibility: the non-guaranteeable likelihood that  the  electronic
data you're seeing is genuine rather than somebody's made-up crap.
- Karl Lehenbauer


More information about the U-Boot mailing list