[PATCH] cmd: env: Add `indirect` to indirectly set values

Simon Glass sjg at chromium.org
Tue Dec 28 09:33:22 CET 2021


Hi Samuel,

On Mon, 20 Dec 2021 at 16:32, Samuel Dionne-Riel <samuel at dionne-riel.com> wrote:
>
> This allows an ergonomic-enough approximation of ${!variable} expansion.
> This could be used the following way:
>
> ```
> for target in ${boot_targets}; do
>    env indirect target_name target_name_${target}
>    # ...
> done
> ```

How is this different from:

for target in ${boot_targets}; do
   env set target_name target_name_${target}
   # ...
done

Can you add a few more details?

Also needs some sort of update to doc/

> Assuming `target_name_mmc0` and similar are set appropriately.
>
> A default value can be optionally provided.
>
> Note: this acts on environment variables, not hush variables.
>
> Signed-off-by: Samuel Dionne-Riel <samuel at dionne-riel.com>
> Cc: Simon Glass <sjg at chromium.org>
> Cc: "Marek Behún" <marek.behun at nic.cz>
> ---
>  cmd/Kconfig  |  4 ++++
>  cmd/nvedit.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 49 insertions(+)


Regards,
Simon


More information about the U-Boot mailing list