[U-Boot] [U-Boot, v6, 5/6] cmd: nvedit: env import can now import only variables passed as parameters

Tom Rini trini at konsulko.com
Fri Jul 20 22:35:54 UTC 2018


On Mon, Jul 09, 2018 at 07:16:29PM +0200, Quentin Schulz wrote:

> While the `env export` can take as parameters variables to be exported,
> `env import` does not have such a mechanism of variable selection.
> 
> Let's add the ability to add parameters at the end of the command for
> variables to be imported.
> 
> Every env variable from the env to be imported passed by parameter to
> this command will override the value of the variable in the current env.
> 
> If a variable exists in the current env but not in the imported env, if
> this variable is passed as a parameter to env import, the variable will
> be unset ONLY if the -d option is passed to env import, otherwise the
> current value of the variable is kept.
> 
> If a variable exists in the imported env, the variable in the current
> env will be set to the value of the one from the imported env.
> 
> All the remaining variables are left untouched.
> 
> As the size parameter of env import is positional but optional, let's
> add the possibility to use the sentinel '-' for when we don't want to
> give the size parameter (when the env is '\0' terminated) but we pass a
> list of variables at the end of the command.
> 
> env import addr
> env import addr -
> env import addr size
> env import addr - foo1 foo2
> env import addr size foo1 foo2
> 
> are all valid.
> 
> env import -c addr
> env import -c addr -
> env import -c addr - foo1 foo2
> 
> are all invalid because they don't pass the size parameter required for
> checking, while the following are valid.
> 
> env import addr size
> env import addr size foo1 foo2
> 
> Nothing's changed for the other parameters or the overall behaviour.
> 
> One of its use case could be to load a secure environment from the
> signed U-Boot binary and load only a handful of variables from an
> other, unsecure, environment without completely losing control of
> U-Boot.
> 
> Signed-off-by: Quentin Schulz <quentin.schulz at bootlin.com>
> Tested-by: Alex Kiernan <alex.kiernan at gmail.com>
> Tested-by: Stephen Warren <swarren at nvidia.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180720/b4b83bd0/attachment.sig>


More information about the U-Boot mailing list