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

Simon Glass sjg at chromium.org
Tue Nov 19 14:18:42 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>

pxe: Deal with using the control FDT

Move selection of the control FDT so that it happens before booting, so
we can see the result in the bootflow.

---

 boot/pxe_utils.c | 46 ++++++++++++++++++++++++++++------------------
 1 file changed, 28 insertions(+), 18 deletions(-)

diff --git a/boot/pxe_utils.c b/boot/pxe_utils.c
index ca91bff7e51..99c968a1202 100644
--- a/boot/pxe_utils.c
+++ b/boot/pxe_utils.c
@@ -605,27 +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)) {
-			if (strcmp("-", label->fdt))
-				bmi.conf_fdt = env_get("fdt_addr");
-		} else {
-			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)) {
-			if (strcmp("-", label->fdt))
-				bmi.conf_fdt = env_get("fdtcontroladdr");
-		} else {
-			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)) {
@@ -792,6 +774,34 @@ 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)) {
+			if (strcmp("-", label->fdt))
+				conf_fdt = env_get("fdt_addr");
+		} else {
+			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)) {
+				if (strcmp("-", label->fdt))
+					conf_fdt = env_get("fdtcontroladdr");
+			} else {
+				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