[PATCH v7 31/31] fdt: Show build/runtime warnings based on devicetree source
Simon Glass
sjg at chromium.org
Tue Dec 7 01:12:09 CET 2021
Show a warning at build time if the devicetree is built for a board which
normally should get it from a prior stage:
Warning: Devicetree was built but is not normally used on this board
When running, if the devicetree failed to come from the expected source,
show a warning then also, 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>
---
(no changes since v1)
Makefile | 3 +++
common/board_r.c | 6 ++++++
2 files changed, 9 insertions(+)
diff --git a/Makefile b/Makefile
index a3f018f01e0..0059f10cbca 100644
--- a/Makefile
+++ b/Makefile
@@ -1107,6 +1107,9 @@ endif
ifeq ($(CONFIG_DEPRECATED),y)
$(warning "You have deprecated configuration options enabled in your .config! Please check your configuration.")
endif
+ifeq ($(CONFIG_OF_HAS_PRIOR_STAGE).$(CONFIG_OF_OMIT_DTB),y.)
+ @echo >&2 "Warning: Devicetree was built but is not normally used on this board"
+endif
ifeq ($(CONFIG_OF_EMBED)$(CONFIG_EFI_APP),y)
@echo >&2 "===================== WARNING ======================"
@echo >&2 "CONFIG_OF_EMBED is enabled. This option should only"
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.400.ga245620fadb-goog
More information about the U-Boot
mailing list