X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=common%2Ffdt_support.c;h=f4f9543d5475d804e9059a51ccb199604605fc7b;hb=f957dec682dc2fa0363e09bfb5f41f008569245b;hp=916a448c11d43a82e25155f001c919cd8b5e9541;hpb=ceff355a5f3038ddb49618d9adc716b0ed978aea;p=u-boot diff --git a/common/fdt_support.c b/common/fdt_support.c index 916a448c11..f4f9543d54 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