devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masahiro Yamada <masahiroy@kernel.org>
To: Nicolas Schier <nicolas@fjasle.eu>
Cc: Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>,
	DTML <devicetree@vger.kernel.org>, Rob Herring <robh@kernel.org>,
	Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
	Michal Marek <michal.lkml@markovi.net>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] kbuild: add dtbs_prepare target
Date: Sat, 23 Jul 2022 09:33:03 +0900	[thread overview]
Message-ID: <CAK7LNASFLKfDaPgWRzq2dw0939eLbcn5Y4A-qtSEfZs9BDecRg@mail.gmail.com> (raw)
In-Reply-To: <Ytp4PyBcCfRsVaG5@bergen.fjasle.eu>

On Fri, Jul 22, 2022 at 7:14 PM Nicolas Schier <nicolas@fjasle.eu> wrote:
>
> On Sat, 16 Jul 2022 18:31:22 +0900 Masahiro Yamada wrote:
> > Factor out the common prerequisites for DT compilation into the new
> > target, dtbs_prepare.
> >
> > Add comments in case you wonder why include/config/kernel.release is
> > the prerequisite. Our policy is that installation targets must not
> > (re)compile any build artifacts in the tree. If we make modules_install
> > depend on include/config/kernel.release and it is executed under the
> > root privilege, it may be owned by root.
> >
> > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> > ---
> >
> >  Makefile | 14 ++++++++++----
> >  1 file changed, 10 insertions(+), 4 deletions(-)
> >
> > diff --git a/Makefile b/Makefile
> > index a9bd55edb75e..8aa4dbb8f878 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -1367,16 +1367,22 @@ 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)/$@
>
> Is there a reason, why both rules are not unified?  I guess it is, but
> I can't see it.



See the GNU Make manual:
https://www.gnu.org/software/make/manual/html_node/Pattern-Examples.html

The last paragraph, "This pattern rule has two targets ..."



%.dtb %.dtbo: dtbs_prepare
         ...

means foo.dtb and foo.dtbo are generated at the same
time by the rule.  This is strange.





>
> >
> > -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 not actually required for building DTBs,
> > +# but for installing DTBs because INSTALL_DTBS_PATH contains $(KERNELRELEASE).
> > +# We do not want to move it to dtbs_install. The policy is installation
> > +# targets (, which may run as root) must not modify the tree.
>
> Is the comma after the opening parenthesis intended?


I will rephrase the comment in v2.




>
> Kind regards,
> Nicolas
>
> > +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

  reply	other threads:[~2022-07-23  0:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-16  9:31 [PATCH] kbuild: add dtbs_prepare target Masahiro Yamada
2022-07-22 10:13 ` Nicolas Schier
2022-07-23  0:33   ` Masahiro Yamada [this message]
2022-07-23 19:27     ` Nicolas Schier
2022-07-27  9:58 ` Dmitry Baryshkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAK7LNASFLKfDaPgWRzq2dw0939eLbcn5Y4A-qtSEfZs9BDecRg@mail.gmail.com \
    --to=masahiroy@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=ndesaulniers@google.com \
    --cc=nicolas@fjasle.eu \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).