[U-Boot] [RFD] store env size in env area (+ cookie + len)

Wolfgang Denk wd at denx.de
Thu Aug 12 10:46:36 CEST 2010


Dear =?ISO-8859-1?Q?Matthias_Wei=DFer?=,

In message <4C63ACA6.6080303 at arcor.de> you wrote:
> Am 12.08.2010 09:54, schrieb Frans Meulenbroeks:
> > 2010/8/12 Matthias Weißer<weisserm at arcor.de>:
> >> Why not store the size of the environment sector as env variable? The size
> >> should be only needed for storing the environment and not for loading (as it
> >> is terminated by a '\0'). So we could load the environment, check for
> >> "env_size" and if its not there take the value from fw_env.config
> >
> > Currently the crc of the environment is calculated and if it does not
> > match with the stored crc the default environment is used.
> > For determining the crc the size is needed so storing the size in the
> > env creates some form of catch-22. Of course the code could be
> > modified to first peek at the unverified env to find the size.
> > That is a different approach. Imho not too neat.

Was this an off-list reply? I cannot see any trace of this message on
the list.

Please always keep the list on Cc: !

> I see. I was thinking that the CRC is only calculated over the
> environment until the '\0' end mark is reached. But after checking my
> environment code I see that the CRC is calculated over the whole sector.

For the sake of simplicity it should be possible to assume that the
CRC is correct, look up the env_size variable, and then check the CRC
with the length thus found.

> > Wrt the format: I understood from the mail from Reinhard that the way
> > the env is stored is going to change anyway. I saw the patches of
> > Wolfgang pass by, but didn't have time to study them yet.

The external storage format will NOT change. Compatibility with
existing code (not only in U-Boot) is a major concern of all such
changes.

> I also didn't go that deep into Wolfgangs patches but from what I
> understand the "on disk format" will not change. Will it?

No, it ill remain exactly the same.

> Maybe the size could be added at the end of the environment (behind the
> '\0'). So we wouldn't loose compatibility.

It would add new issues, like when the envrionment is filing up.

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
Change is the essential process of all existence.
	-- Spock, "Let That Be Your Last Battlefield",
	   stardate 5730.2


More information about the U-Boot mailing list