From: Primoz Fiser <[email protected]>

physom_imx6_probe() appends the board's own defaultenv-physom-imx6*
directories via defaultenv_append_directory(). Since commit 7f1cc5dd869d
("defaultenv: add base and external defaultenv in pure_initcall") moved
the Kconfig/BSP-supplied environment (CONFIG_DEFAULT_ENVIRONMENT_PATH)
to an early pure_initcall, this probe - which runs later - now wins any
path collision against it.

For this board that silently shadows the per-machine environment a
Yocto BSP supplies via DEFAULT_ENVIRONMENT_PATH (e.g. meta-phytec's
env_add()-generated boot scripts) with the board's own, much older,
generic defaultenv-physom-imx6* content, without any build failure or
warning to indicate it.

Call the new defaultenv_append_external() after the board-specific
appends so the BSP-supplied environment, when actually provided, takes
final precedence again - restoring the pre-7f1cc5dd869d behavior for
this board. Standalone (non-Yocto) builds without a
DEFAULT_ENVIRONMENT_PATH are unaffected, and the board's own
defaultenv-physom-imx6* directories remain as the fallback for that
case.

Fixes: 7f1cc5dd869d ("defaultenv: add base and external defaultenv in 
pure_initcall")
Signed-off-by: Primoz Fiser <[email protected]>
Signed-off-by: Florijan Plohl <[email protected]>
---
 arch/arm/boards/phytec-som-imx6/board.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/arm/boards/phytec-som-imx6/board.c 
b/arch/arm/boards/phytec-som-imx6/board.c
index 7e6f61bc36..7f59f8864b 100644
--- a/arch/arm/boards/phytec-som-imx6/board.c
+++ b/arch/arm/boards/phytec-som-imx6/board.c
@@ -276,6 +276,18 @@ static int physom_imx6_probe(struct device *dev)
                defaultenv_append_directory(defaultenv_physom_imx6ul_phycore);
        }
 
+       /*
+        * Since barebox commit 7f1cc5dd869d ("defaultenv: add base and
+        * external defaultenv in pure_initcall"), the Kconfig/BSP-supplied
+        * environment (CONFIG_DEFAULT_ENVIRONMENT_PATH, i.e. Yocto's
+        * env_add()-generated content) is appended very early and no longer
+        * automatically wins over the board-specific defaultenv-physom-imx6*
+        * directories appended above. Re-append it here so it takes final
+        * precedence again when it is actually supplied (standalone/non-Yocto
+        * builds without DEFAULT_ENVIRONMENT_PATH content are unaffected).
+        */
+       defaultenv_append_external();
+
        return 0;
 }
 
-- 
2.43.0


Reply via email to