U-Boot environment management from userspace

Adriana Kobylak anoo at linux.ibm.com
Thu May 30 01:30:29 AEST 2019


> Am I the only one that has a need for this or is there a wider
> audience that would benefit?

The software manager (phosphor-bmc-code-mgmt) relies on U-Boot 
environment
variables for managing the images like for determining which image to 
boot
from.

> 3) Use a one-shot service that parses the 'instance' to extract a
> variable name and variable value. Then the variable could be activated
> by launching ubootenv at foo=bar.service. This would require some fancy
> parameter encoding to make it all work correctly to avoid string
> injections.

Yeah, we went that route with an obmc-flash-bmc-setenv at .service[1], with
like you mentioned uses some 'fancy parameter encoding', ex:
"obmc-flash-bmc-setenv@" + entryId + "\\x3d" + std::to_string(value) + 
".service";

This has worked so far but I'd be open on having a mapping of the env
variables to D-Bus properties.

> Reading U-Boot environment variables from userspace is not difficult,
> but to do it in a standard way, (fw_printenv), it requires a fork and
> exec.

We're actually reading the mtd device to get the values of the variables
to avoid having a 'system' or 'fork/exec' call, then we put those values
in D-Bus properties under the software/ path. Having some other app do 
that
parsing would be nice especially if we're to expand the use of the 
U-Boot
env vars.

---
[1] 
https://github.com/openbmc/phosphor-bmc-code-mgmt/blob/master/obmc-flash-bmc-setenv%40.service




More information about the openbmc mailing list