[PATCH] fdt: Update fdtcontroladdr if fdt_blob changes
Simon Glass
sjg at chromium.org
Sat Nov 2 17:33:20 CET 2024
Hi Andreas,
On Fri, 1 Nov 2024 at 14:40, Andreas Gnau <andreas.gnau at iopsys.eu> wrote:
>
> When a different FDT blob is chosen via fdtdec_resetup /
> board_fit_config_name_match, update the fdtcontroladdr environment
> variable accordingly. This fixes an issue where fdtcontroladdr would
> still point to the previously used FDT blob.
>
> Signed-off-by: Andreas Gnau <andreas.gnau at iopsys.eu>
> ---
>
> lib/fdtdec.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/lib/fdtdec.c b/lib/fdtdec.c
> index b06559880296..e3534b647556 100644
> --- a/lib/fdtdec.c
> +++ b/lib/fdtdec.c
> @@ -1759,6 +1759,8 @@ int fdtdec_resetup(int *rescan)
>
> *rescan = 1;
> gd->fdt_blob = fdt_blob;
> + env_set_hex("fdtcontroladdr",
> + (unsigned long)map_to_sysmem(gd->fdt_blob));
> return fdtdec_prepare_fdt(fdt_blob);
> }
>
> --
> 2.47.0
>
At least as it is documented in doc/develop/devicetree/control.rst
this variable is used to set the address of the FDT initially, rather
than reflecting its value after that.
I suggest instead that you add something like:
fdt addr -ce <varname>
to set an environment variable to the current control-FDT address
For your commit message, I sort-of understand the problem you are
seeing, but not why you want the control FDT in an env var. Can you
add that info too, please?
Also please consider how to test your change.
Regards,
Simon
More information about the U-Boot
mailing list