Skip to contentSkip to conversation

kbuild: add dtbs_prepare target

PATCH In review Masahiro Yamada 2 participants 3 messages Jul 24, 2022 – Jul 30, 2022 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 kbuild: add dtbs_prepare target

Factor out the common prerequisites for DT compilation into the new target, dtbs_prepare.

Add comments to explain why include/config/kernel.release is the prerequisite. Our policy is that installation targets must not rebuild anything in the tree. If 'make modules_install' is executed as root, include/config/kernel.release may be owned by root.

---

Changes for v2:
- rephase the comment more concise

 Makefile | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
Makefile +9 -4
index dee707c98bbe..a2a030f41e65 100644
@@ -1370,16 +1370,21 @@ endif
 
 ifneq ($(dtstree),)
 
-%.dtb: include/config/kernel.release scripts_dtc
+%.dtb: dtbs_prepare
 	$(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@
 
-%.dtbo: include/config/kernel.release scripts_dtc
+%.dtbo: dtbs_prepare
 	$(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@
 
-PHONY += dtbs dtbs_install dtbs_check
-dtbs: include/config/kernel.release scripts_dtc
+PHONY += dtbs dtbs_prepare dtbs_install dtbs_check
+dtbs: dtbs_prepare
 	$(Q)$(MAKE) $(build)=$(dtstree)
 
+# include/config/kernel.release is actually needed when installing DTBs because
+# INSTALL_DTBS_PATH contains $(KERNELRELEASE). However, we do not want to make
+# dtbs_install depend on it as dtbs_install may run as root.
+dtbs_prepare: include/config/kernel.release scripts_dtc
+
 ifneq ($(filter dtbs_check, $(MAKECMDGOALS)),)
 export CHECK_DTBS=y
 dtbs: dt_binding_check
Signature · 1 line
2.34.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 15 lines · Masahiro Yamada

Date: Sun, 24 Jul 2022 18:59:19 +0900
From: Masahiro Yamada <[email protected]>
To: [email protected]
Cc: Nicolas Schier <[email protected]>, Masahiro Yamada
<[email protected]>, Michal Marek <[email protected]>, Nick Desaulniers <[email protected]>, [email protected]
Subject: [PATCH v2] kbuild: add dtbs_prepare target
Message-Id: <[email protected]>
X-Mailer: git-send-email 2.34.1
List-ID: <linux-kbuild.vger.kernel.org>
X-Mailing-List: [email protected]

Factor out the common prerequisites for DT compilation into the new target, dtbs_prepare.

Quoted 7 lines

Add comments to explain why include/config/kernel.release is the prerequisite. Our policy is that installation targets must not rebuild anything in the tree. If 'make modules_install' is executed as root, include/config/kernel.release may be owned by root.

---

Quoted 39 lines

Changes for v2:
- rephase the comment more concise

 Makefile | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
Makefile +9 -4
index dee707c98bbe..a2a030f41e65 100644
@@ -1370,16 +1370,21 @@ endif
 
 ifneq ($(dtstree),)
 
-%.dtb: include/config/kernel.release scripts_dtc
+%.dtb: dtbs_prepare
 	$(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@
 
-%.dtbo: include/config/kernel.release scripts_dtc
+%.dtbo: dtbs_prepare
 	$(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@
 
-PHONY += dtbs dtbs_install dtbs_check
-dtbs: include/config/kernel.release scripts_dtc
+PHONY += dtbs dtbs_prepare dtbs_install dtbs_check
+dtbs: dtbs_prepare
 	$(Q)$(MAKE) $(build)=$(dtstree)
 
+# include/config/kernel.release is actually needed when installing DTBs because
+# INSTALL_DTBS_PATH contains $(KERNELRELEASE). However, we do not want to make
+# dtbs_install depend on it as dtbs_install may run as root.
+dtbs_prepare: include/config/kernel.release scripts_dtc
+
 ifneq ($(filter dtbs_check, $(MAKECMDGOALS)),)
 export CHECK_DTBS=y
 dtbs: dt_binding_check
Signature · 1 line
2.34.1
Signature · 3 lines
epost|xmpp: [email protected]          irc://oftc.net/nsc
↳ gpg: 18ed 52db e34f 860e e9fb  c82b 7d97 0932 55a0 ce7f
     -- frykten for herren er opphav til kunnskap --
#2 lore raw
In reply to Masahiro Yamada
Quoted 4 lines · Masahiro Yamada

Factor out the common prerequisites for DT compilation into the new target, dtbs_prepare.

Quoted 8 lines

Add comments to explain why include/config/kernel.release is the prerequisite. Our policy is that installation targets must not rebuild anything in the tree. If 'make modules_install' is executed as root, include/config/kernel.release may be owned by root.

---

Applied to linux-kbuild.

Quoted 39 lines

Changes for v2:
- rephase the comment more concise

 Makefile | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
Makefile +9 -5
index dee707c98bbe..a2a030f41e65 100644
@@ -1370,16 +1370,21 @@ endif
 
 ifneq ($(dtstree),)
 
-%.dtb: include/config/kernel.release scripts_dtc
+%.dtb: dtbs_prepare
        $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@
 
-%.dtbo: include/config/kernel.release scripts_dtc
+%.dtbo: dtbs_prepare
        $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@
 
-PHONY += dtbs dtbs_install dtbs_check
-dtbs: include/config/kernel.release scripts_dtc
+PHONY += dtbs dtbs_prepare dtbs_install dtbs_check
+dtbs: dtbs_prepare
        $(Q)$(MAKE) $(build)=$(dtstree)
 
+# include/config/kernel.release is actually needed when installing DTBs because
+# INSTALL_DTBS_PATH contains $(KERNELRELEASE). However, we do not want to make
+# dtbs_install depend on it as dtbs_install may run as root.
+dtbs_prepare: include/config/kernel.release scripts_dtc
+
 ifneq ($(filter dtbs_check, $(MAKECMDGOALS)),)
 export CHECK_DTBS=y
 dtbs: dt_binding_check
--

2.34.1

Signature · 2 lines
Best Regards
Masahiro Yamada