[U-Boot,v2,04/10] fdt-overlay: Spit out a descriptive failure warning

Submitted by Pantelis Antoniou on Aug. 11, 2017, 8:52 a.m.

Details

Message ID 1502441568-22896-5-git-send-email-pantelis.antoniou@konsulko.com
State New
Delegated to: Simon Glass
Headers show

Commit Message

Pantelis Antoniou Aug. 11, 2017, 8:52 a.m.
The most common trouble with overlays appears to be miscompiled
blobs without the -@ option.

In case of an error, spit out a descriptive error message.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
---
 cmd/fdt.c          |  8 ++++++++
 common/image-fit.c | 12 +++++++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/cmd/fdt.c b/cmd/fdt.c
index 05e19f8..9f192be 100644
--- a/cmd/fdt.c
+++ b/cmd/fdt.c
@@ -654,6 +654,7 @@  static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		unsigned long addr;
 		struct fdt_header *blob;
 		int ret;
+		bool has_symbols;
 
 		if (argc != 3)
 			return CMD_RET_USAGE;
@@ -666,9 +667,16 @@  static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		if (!fdt_valid(&blob))
 			return CMD_RET_FAILURE;
 
+		ret = fdt_path_offset(working_fdt, "/__symbols__");
+		has_symbols = ret >= 0;
+
 		ret = fdt_overlay_apply(working_fdt, blob);
 		if (ret) {
 			printf("fdt_overlay_apply(): %s\n", fdt_strerror(ret));
+			if (!has_symbols) {
+				printf("working fdt does did not have a /__symbols__ node\n");
+				printf("make sure you've compiled with -@\n");
+			}
 			return CMD_RET_FAILURE;
 		}
 	}
diff --git a/common/image-fit.c b/common/image-fit.c
index cb089ea..28140f1 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -1946,6 +1946,7 @@  int boot_get_fdt_fit(bootm_headers_t *images, ulong addr,
 	const char *uname;
 	void *base, *ov;
 	int i, err, noffset, ov_noffset;
+	bool has_symbols;
 #endif
 
 	fit_uname = fit_unamep ? *fit_unamep : NULL;
@@ -2038,9 +2039,18 @@  int boot_get_fdt_fit(bootm_headers_t *images, ulong addr,
 			fdt_noffset = err;
 			goto out;
 		}
+
+		err = fdt_path_offset(base, "/__symbols__");
+		has_symbols = err >= 0;
+
 		err = fdt_overlay_apply(base, ov);
 		if (err < 0) {
-			printf("failed on fdt_overlay_apply\n");
+			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");
+			}
 			fdt_noffset = err;
 			goto out;
 		}