public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] kbuild: add dtbs_prepare target
@ 2022-07-24  9:59 Masahiro Yamada
  2022-07-24 13:30 ` Nicolas Schier
  2022-07-30 17:19 ` Masahiro Yamada
  0 siblings, 2 replies; 3+ messages in thread
From: Masahiro Yamada @ 2022-07-24  9:59 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Nicolas Schier, Masahiro Yamada, Michal Marek, Nick Desaulniers,
	linux-kernel

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.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

Changes for v2:
 - rephase the comment more concise

 Makefile | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index dee707c98bbe..a2a030f41e65 100644
--- a/Makefile
+++ b/Makefile
@@ -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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] kbuild: add dtbs_prepare target
  2022-07-24  9:59 [PATCH v2] kbuild: add dtbs_prepare target Masahiro Yamada
@ 2022-07-24 13:30 ` Nicolas Schier
  2022-07-30 17:19 ` Masahiro Yamada
  1 sibling, 0 replies; 3+ messages in thread
From: Nicolas Schier @ 2022-07-24 13:30 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-kbuild, Michal Marek, Nick Desaulniers, linux-kernel

On Sun, Jul 24, 2022 at 06:59:19PM +0900, Masahiro Yamada wrote:
> Date:   Sun, 24 Jul 2022 18:59:19 +0900
> From: Masahiro Yamada <masahiroy@kernel.org>
> To: linux-kbuild@vger.kernel.org
> Cc: Nicolas Schier <nicolas@fjasle.eu>, Masahiro Yamada
>  <masahiroy@kernel.org>, Michal Marek <michal.lkml@markovi.net>, Nick
>  Desaulniers <ndesaulniers@google.com>, linux-kernel@vger.kernel.org
> Subject: [PATCH v2] kbuild: add dtbs_prepare target
> Message-Id: <20220724095919.436126-1-masahiroy@kernel.org>
> X-Mailer: git-send-email 2.34.1
> List-ID: <linux-kbuild.vger.kernel.org>
> X-Mailing-List: linux-kbuild@vger.kernel.org
> 
> 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.
> 
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---

Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>

> 
> Changes for v2:
>  - rephase the comment more concise
> 
>  Makefile | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index dee707c98bbe..a2a030f41e65 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -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

-- 
epost|xmpp: nicolas@fjasle.eu          irc://oftc.net/nsc
↳ gpg: 18ed 52db e34f 860e e9fb  c82b 7d97 0932 55a0 ce7f
     -- frykten for herren er opphav til kunnskap --

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] kbuild: add dtbs_prepare target
  2022-07-24  9:59 [PATCH v2] kbuild: add dtbs_prepare target Masahiro Yamada
  2022-07-24 13:30 ` Nicolas Schier
@ 2022-07-30 17:19 ` Masahiro Yamada
  1 sibling, 0 replies; 3+ messages in thread
From: Masahiro Yamada @ 2022-07-30 17:19 UTC (permalink / raw)
  To: Linux Kbuild mailing list
  Cc: Nicolas Schier, Michal Marek, Nick Desaulniers,
	Linux Kernel Mailing List

On Sun, Jul 24, 2022 at 7:01 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> 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.
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
>

Applied to linux-kbuild.

> Changes for v2:
>  - rephase the comment more concise
>
>  Makefile | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index dee707c98bbe..a2a030f41e65 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -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
>


-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-30 17:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-24  9:59 [PATCH v2] kbuild: add dtbs_prepare target Masahiro Yamada
2022-07-24 13:30 ` Nicolas Schier
2022-07-30 17:19 ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox