[PATCH v8 32/32] fdt: Show a runtime warning based on devicetree source

Simon Glass sjg at chromium.org
Fri Dec 17 04:59:39 CET 2021


When running, if the devicetree failed to come from the expected source,
show a warning, e.g:

   U-Boot ...

   DRAM:  128 MiB
   Core:  42 devices, 11 uclasses, devicetree: separate
   Warning: Unexpected devicetree source (not from a prior stage)
   Warning: U-Boot may not function properly
   Flash: 64 MiB
   ...

These warnings should only appear if the board config has been changed, or
the prior stage is broken.

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

---

Changes in v8:
- Drop documentation patches
- Drop the build-time warning, since people may ignore it

 common/board_r.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/common/board_r.c b/common/board_r.c
index 99adff14b39..6d520662dbb 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -598,6 +598,12 @@ static int dm_announce(void)
 		if (CONFIG_IS_ENABLED(OF_REAL))
 			printf(", devicetree: %s", fdtdec_get_srcname());
 		printf("\n");
+		if (IS_ENABLED(CONFIG_OF_HAS_PRIOR_STAGE) &&
+		    (gd->fdt_src == FDTSRC_SEPARATE ||
+		     gd->fdt_src == FDTSRC_EMBED)) {
+			printf("Warning: Unexpected devicetree source (not from a prior stage)");
+			printf("Warning: U-Boot may not function properly\n");
+		}
 	}
 
 	return 0;
-- 
2.34.1.173.g76aa8bc2d0-goog



More information about the U-Boot mailing list