[PATCH v4 1/6] qemu-arm: merge built-in DT
Simon Glass
sjg at chromium.org
Fri May 15 16:11:06 CEST 2026
Hi Ludwig,
On 2026-05-13T14:08:10, Ludwig Nussel <ludwig.nussel at siemens.com> wrote:
> qemu-arm: merge built-in DT
>
> The keys trusted for FIT signature verification are supposed to be
> embedded in the device tree built into u-boot. When running in Qemu it's
> convenient to use the device tree provided by the VM which doesn't know
> about signatures though. So merge both device trees at startup.
>
> Signed-off-by: Ludwig Nussel <ludwig.nussel at siemens.com>
>
> board/emulation/qemu-arm/qemu-arm.c | 47 +++++++++++++++++++++++++++++++++++--
> configs/qemu_arm64_defconfig | 1 +
> 2 files changed, 46 insertions(+), 2 deletions(-)
> diff --git a/board/emulation/qemu-arm/qemu-arm.c b/board/emulation/qemu-arm/qemu-arm.c
> @@ -144,10 +144,53 @@ int dram_init_banksize(void)
> + ret = fdt_increase_size(qemu_fdt, 1024 + fdt_totalsize(*fdtp));
> + if (ret) {
> + log_err("Failed to resize FDT overlay: %s", fdt_strerror(ret));
> + goto out;
> + }
Missing trailing newline
> diff --git a/board/emulation/qemu-arm/qemu-arm.c b/board/emulation/qemu-arm/qemu-arm.c
> @@ -144,10 +144,53 @@ int dram_init_banksize(void)
> + ret = fdt_overlay_apply_node(qemu_fdt, 0, (void *)*fdtp, 0);
> + if (ret) {
> + log_err("Failed to apply FDT overlay: %s\n", fdt_strerror(ret));
> + goto out;
> + }
> +
> +out:
> + *fdtp = qemu_fdt;
> +
> return 0;
> }
If fdt_overlay_apply_node() fails partway through it may have already
inserted nodes/properties, leaving a half-merged tree, yet we return
0. Please return an error here (and for the fdt_increase_size()
failure too) so the boot fails when FIT_SIGNATURE_REQUIRED is set
rather than silently continuing with a mangled FDT.
> diff --git a/board/emulation/qemu-arm/qemu-arm.c b/board/emulation/qemu-arm/qemu-arm.c
> @@ -144,10 +144,53 @@ int dram_init_banksize(void)
> + if (fdt_check_header(qemu_fdt) != 0) {
> + log_err("Invalid QEMU FDT at %p\n", qemu_fdt);
> + return -EINVAL;
> + }
This is a useful change, but worth calling out in the commit message,
The subject says qemu-arm but only qemu_arm64_defconfig is touched -
do you want to do both? Or narrow the subject to qemu_arm64
Reviewed-by: Simon Glass <sjg at chromium.org>
Regards,
Simon
More information about the U-Boot
mailing list