[PATCH v4 9/9] fdt: get FDT from bloblist

Raymond Mao raymond.mao at linaro.org
Tue Jan 2 23:12:34 CET 2024


Get devicetree from a bloblist if it exists.
If not, fallback to get FDT from the board custom function.

Signed-off-by: Raymond Mao <raymond.mao at linaro.org>
---
Changes in v2
- Refactor of board_fdt_blob_setup().
Changes in v4
- Move the logics from board custom function to fdt library.

 lib/fdtdec.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 7a69167648..02a0504fad 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -8,6 +8,7 @@
 
 #ifndef USE_HOSTCC
 #include <common.h>
+#include <bloblist.h>
 #include <boot_fit.h>
 #include <display_options.h>
 #include <dm.h>
@@ -1676,7 +1677,13 @@ int fdtdec_setup(void)
 
 	/* Allow the board to override the fdt address. */
 	if (IS_ENABLED(CONFIG_OF_BOARD)) {
-		gd->fdt_blob = board_fdt_blob_setup(&ret);
+		void *fdt = NULL;
+
+		/* Check if a fdt exists in bloblist */
+		if (IS_ENABLED(CONFIG_BLOBLIST) && !bloblist_maybe_init())
+			fdt = bloblist_find(BLOBLISTT_CONTROL_FDT, 0);
+
+		gd->fdt_blob = fdt ? fdt : board_fdt_blob_setup(&ret);
 		if (ret)
 			return ret;
 		gd->fdt_src = FDTSRC_BOARD;
-- 
2.25.1



More information about the U-Boot mailing list