Re: [PATCH] Makefile: fix dtbs_check target

David Lechner <[email protected]>
Newsgroups org.u-boot-project.lists.u-boot
Message-ID <[email protected]>
On 8/8/26 11:23 AM, Simon Glass wrote:
> Hi David,
> 
> On 2026-08-06T16:53:15, David Lechner <[email protected]> wrote:
>> Makefile: fix dtbs_check target
>>
>> Use absolute paths for src and srctree when calling dtbs_check via
>> sub-make command. This fixes dtbs checks not working.
>>
>> Without this change, we see errors like:
> 
>>
>>     find: ‘dts/upstream/Bindings’: No such file or directory
> 
> Just to check, this only happens with out-of-tree builds (O=), right?

I always use O=, so I didn't think to check in-tree build.

> In-tree the sub-make runs in the source directory, so the relative
> path resolves. Please can you mention in the commit message that this
> affects out-of-tree builds, so people know when it occurs and how to
> reproduce it?

Sure.

> 
>>
>>     find: ‘dts/upstream/Bindings’: No such file or directory
>>
>> This resulted in no schemas to be parsed and therefore no useful checks
>> were done.
>>
>> Since we do not want to modify dts/upstream/Makefile, as it would be
>> written over when we pull upstream changes, we make the changes in the
>> U-Boot Makefile.
>>
>> Signed-off-by: David Lechner <[email protected]>
>>
>> Makefile | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
>> diff --git a/Makefile b/Makefile
>> @@ -1455,7 +1455,9 @@ dtbs_check: dt_binding_check dtbs
>> +     $(Q)$(MAKE) $(build)=$(DT_BINDING_DIR) srctree=$(abspath $(srctree)) \
>> +             src=$(abspath $(srctree))/$(DT_BINDING_DIR) \
>> +             $(DT_BINDING_DIR)/processed-schema.json
> 
> I traced this through scripts/Makefile.build and
> dts/upstream/Bindings/Makefile and the logic looks right: src on the
> command line overrides the assignment in Makefile.build, so
> find_all_cmd searches the source tree, DT_DOCS still resolves via
> VPATH in the objtree, and the output lands in
> $(obj)/processed-schema.json where scripts/Makefile.lib expects it
> (DT_TMP_SCHEMA). The kernel has moved to defining src as
> $(srctree)/$(obj) in Makefile.build, but there are more changes after
> that, so we can worry about that later.
> 
> One small thing: $(abspath $(srctree)) is expanded twice. You could
> assign it to a variable next to DT_BINDING_DIR to make the rule easier
> to read. What do you think?

I thought I wrote $(abspath $(srctree)/$(DT_BINDING_DIR)) which would
make it not so redundant.

Your suggestion sounds fine though too.

> 
> In any case:
> 
> Reviewed-by: Simon Glass <[email protected]>
> 
> Regards,
> Simon
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.