[PATCH] kbuild: use which $(DTC) as a dependency

Rasmus Villemoes rasmus.villemoes at prevas.dk
Tue Oct 17 13:27:35 CEST 2023


On 17/10/2023 12.44, Richard Marko wrote:
> If we try to build using external dtc using
> 
>> make DTC=dtc
> 
> we get a confusing error like
> 
>> make[2]: *** No rule to make target 'arch/x86/dts/bayleybay.dtb',
>> needed by 'dtbs'.  Stop.
> 
> Workaround is to use
> 
>> make DTC=$( which dtc )
> 
> which gives make a full path, so the dependency
> is satisfied.
> 
> This was introduced by commit
> d50af66 kbuild: add dtc as dependency on .dtb files
> 
> and we extend it so it calls which automatically
> (similar to scripts/dtc-version.sh)


Let's please not deviate from linux Kbuild unless we absolutely have to.
In this case, passing an absolute path works just fine, and is AFAICT
the only documented way to pass DTC. E.g. doc/build/gcc.rst has

    DTC=/usr/bin/dtc make

as example.

[And if we do this, then at the very least this should also be done for
the .dtbo rule and wherever else $(DTC) is used. But I'm really not a
fan of calling out to $(shell which ...) in the rule itself. Perhaps if
it was done just once, near DTC/DTC_IN_TREE, something like (not real
make syntax I think)

ifneq ($(DTC), $(DTC_IN_TREE))
DTC := $(shell which $(DTC))
endif

But I don't think we should be doing this at all.]

Rasmus



More information about the U-Boot mailing list