Skip to contentSkip to conversation

Makefile: dts: include directory makefile for DTC_FLAGS

RFC-PATCH Daniel Walker 2 participants 4 messages Sep 7, 2022 – Sep 8, 2022 Kbuild

lore
Share & tools
lore
#0 lore raw

The current Makefile will drop the DTC_FLAGS depending on how you build. For example,

make dtbs

includes correct DTC_FLAGS. However if you run,

make nvidia/tegra210-p2371-2180.dtb

The DTC_FLAGS are dropped. This appears to be caused by the top level Makefile not including the Makefile from the directory where the dts lives.

This normally doesn't matter because most dts files have nothing added from the Makefile. This changes when you have overlays, and the DTC_FLAGS modifier is mandatory for the dtb to work correctly.

This change adds a -f argument which includes the Makefile from the directory where the dts file reside. This change is also required for dtbo files.

---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -2
index ac16bd92b156..bc245e2dc8d1 100644
@@ -1460,10 +1460,10 @@ endif
 ifneq ($(dtstree),)
 
 %.dtb: dtbs_prepare
-	$(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@
+	$(Q)$(MAKE) -f $(srctree)/$(dtstree)/$(dir $@)Makefile $(build)=$(dtstree) $(dtstree)/$@
 
 %.dtbo: dtbs_prepare
-	$(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@
+	$(Q)$(MAKE) -f $(srctree)/$(dtstree)/$(dir $@)Makefile $(build)=$(dtstree) $(dtstree)/$@
 
 PHONY += dtbs dtbs_prepare dtbs_install dtbs_check
 dtbs: dtbs_prepare
Signature · 1 line
2.25.1
#1 lore raw
Quoted 8 lines · Daniel Walker

The current Makefile will drop the DTC_FLAGS depending on how you build. For example,

make dtbs

includes correct DTC_FLAGS. However if you run,

Quoted 8 lines

make nvidia/tegra210-p2371-2180.dtb

The DTC_FLAGS are dropped. This appears to be caused by the top level Makefile not including the Makefile from the directory where the dts lives.

This normally doesn't matter because most dts files have nothing added from the Makefile. This changes when you have overlays, and the DTC_FLAGS modifier is mandatory for the dtb to work correctly.

I recently fixed another issue of single target builds.
https://patchwork.kernel.org/project/linux-kbuild/patch/[email protected]/

It fixed your issue as well.

Quoted 31 lines

This change adds a -f argument which includes the Makefile from the directory where the dts file reside. This change is also required for dtbo files.

---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -3
index ac16bd92b156..bc245e2dc8d1 100644
@@ -1460,10 +1460,10 @@ endif
 ifneq ($(dtstree),)
 
 %.dtb: dtbs_prepare
-       $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@
+       $(Q)$(MAKE) -f $(srctree)/$(dtstree)/$(dir $@)Makefile $(build)=$(dtstree) $(dtstree)/$@
 
 %.dtbo: dtbs_prepare
-       $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@
+       $(Q)$(MAKE) -f $(srctree)/$(dtstree)/$(dir $@)Makefile $(build)=$(dtstree) $(dtstree)/$@
 
 PHONY += dtbs dtbs_prepare dtbs_install dtbs_check
 dtbs: dtbs_prepare
--

2.25.1

Signature · 2 lines
Best Regards
Masahiro Yamada
#2 lore raw
Quoted 19 lines · Masahiro Yamada
Quoted 8 lines · Daniel Walker

The current Makefile will drop the DTC_FLAGS depending on how you build. For example,

make dtbs

includes correct DTC_FLAGS. However if you run,

Quoted 8 lines

make nvidia/tegra210-p2371-2180.dtb

The DTC_FLAGS are dropped. This appears to be caused by the top level Makefile not including the Makefile from the directory where the dts lives.

This normally doesn't matter because most dts files have nothing added from the Makefile. This changes when you have overlays, and the DTC_FLAGS modifier is mandatory for the dtb to work correctly.

Quoted 7 lines

I recently fixed another issue of single target builds.
https://patchwork.kernel.org/project/linux-kbuild/patch/[email protected]/

It fixed your issue as well.

Yeah, it fixes the issue I was seeing. Are you planning to resubmit this or is the v2 the final version ?

Daniel

#3 lore raw
Quoted 25 lines · Daniel Walker
Quoted 23 lines · Masahiro Yamada
Quoted 8 lines · Daniel Walker

The current Makefile will drop the DTC_FLAGS depending on how you build. For example,

make dtbs

includes correct DTC_FLAGS. However if you run,

Quoted 8 lines

make nvidia/tegra210-p2371-2180.dtb

The DTC_FLAGS are dropped. This appears to be caused by the top level Makefile not including the Makefile from the directory where the dts lives.

This normally doesn't matter because most dts files have nothing added from the Makefile. This changes when you have overlays, and the DTC_FLAGS modifier is mandatory for the dtb to work correctly.

I recently fixed another issue of single target builds.
https://patchwork.kernel.org/project/linux-kbuild/patch/[email protected]/

Quoted 8 lines
Quoted 3 lines

It fixed your issue as well.

Yeah, it fixes the issue I was seeing. Are you planning to resubmit this or is the v2 the final version ?

Daniel

I do not have a plan to submit v3
(unless a new issue comes up)

Signature · 2 lines
Best Regards
Masahiro Yamada