All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [RFD] store env size in env area (+ cookie + len)
@ 2010-08-12  6:43 Frans Meulenbroeks
  2010-08-12  6:57 ` Reinhard Meyer
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Frans Meulenbroeks @ 2010-08-12  6:43 UTC (permalink / raw)
  To: u-boot

I've seen a few times that people get a u-boot with their board and
want to use fw_setenv under linux to tweak with environment variables.
This requires them to come up with an fw-env.config (if not provided).
One of the things that I've seen, that some people have trouble with
it is obtaining the proper size of the environment area to be stuffed
in that file.

This is something that could be resolved quite easily by adding the
size of the environment area to the header preceding the environment
(which now contains a checksum and, in case of redundant areas, a flag
byte)

Pro: no more need to give sizes in fw-env.config
Con: uses a 2-4 more bytes (personally I'd say size is 4 bytes just to be safe)
Con: not compatible with current env layout so (without precautions) a
new u-boot cannot  use the old env and vice versa.

If compatibility is deemed important, we could extend the header also
with a magic cookie and a version number. If absent it is an old style
env, if present it is a new style env. Version number then can also be
used should there be future changes in the env layout.
(if compatibility is not deemed important of course this is not needed).

Btw thinking about cookies: if the env were to have a cookie in either
the header or e.g. as first env var, fw_setenv would not even need
fw-env.config at all. It could just seek in /dev/mtd (I'm assuming env
in flash here) for the cookie.
This seeking should not take too much time if we can assume (or have a
config var) a certain alignment (e.g. on flash page size). After
finding the cookie of course still a crc check would be done to
validate the area.

If desired I can do some implementation work for this and submit a
patch, but before investing time in it I would like to find out if
there is actual interest in this and if this is considered useful.

Summarizing the questions:
- is it desirable to have the env length added to the env header
- is it desirable to have a cookie added to the env header
- is it desirable to have a version number added to the env header

Best regards, Frans.

PS: if we are going to touch the env header, I would suggest to always
have the redundant flag in the header even if there is only  one
environment. It will probably make the code to load the env a little
bit simpler).

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2010-08-12 10:15 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-12  6:43 [U-Boot] [RFD] store env size in env area (+ cookie + len) Frans Meulenbroeks
2010-08-12  6:57 ` Reinhard Meyer
2010-08-12  7:27 ` Matthias Weißer
2010-08-12  8:07   ` Alexander Stein
2010-08-12  8:41     ` Wolfgang Denk
     [not found]   ` <AANLkTi=LrEok8wT0Q0bt+rXYckPtFZasBRf=_1oeKCk4@mail.gmail.com>
2010-08-12  8:11     ` Matthias Weißer
2010-08-12  8:17       ` Reinhard Meyer
2010-08-12  8:35         ` Reinhard Meyer
2010-08-12  8:50           ` Wolfgang Denk
2010-08-12  8:47         ` Wolfgang Denk
2010-08-12  9:03           ` Reinhard Meyer
2010-08-12 10:15             ` Wolfgang Denk
2010-08-12  8:46       ` Wolfgang Denk
2010-08-12  8:38 ` Wolfgang Denk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.