[PATCH v2 39/41] pxe: Deal with a missing FDT in the bootflow

Simon Glass sjg at chromium.org
Wed Dec 4 00:45:57 CET 2024


Move processing of a missing FDT so that it happens before booting, so
we can see the result in the bootflow.

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

(no changes since v1)

 boot/pxe_utils.c | 34 ++++++++++++++++++++++------------
 1 file changed, 22 insertions(+), 12 deletions(-)

diff --git a/boot/pxe_utils.c b/boot/pxe_utils.c
index 053fdcbb6e7..1468a8e8498 100644
--- a/boot/pxe_utils.c
+++ b/boot/pxe_utils.c
@@ -605,21 +605,9 @@ static int label_run_boot(struct pxe_context *ctx, struct pxe_label *label,
 			      hextoul(initrd_filesize, NULL));
 	}
 
-	if (!bmi.conf_fdt) {
-		if (!IS_ENABLED(CONFIG_SUPPORT_PASSING_ATAGS) ||
-		    strcmp("-", label->fdt))
-			bmi.conf_fdt = env_get("fdt_addr");
-	}
-
 	kernel_addr_r = genimg_get_kernel_addr(kernel_addr);
 	buf = map_sysmem(kernel_addr_r, 0);
 
-	if (!bmi.conf_fdt && genimg_get_format(buf) != IMAGE_FORMAT_FIT) {
-		if (!IS_ENABLED(CONFIG_SUPPORT_PASSING_ATAGS) ||
-		    strcmp("-", label->fdt))
-			bmi.conf_fdt = env_get("fdtcontroladdr");
-	}
-
 	/* Try bootm for legacy and FIT format image */
 	if (genimg_get_format(buf) != IMAGE_FORMAT_INVALID &&
 	    IS_ENABLED(CONFIG_CMD_BOOTM)) {
@@ -786,6 +774,28 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label)
 	if (ret)
 		return ret;
 
+	if (!conf_fdt) {
+		if (!IS_ENABLED(CONFIG_SUPPORT_PASSING_ATAGS) ||
+		    strcmp("-", label->fdt))
+			conf_fdt = env_get("fdt_addr");
+	}
+
+	if (!conf_fdt) {
+		ulong kernel_addr_r;
+		void *buf;
+
+		kernel_addr_r = genimg_get_kernel_addr(kernel_addr);
+		buf = map_sysmem(kernel_addr_r, 0);
+		if (genimg_get_format(buf) != IMAGE_FORMAT_FIT) {
+			if (!IS_ENABLED(CONFIG_SUPPORT_PASSING_ATAGS) ||
+			    strcmp("-", label->fdt))
+				conf_fdt = env_get("fdtcontroladdr");
+		}
+		unmap_sysmem(buf);
+	}
+	if (ctx->bflow)
+		ctx->bflow->fdt_addr = hextoul(conf_fdt, NULL);
+
 	if (ctx->no_boot)
 		return 0;
 
-- 
2.34.1



More information about the U-Boot mailing list