[PATCH] fixup! bootm: booti: make device tree optional

Ahmad Fatoum a.fatoum at barebox.org
Thu Jun 12 01:18:09 PDT 2025


bootm_get_devicetree returns the fixed up device tree, so it must be
called after bootm_load_initrd, so the properties indicating the initrd
location are included in the fixed DT.

Signed-off-by: Ahmad Fatoum <a.fatoum at barebox.org>
---
 common/booti.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/common/booti.c b/common/booti.c
index 2d4cb3598737..6a87b84c0308 100644
--- a/common/booti.c
+++ b/common/booti.c
@@ -66,12 +66,6 @@ void *booti_load_image(struct image_data *data, phys_addr_t *oftree)
 		unsigned long devicetree;
 		const struct resource *initrd_res;
 
-		fdt = bootm_get_devicetree(data);
-		if (IS_ERR(fdt))
-			return fdt;
-		if (!fdt)
-			goto out;
-
 		initrd_res = bootm_load_initrd(data, image_end);
 		if (IS_ERR(initrd_res)) {
 			return ERR_CAST(initrd_res);
@@ -82,6 +76,15 @@ void *booti_load_image(struct image_data *data, phys_addr_t *oftree)
 
 		devicetree = image_end;
 
+		fdt = bootm_get_devicetree(data);
+		if (IS_ERR(fdt))
+			return fdt;
+		if (!fdt) {
+			if (initrd_res)
+				pr_warn("initrd discarded due to missing devicetree.\n");
+			goto out;
+		}
+
 		ret = bootm_load_devicetree(data, fdt, devicetree);
 		free(fdt);
 
-- 
2.39.5




More information about the barebox mailing list