[PATCH 0/5] allow default environment to be amended from dtb

Rasmus Villemoes rasmus.villemoes at prevas.dk
Tue Nov 10 21:25:58 CET 2020


These patches introduce the ability to amend the default environment
baked into the U-Boot binary by a DT property under /config. This is
useful to create a few different images based on the same U-Boot
binary, e.g. one for normal use, one for development and one for
bootstrapping the board. It's also useful when SPL loads U-Boot from a
FIT image and decides between multiple possible control DTBs; those
control DTBs can then contain tweaks of the default environment
suitable for that particular board variant.

There are already various /config/ properties one can use for some of
this; e.g. /config/bootdelay overrides any bootdelay set in the
environment. This is intended as a flexible way to achieve these kinds
of tweaks instead of adding more /config/* properties. [It should be
noted that adding "bootdelay=123" to /config/default-environment is
not a drop-in replacement for setting /config/bootdelay to 123, as the
latter takes effect whether the environment is the default one or one
loaded from storage.]

It does not affect the case where an environment is loaded from a
storage device, nor is there any change if the new CONFIG_ option is
not selected.

Rasmus Villemoes (5):
  fdtdec: make fdtdec_get_config_string() return const char*
  fdtdec: introduce fdtdec_get_config_property
  env: make env_set_default_vars() return void
  env: allow default environment to be amended from control dtb
  test: add tests for default environment

 arch/arm/mach-exynos/include/mach/mipi_dsim.h |   2 +-
 arch/arm/mach-rockchip/rk3188/rk3188.c        |   2 +-
 board/dhelectronics/dh_stm32mp1/board.c       |   2 +-
 board/firefly/firefly-rk3288/firefly-rk3288.c |   2 +-
 board/st/stm32mp1/stm32mp1.c                  |   2 +-
 cmd/nvedit.c                                  |  37 +++++++
 common/cli.c                                  |   2 +-
 configs/sandbox64_defconfig                   |   1 +
 configs/sandbox_defconfig                     |   1 +
 env/Kconfig                                   |  21 ++++
 env/common.c                                  |  23 +++-
 include/configs/sandbox.h                     |   8 +-
 include/env.h                                 |   2 +-
 include/fdtdec.h                              |  16 ++-
 lib/fdtdec.c                                  |  29 +++--
 test/env/Makefile                             |   1 +
 test/env/default.c                            | 102 ++++++++++++++++++
 17 files changed, 227 insertions(+), 26 deletions(-)
 create mode 100644 test/env/default.c

-- 
2.23.0



More information about the U-Boot mailing list