On Tue, May 5, 2020 at 12:04 PM Masahiro Yamada <masahiroy@xxxxxxxxxx> wrote: > > On Tue, May 5, 2020 at 4:15 AM Rob Herring <robh+dt@xxxxxxxxxx> wrote: > > > > On Sun, May 3, 2020 at 9:07 PM Masahiro Yamada <masahiroy@xxxxxxxxxx> wrote: > > > > > > Marek Behún reported a case where pkg-config fails to detect the > > > libyaml-dev package, which is presumably a bug of the distro. > > > > > > Irrespective of that, I am not a big fan of pkg-config in the Makefile > > > parse stage. The cost of pkg-config is quite small, but it is evaluated > > > everytime we run make, even when we do 'make mrproper'. This commit > > > changes the Makefile to not rely on pkg-config at all. > > > > I don't really love the solution here... I'm inclined to just make > > libyaml always required. Anyone building dtbs should care about > > validating them. However, there's some dts files sprinkled in the tree > > such as DT unittests and I don't want to break allmodconfig for CI, > > 0-day, etc. Though eventually we may have to. > > > > > The normal build should not require libyaml-dev while we need to compile > > > dtc with libyaml for the schema check. > > > > > > Build two dtc variants: > > > > > > scripts/dtc/dtc for *.dts -> *.dtb > > > scripts/dtc/dtc-yaml for *.dts -> *.dt.yaml > > > > My longer term plan is to integrate the schema checks into dtc. This > > would be some sort of plugin to dtc found or specified at run-time. It > > would eliminate the need for 2 passes of dtc and the 2nd case will go > > away. > > > OK. > > > > > > --- a/scripts/Makefile.lib > > > +++ b/scripts/Makefile.lib > > > @@ -246,6 +246,7 @@ quiet_cmd_gzip = GZIP $@ > > > # DTC > > > # --------------------------------------------------------------------------- > > > DTC ?= $(objtree)/scripts/dtc/dtc > > > +DTC_YAML ?= $(objtree)/scripts/dtc/dtc-yaml > > > > Can we make 'DTC' override both and keep this an internal detail. > > > > No. For parallel building *.dtb and *.dt.yaml, > they must be separate instances. > > > > > +HOSTLDLIBS_dtc-yaml := -lyaml > > > > Does this work for yocto? As we had this before commit 067c650c456e. > > Not clear if this changed for any reason or just 'let's use pkg-config > > everywhere'. > > > > Or is there another way to fix yocto issue and we can just check the > > header exists. I assume yocto needs some prefix in front of > > '/usr/include/yaml.h'? > > > > My bad - I missed 067c650c456e > > We need pkg-config to deal with yocto. > > > Sorry, I take back this series. On my second thought, we can search libyaml in non-standard path without pkg-config. Kbuild provides a way to specify additional flags for building host tools. make HOSTCFLAGS=<install-dir-in-yocto>/include HOSTLDFLAGS=<install-dir-in-yocto>/lib -- Best Regards Masahiro Yamada