[PATCH 4/5] env: allow default environment to be amended from control dtb

Wolfgang Denk wd at denx.de
Fri Nov 20 11:28:24 CET 2020


Dear Simon,

In message <CAPnjgZ1C3TQWkUuNQc0BHOGE957s0K-nxFmW3PVO_ObOcKwv+Q at mail.gmail.com> you wrote:
>
> Some years ago I did a series to allow the environment to come from a
> text file, thus avoiding the \0 stuff.

"env import -t" does that, you know?

> Now binman has a 'u-boot-env'
> entry type, allowing creating an environment from a text file, with
> suitable checksumming.

"env import -b" ...

> There is some advantage to having a default environment compiled into
> U-Boot that covers everything needed to boot. For one, the environment
> can be clobbered from userspace, which would otherwise render the
> device unbootable. For another, it is more secure to avoid loading
> unsigned data (the environment) from flash. Generally, for a secure
> boot, one would need to avoid loading the environment, at least
> without a lot of careful filtering.

One idea behind my rewrite of the environment handling (when I added
hast table support) was that there should be more than one way to
initialize the environment.  Until then, we always had exactly one
fixed location for the environment, probaly with a redundant copy.

The code we have now actuially allows for a much greater
flexibility.  You can initialize the environment from a selection of
copies, and (now, with proper driver support) also from several
devices.  If doen correctly, we could implement things like
"profiles", where for example each user (or use case) can select his
specific profile, initialize the environment from that, and save
change to that.  Ths could - for example - be used to switch between
"development" and "production" modes. A "reset to factory defaults"
would then just be an import from the (read-only) factory-defaults
copy.  etc.

Importing from a DT is just a logical extension as it is considered
just another storage device / driver.  [In a Unix environment, all
these would just be "files".]

It's all there.  We just have to use it.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
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
Is a computer language with goto's totally Wirth-less?


More information about the U-Boot mailing list