From patchwork Sat Jul 16 09:31:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 591195 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 F205BC433EF for ; Sat, 16 Jul 2022 09:39:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233095AbiGPJjP (ORCPT ); Sat, 16 Jul 2022 05:39:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232920AbiGPJi6 (ORCPT ); Sat, 16 Jul 2022 05:38:58 -0400 X-Greylist: delayed 183 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sat, 16 Jul 2022 02:38:48 PDT Received: from condef-03.nifty.com (condef-03.nifty.com [202.248.20.68]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D698113E0A for ; Sat, 16 Jul 2022 02:38:46 -0700 (PDT) Received: from conuserg-12.nifty.com ([10.126.8.75])by condef-03.nifty.com with ESMTP id 26G9WxxJ013530 for ; Sat, 16 Jul 2022 18:33:00 +0900 Received: from grover.sesame ([133.106.62.13]) (authenticated) by conuserg-12.nifty.com with ESMTP id 26G9VZu3010688; Sat, 16 Jul 2022 18:31:36 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com 26G9VZu3010688 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1657963897; bh=lo5mfoKD7vRR8DCYCccjxLLxvc3Zerc9iud4vad1cjM=; h=From:To:Cc:Subject:Date:From; b=tkPRoc/IKNMhC15S0dVGMiXp5Y6Al6ATPBFzkIeDcLgtp16gxEImu4M6A3bdlZ8YW EmCEgER2gk6jph2g+jCpCN7mCYNakohvyk86OoeaGpfWaP70w9BZ8h3f8DFsdcw9y/ 4j7iwF+mm5LscWv0pbH2BnrqwZMF7Qkmx132dXeNx/245XJKojzO/HaeOnKQIvJ/yc 6x8kANnU2awHonRtuq8Vff0yxpsKEJQD/W89IAYrkA0oOrPRuTWZ9/bPHoP+32gHBN rItGiAnsVYFx1MV62ksAvrhFn5nLIEa1pDAuO0kIfZUIvyNc8E1aypYtvv+6dl7J9Z NZMe2titjEKNw== X-Nifty-SrcIP: [133.106.62.13] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org, devicetree@vger.kernel.org, Rob Herring Cc: Dmitry Baryshkov , Masahiro Yamada , Michal Marek , Nick Desaulniers , linux-kernel@vger.kernel.org Subject: [PATCH] kbuild: add dtbs_prepare target Date: Sat, 16 Jul 2022 18:31:22 +0900 Message-Id: <20220716093122.137494-1-masahiroy@kernel.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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)/$@ -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. +dtbs_prepare: include/config/kernel.release scripts_dtc + ifneq ($(filter dtbs_check, $(MAKECMDGOALS)),) export CHECK_DTBS=y dtbs: dt_binding_check