[PATCH 13/15] vbe: Support loading an FDT with the relocating loader

Simon Glass sjg at chromium.org
Thu Jan 9 13:30:08 CET 2025


Add FDT support so that this can be copied down in memory after loading
and made available to the new image.

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

 boot/vbe_common.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/boot/vbe_common.c b/boot/vbe_common.c
index 742e754b133..46b39cf8910 100644
--- a/boot/vbe_common.c
+++ b/boot/vbe_common.c
@@ -173,6 +173,26 @@ int vbe_read_fit(struct udevice *blk, ulong area_offset, ulong area_size,
 				memmove(fdt_base_buf, fdt_base_buf + extra,
 					fdt_size);
 			}
+#if CONFIG_IS_ENABLED(RELOC_LOADER)
+			image->fdt_buf = fdt_base_buf;
+
+			ulong xpl_size;
+			ulong xpl_pad;
+			ulong fdt_start;
+
+			if (xpl_phase() == PHASE_TPL) {
+				xpl_size = binman_sym(ulong, u_boot_vpl_nodtb, size);
+				xpl_pad = binman_sym(ulong, u_boot_vpl_bss_pad, size);
+			} else {
+				xpl_size = binman_sym(ulong, u_boot_spl_nodtb, size);
+				xpl_pad = binman_sym(ulong, u_boot_spl_bss_pad, size);
+			}
+			fdt_start = image->load_addr + xpl_size + xpl_pad;
+			log_debug("load_addr %lx xpl_size %lx copy-to %lx\n",
+				  image->load_addr, xpl_size + xpl_pad,
+				  fdt_start);
+			image->fdt_start = map_sysmem(fdt_start, fdt_size);
+#endif
 		}
 	}
 	if (load_addrp)
-- 
2.34.1



More information about the U-Boot mailing list