summaryrefslogtreecommitdiff
path: root/common/fdt_support.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2017-09-15 22:34:34 -0400
committerTom Rini <trini@konsulko.com>2017-09-15 22:34:34 -0400
commit08cebeeaadd9192dd501308ac6a8b858ffa255c1 (patch)
tree65e037590914a47d0f3352afeb596c5cd6f238e8 /common/fdt_support.c
parent110ba62519909df7042cbe71824dfe3844557a85 (diff)
parentea28e488f743520f7f83b341f28818c32dae1ee3 (diff)
Merge git://git.denx.de/u-boot-fdt
Diffstat (limited to 'common/fdt_support.c')
-rw-r--r--common/fdt_support.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 916a448c11d..f4f9543d547 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -1655,3 +1655,34 @@ int fdt_fixup_display(void *blob, const char *path, const char *display)
}
return toff;
}
+
+#ifdef CONFIG_OF_LIBFDT_OVERLAY
+/**
+ * fdt_overlay_apply_verbose - Apply an overlay with verbose error reporting
+ *
+ * @fdt: ptr to device tree
+ * @fdto: ptr to device tree overlay
+ *
+ * Convenience function to apply an overlay and display helpful messages
+ * in the case of an error
+ */
+int fdt_overlay_apply_verbose(void *fdt, void *fdto)
+{
+ int err;
+ bool has_symbols;
+
+ err = fdt_path_offset(fdt, "/__symbols__");
+ has_symbols = err >= 0;
+
+ err = fdt_overlay_apply(fdt, fdto);
+ if (err < 0) {
+ printf("failed on fdt_overlay_apply(): %s\n",
+ fdt_strerror(err));
+ if (!has_symbols) {
+ printf("base fdt does did not have a /__symbols__ node\n");
+ printf("make sure you've compiled with -@\n");
+ }
+ }
+ return err;
+}
+#endif