[RFC PATCH 0/2] defaultenv: board defaultenv now overrides CONFIG_DEFAULT_ENVIRONMENT_PATH

Ahmad Fatoum a.fatoum at pengutronix.de
Wed Oct 14 05:42:57 PDT 2026


Hello Florian,

On 10/7/26 7:59 AM, Florijan Plohl wrote:
> Hi,
> 
> since commit 7f1cc5dd869d ("defaultenv: add base and external
> defaultenv in pure_initcall"), a board's own defaultenv overrides the
> environment from CONFIG_DEFAULT_ENVIRONMENT_PATH instead of the other
> way round:
> 
>   before: base -> board defaultenv -> CONFIG_DEFAULT_ENVIRONMENT_PATH
>   after:  base -> CONFIG_DEFAULT_ENVIRONMENT_PATH -> board defaultenv
> 
> Documentation/user/defaultenv-2.rst still describes the old order.
> 
> On phytec-som-imx6 this means the board's boot/* scripts now replace
> the ones with the same names from our Yocto BSP (meta-phytec). Booting
> via these entries then skips the BSP's additional setup, e.g. the
> device tree overlays it applies for mmc, emmc and nand boot.
> 
> This RFC restores the old order for this board only: patch 1 adds
> defaultenv_append_external(), patch 2 calls it at the end of
> physom_imx6_probe(). Before polishing it, we'd like to ask:
> 
> 1. Is the new order intended?

I must have had blinders on when I did it this way. I agree with you
that it makes more sense for external to override board defaultenv than
the other way round.

> 2. If not, is a per-board opt-in like this series acceptable, or would
>    you rather see this fixed generically in defaultenv.c?

I would rather seen this fixed generically. An entry in
Documentation/migration-guides/migration-master.rst is probably apt to
point out the change/restoration of behavior.

Watch out that CONFIG_DEFAULT_ENVIRONMENT_PATH can not be assumed to be
the last element always, e.g. fw_cfg should still be able to override it
as it can be specified at runtime.

Thanks,
Ahmad

> 
> 3. If it is, what is the recommended way for a BSP to replace a board's
>    boot scripts?
> 
> Thanks,
> Florijan
> 
> Primoz Fiser (2):
>   defaultenv: add defaultenv_append_external() to re-apply BSP
>     environment
>   ARM: boards: phytec-som-imx6: re-apply BSP environment after board
>     defaultenv
> 
>  arch/arm/boards/phytec-som-imx6/board.c | 12 ++++++++++++
>  defaultenv/defaultenv.c                 | 16 ++++++++++++++++
>  include/envfs.h                         |  5 +++++
>  3 files changed, 33 insertions(+)
> 
> 
> base-commit: ba8e34dfa96f80ae405e0ea7ac1e62762c28246a

-- 
Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |




More information about the barebox mailing list