[PATCH] cmd: add resize for FDT in bootelf

Simon Glass sjg at chromium.org
Sat Jun 29 08:56:04 CEST 2024


Hi Maxim,

On Fri, 28 Jun 2024 at 09:34, Maxim Moskalets <maximmosk4 at gmail.com> wrote:
>
> In some FDTs, there is not enough free memory to add nodes, so this
> operation fails.
>
> Signed-off-by: Maxim Moskalets <maximmosk4 at gmail.com>
> ---
>  cmd/elf.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/cmd/elf.c b/cmd/elf.c
> index 32b7462f92..673c6c3051 100644
> --- a/cmd/elf.c
> +++ b/cmd/elf.c
> @@ -68,6 +68,8 @@ int do_bootelf(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
>                 log_debug("Setting up FDT at 0x%08lx ...\n", fdt_addr);
>                 flush();
>
> +               fdt_set_totalsize((void *)fdt_addr,
> +                               fdt_totalsize(fdt_addr) + CONFIG_SYS_FDT_PAD);
>                 if (image_setup_libfdt(&img, (void *)fdt_addr, NULL))
>                         return 1;
>         }
> --
> 2.39.2
>

Reviewed-by: Simon Glass <sjg at chromium.org>

Would you mind adding some docs for this comment in doc/usage/cmd/elf.rst ?

You can also use the 'fdt addr <addr> <size>' to expand the FDT.

Regards,
Simon


More information about the U-Boot mailing list