Add fdt_overlay_set_verbose() function in libfdt to enable verbose output from overlay function. Also add few debug message to help understand why overlay process failed. Signed-off-by: Srivatsa Vaddagiri <vatsa@xxxxxxxxxxxxxx> --- fdtoverlay.c | 1 + libfdt/fdt_overlay.c | 20 +++++++++++++++++++- libfdt/libfdt.h | 2 ++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/fdtoverlay.c b/fdtoverlay.c index 8aed173..308c311 100644 --- a/fdtoverlay.c +++ b/fdtoverlay.c @@ -163,6 +163,7 @@ int main(int argc, char *argv[]) usage("missing overlay file(s)"); if (verbose) { + fdt_overlay_set_verbose(1); printf("input = %s\n", input_filename); printf("output = %s\n", output_filename); for (i = 0; i < argc; i++) diff --git a/libfdt/fdt_overlay.c b/libfdt/fdt_overlay.c index 64386dd..81b9feb 100644 --- a/libfdt/fdt_overlay.c +++ b/libfdt/fdt_overlay.c @@ -56,6 +56,17 @@ #include "libfdt_internal.h" +int verbose_overlay; + +#define dprintf(x...) \ + if (verbose_overlay) \ + printf(x) + +void fdt_overlay_set_verbose(int val) +{ + verbose_overlay = val; +} + /** * overlay_get_target_phandle - retrieves the target phandle of a fragment * @fdto: pointer to the device tree overlay blob @@ -426,8 +437,10 @@ static int overlay_fixup_one_phandle(void *fdt, void *fdto, symbol_path = fdt_getprop(fdt, symbols_off, label, &prop_len); - if (!symbol_path) + if (!symbol_path) { + dprintf("Unable to find symbol %s\n", label); return prop_len; + } symbol_off = fdt_path_offset(fdt, symbol_path); if (symbol_off < 0) @@ -869,22 +882,27 @@ int fdt_overlay_apply(void **fdt, void **fdto) FDT_CHECK_HEADER(*fdt); FDT_CHECK_HEADER(*fdto); + dprintf("Adjusting local phandles\n"); ret = overlay_adjust_local_phandles(*fdto, delta); if (ret) goto err; + dprintf("Updating local references\n"); ret = overlay_update_local_references(*fdto, delta); if (ret) goto err; + dprintf("Fixing phandles\n"); ret = overlay_fixup_phandles(*fdt, *fdto); if (ret) goto err; + dprintf("Merging blobs\n"); ret = overlay_merge(*fdt, *fdto); if (ret) goto err; + dprintf("Updating symbols\n"); ret = overlay_symbol_update(*fdt, *fdto); if (ret) goto err; diff --git a/libfdt/libfdt.h b/libfdt/libfdt.h index 5dd63ef..8e3de74 100644 --- a/libfdt/libfdt.h +++ b/libfdt/libfdt.h @@ -1904,4 +1904,6 @@ int fdt_overlay_apply(void **fdt, void **fdto); const char *fdt_strerror(int errval); +void fdt_overlay_set_verbose(int verbose); + #endif /* LIBFDT_H */ -- 2.7.4 -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation -- To unsubscribe from this list: send the line "unsubscribe devicetree-compiler" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html