[U-Boot] [PATCH 04/31] fdt: Enable selecting correct DTB from append FIT Image

Franklin S Cooper Jr fcooper at ti.com
Thu Mar 2 19:04:08 UTC 2017


This patch gives U-boot the runtime support to have the board specific
code decide which FDT to use. This is especially useful for devices
that need this type of runtime determination and also doesn't use SPL.

Signed-off-by: Franklin S Cooper Jr <fcooper at ti.com>
Reviewed-by: Lokesh Vutla <lokeshvutla at ti.com>
---
 lib/fdtdec.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 81f47ef..38db61c 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -4,6 +4,7 @@
  */
 
 #ifndef USE_HOSTCC
+#include <boot_fit.h>
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
@@ -1243,6 +1244,15 @@ int fdtdec_setup(void)
 		gd->fdt_blob = (ulong *)&_image_binary_end;
 	else
 		gd->fdt_blob = (ulong *)&__bss_end;
+
+#  elif defined CONFIG_FIT_EMBED
+	gd->fdt_blob = locate_dtb_in_fit(&_end);
+
+	if (gd->fdt_blob == NULL || gd->fdt_blob <= ((void *)&_end)) {
+		puts("Failed to find proper dtb in embedded FIT Image\n");
+		return -1;
+	}
+
 #  else
 	/* FDT is at end of image */
 	gd->fdt_blob = (ulong *)&_end;
-- 
2.10.0



More information about the U-Boot mailing list