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: 12920023 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 B4943C43334 for ; Sat, 16 Jul 2022 09:33:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231528AbiGPJdF (ORCPT ); Sat, 16 Jul 2022 05:33:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232035AbiGPJdA (ORCPT ); Sat, 16 Jul 2022 05:33:00 -0400 Received: from conuserg-12.nifty.com (conuserg-12.nifty.com [210.131.2.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 492502657A; Sat, 16 Jul 2022 02:32:58 -0700 (PDT) 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: linux-kbuild@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 Reviewed-by: Dmitry Baryshkov Tested-by: Dmitry Baryshkov --- 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