From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Villemoes Date: Wed, 21 Apr 2021 11:06:53 +0200 Subject: [PATCH v2 0/2] allow environment to be updated from dtb In-Reply-To: <20210413224345.2692591-1-rasmus.villemoes@prevas.dk> References: <20210413224345.2692591-1-rasmus.villemoes@prevas.dk> Message-ID: <20210421090655.1458746-1-rasmus.villemoes@prevas.dk> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Patch 1 adds a config option for updating the environment, after it has been loaded from its persistent location, with a set of key/value pairs from a node in the control DTB. 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 environment suitable for that particular board variant. Once those tweaks have been applied, one may no longer wish for the DTB settings to be applied on subsequent boots; this is easily achieved by clearing the fdt_env_path variable and saving the environment. In a previous version, I used a single property whose value was expected to have the form "foo=1\0bar=234\0". But using a node and individual property/value pairs is both more readable and more flexible - for example, the individual control dtbs can easily be prepared from each other using the fdtput utility, or with suitable includes in the .dts. Combining fragments in that way is not possible with a single property. Patch 2 simply adds a small test case to the sandbox. v2: Add Simon's R-b tags, use livetree/ofnode API. Rasmus Villemoes (2): env: allow environment to be amended from control dtb sandbox: add test of CONFIG_ENV_IMPORT_FDT arch/sandbox/dts/test.dts | 7 +++++++ common/board_r.c | 2 ++ configs/sandbox64_defconfig | 1 + configs/sandbox_defconfig | 1 + env/Kconfig | 18 ++++++++++++++++++ env/common.c | 30 ++++++++++++++++++++++++++++++ include/env.h | 15 +++++++++++++++ include/env_default.h | 3 +++ test/env/Makefile | 1 + test/env/fdt.c | 20 ++++++++++++++++++++ 10 files changed, 98 insertions(+) create mode 100644 test/env/fdt.c -- 2.29.2