On Thu, Feb 11, 2021 at 5:27 AM Viresh Kumar <viresh.kumar@xxxxxxxxxx> wrote: > > The dtc tool doesn't do very elaborate error reporting to keep the size > of the executables small enough for all kind of applications. > > This patch tries to provide a way to do better error reporting, without > increasing the size of the executables for such cases (where we don't > want elaborate error reporting). > > The error reporting will only be enabled if 'VERBOSE' (as -DVERBOSE) > flag is passed during compilation of the tools. > > This also updates the fdtoverlay tool to do better error reporting, > which is required by the Linux Kernel for now. > > Signed-off-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx> > > --- > Hi David, > > Unfortunately I am not a core DT guy and don't understand most of the > stuff going on here. I tried to do minimal changes to get more > information out on errors and it may require someone who understands the > code well to write better error logs. > > FWIW, I stumbled upon this because of the discussion that happened here: > > https://lore.kernel.org/lkml/74f8aa8f-ffab-3b0f-186f-31fb7395ebbb@xxxxxxxxx/ > > Thanks. > > --- > dtc.h | 6 ++ > fdtoverlay.c | 1 + > libfdt/fdt_overlay.c | 156 ++++++++++++++++++++++++++++++++++--------- > 3 files changed, 132 insertions(+), 31 deletions(-) > > diff --git a/dtc.h b/dtc.h > index d3e82fb8e3db..b8ffec155263 100644 > --- a/dtc.h > +++ b/dtc.h > @@ -29,6 +29,12 @@ > #define debug(...) > #endif > > +#ifdef VERBOSE > +#define dtc_err(fmt, ...) fprintf(stderr, "DTC: %s: %d: " fmt, __func__, __LINE__, ##__VA_ARGS__) > +#else > +#define dtc_err(fmt, ...) > +#endif This needs to go in libfdt. The executables can always print, it's the libfdt library that may or may not be able to. Rob