On 5/4/26 14:26, Simon Glass wrote:
On 2026-04-30T12:25:59, Ludwig Nussel <[email protected]> wrote:
qemu: overlay signature nodes
[...]
diff --git a/board/emulation/qemu-arm/qemu-arm.c 
b/board/emulation/qemu-arm/qemu-arm.c
@@ -147,7 +147,38 @@ int dram_init_banksize(void)
  int board_fdt_blob_setup(void **fdtp)
  {
       /* QEMU loads a generated DTB for us at the start of RAM. */
-     *fdtp = (void *)CFG_SYS_SDRAM_BASE;
+     void *qemu_fdt = (void *)CFG_SYS_SDRAM_BASE;
+     int ret;
+
+     if (!*fdtp)
+             goto out;

This runs the opposite direction to qemu-sbsa, which uses the U-Boot
DT as the base and overlays the QEMU DT onto it (see
fdtdec_board_setup() in board/emulation/qemu-sbsa/qemu-sbsa.c). Done
this way, any node in U-Boot's built-in DT that shares a name with a
QEMU node (/cpus, /memory, /chosen, ...) will have its properties
merged into QEMU's, potentially clobbering the hardware description.
If this is correct, please explain in the commit message why the merge
runs in this direction.

IIUC the FDT patching happens before relocation. QEMU starts u-boot from a ROM at address 0 so writing to the embedded DT does not work. QEMU's provided DT is at a writable RAM location so patching that one works.

I don't know which direction makes more sense really. If you say merging QEMU's DT into U-Boot's is better then board_fix_fdt() could be used for the merging I guess. Looks like that could work with
CONFIG_OF_INITIAL_DTB_READONLY and CONFIG_OF_BOARD_FIXUP set.

cu
Ludwig

--
Ludwig Nussel
Siemens AG
www.siemens.com

Reply via email to