
On 09/08/2022 12.47, Francesco Dolcini wrote:
Hello all, is there any kconfig mechanism in u-boot to append environment variable to the default one?
Well, despite the name, CONFIG_EXTRA_ENV_SETTINGS is not settable via kconfig, but only from board header file. And while it works, it's rather cumbersome to maintain that macro expanding to a string with all the embedded \0 and the required \ continuations etc.
I am aware of CONFIG_USE_DEFAULT_ENV_FILE, but this will completely replace it, looking into the code I was not able to find anything,
You could select CONFIG_ENV_IMPORT_FDT, then populate the /config/environment/ devicetree node with the key/value pairs you want.
This can for example be done via the <board>-u-boot.dtsi file, or if you're using an in-tree board with in-tree .dts, and just want to maintain your own .config and environment out of tree, you could additionally set CONFIG_DEVICE_TREE_INCLUDES to point at a .dtsi which just has that
/ { config { environment { foo = "bar"; }; }; };
(that was exactly a use case I had in mind for CONFIG_DEVICE_TREE_INCLUDES, as can be seen in the commit log for a77f468099).
Rasmus