From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7A3ECCA489 for ; Sat, 23 Jul 2022 00:34:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232454AbiGWAeZ (ORCPT ); Fri, 22 Jul 2022 20:34:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229572AbiGWAeX (ORCPT ); Fri, 22 Jul 2022 20:34:23 -0400 Received: from conssluserg-05.nifty.com (conssluserg-05.nifty.com [210.131.2.90]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B43798246D; Fri, 22 Jul 2022 17:34:21 -0700 (PDT) Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (authenticated) by conssluserg-05.nifty.com with ESMTP id 26N0Y09R021050; Sat, 23 Jul 2022 09:34:01 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-05.nifty.com 26N0Y09R021050 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1658536441; bh=RVyxmU6w2hKmkKjVqxY3k5xGesiVVZUE6Qda81Yil5U=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=CnaaStUm5lwcDDgnvcoHtRhI9g9Hj2UD0mFivWgQ9TXC0e+wcSWDICqtgCA4VVyNZ KOUayWTnng3O06XB7hnZuM68DqZVAwNL02hOc/8sdwj1bC5Wp1eP1AbusZbWAjweUq y/nZnSCii48PwPhIAUr7ZMLVBRpBb98+1MQ3Pe5vr+AiDJ6txtMt5ctgo0DsbzvUVi Y/QlM4vi5hGcmlIQbks7nXsGaOmVm2X5gjgsfWSoQthW3sbnX6ZN6NQ3h8UB/HLZnB gLR3BnEybJgHj7QNOnBysG66U1Gih3iUx8S9G2spveERabUd8uTSPiv916QuAr3kGX JH+iLSowUm73w== X-Nifty-SrcIP: [209.85.221.52] Received: by mail-wr1-f52.google.com with SMTP id n12so8503947wrc.8; Fri, 22 Jul 2022 17:34:01 -0700 (PDT) X-Gm-Message-State: AJIora85ecYxX3IjRSFU5UWh5lvr8EDURw2noW0pg/FUazQNcox2gQ41 lm8oFblg9vMGA1vOK69vOPSGlU4cSSsM/63TWqM= X-Google-Smtp-Source: AGRyM1sq0fCTIgtFFn2MLkvMra5q7ss5/nqd6TfpnI/TBo055eWmc2bnOhR4KMgJSEGaHvnv7WiWQKxzYhABCTobl4A= X-Received: by 2002:a05:6000:104c:b0:21d:87bf:63a2 with SMTP id c12-20020a056000104c00b0021d87bf63a2mr1319505wrx.461.1658536439845; Fri, 22 Jul 2022 17:33:59 -0700 (PDT) MIME-Version: 1.0 References: <20220716093122.137494-1-masahiroy@kernel.org> In-Reply-To: From: Masahiro Yamada Date: Sat, 23 Jul 2022 09:33:03 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] kbuild: add dtbs_prepare target To: Nicolas Schier Cc: Linux Kbuild mailing list , DTML , Rob Herring , Dmitry Baryshkov , Michal Marek , Nick Desaulniers , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 22, 2022 at 7:14 PM Nicolas Schier 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 > > --- > > > > 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