From patchwork Wed Feb 10 11:13:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12080563 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F27D1C433E6 for ; Wed, 10 Feb 2021 11:16:09 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BB95864E2A for ; Wed, 10 Feb 2021 11:16:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BB95864E2A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=u5RFKypVdnBRZBf13MuIjsTARuFNfjWJqmcrVgE3GlY=; b=WyKVrMk1Z/mpDkdBZDdrcJzw5 zppvpCdM1+aq5MXoS5c1xnFbQVTk4lupUtnQT4XkJcTGFL+8Az0m3wX++/hMH77GPH5KMFjH9+IHb s8f4/LBdfmr7lVhaUA/KUZOlVS7wKQL+iZnP0lW9E2aCroMmHig6lsi8vu/wREjMVqXBG0n3PE2jo cZhuLHxEUq7G5aNKIe9DoT5PKdOraYS8GHatjHiQdWm6hIBysCUaYjelnmidofw0Tt3v2okYhQMLX j+EqLho5MjiWXeb5aMWX0KA0jhKmVfnFlKLBXFsNabkmRXSKqiqDBsNpv3i+HwYOQqgR85Jizgiz7 Q1YUpXlSw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l9nRV-0003LU-D0; Wed, 10 Feb 2021 11:13:57 +0000 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l9nRK-0003Cq-8v for linux-arm-kernel@lists.infradead.org; Wed, 10 Feb 2021 11:13:47 +0000 Received: by mail-pg1-x52b.google.com with SMTP id b21so1011866pgk.7 for ; Wed, 10 Feb 2021 03:13:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=O8YkywS7lLAIufhvKkJi5/1g3qyP+3mleUpUq6JaIRY=; b=ONM9R6OIvBklENnChYkZM9J09WZdBgFB31Tmk9m832BdDdTEA/Xi04lo5hmOJqBCaQ diDpPNGXstAju4HbR6t7bzwJmj5g951iP+Fvq+euNKcHQgOGJN5Aldd+Ps6/L8JHaFFY fXvug7fwEEapiqffSwY6n/BG8Wkp91Q/qnI4c0ZL0oJnlGrU5CxXczWs9qmeIKjNZmsS HZ2hIUm90XEI1LNq4EttGku4Qg9uVbep+AhYRn85bbPGb84EMoF7jJ6E/hbvjdxxzFtK bPhecshqL4En0QxstAvW87qwxAL9MroGdaB51To2Z0sNFDel/CufdAWXw2ZNPUq82lRn z7jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=O8YkywS7lLAIufhvKkJi5/1g3qyP+3mleUpUq6JaIRY=; b=aD+Ubj8i2u0IHh1EidZqxveLttCOVICrIh78xtkLBkKu0Oyw7FAqeEzTukNWOZdZFm joEjgE7PFGl3gtp7UWikW2Wbea+lygCsvCWQ1fstDD4FH+5Lephsrt/4YsPWRHMtVtWA pUVutR+EyXbTspGD7euKSCbkKsqCf3NyGeSUjDgJiG4jH519/SLutO8EmQCQq/gMfIBU sRYmH9N5HUB7IZo7FgXoiisx+VoL59bgGrHEGdy8UtSS8lkhONXiaCshM5Ck50YTZbgO XxJCbKFd/HLkeXQc/TXyw7bBX3xi+pLAxTm7kduTtNFyLRb0RBthVywpsr5HFq0QcVxU RCbA== X-Gm-Message-State: AOAM530+Q7rUppoSSaaYUWxzJhZ9aQOIWKQB62H6CXpLGXSLiPl/HsEx IwJBJsfFWYRkHZRDn+cBZx5SRw== X-Google-Smtp-Source: ABdhPJxQ8VtaP8Q3QEkmsz91Q7mht2EHplLHVe96gUy98AjYu3+UvCQTfPzLQ7MK2cbxiR2eV5tGhw== X-Received: by 2002:aa7:90c5:0:b029:1e3:5e84:4a7c with SMTP id k5-20020aa790c50000b02901e35e844a7cmr2615094pfk.71.1612955622149; Wed, 10 Feb 2021 03:13:42 -0800 (PST) Received: from localhost ([122.172.59.240]) by smtp.gmail.com with ESMTPSA id f13sm4719164pjj.1.2021.02.10.03.13.41 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Feb 2021 03:13:41 -0800 (PST) From: Viresh Kumar To: Frank Rowand , Rob Herring , Pantelis Antoniou , Masahiro Yamada , Michal Marek Subject: [PATCH V7 1/3] kbuild: Add generic rule to apply fdtoverlay Date: Wed, 10 Feb 2021 16:43:28 +0530 Message-Id: <44dad578df8a848fc378cd358f03b071f44c9a5b.1612955268.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.25.0.rc1.19.g042ed3e048af In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210210_061346_503768_88EAF604 X-CRM114-Status: GOOD ( 13.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Vincent Guittot , linux-kbuild@vger.kernel.org, Viresh Kumar , Bill Mills , linux-kernel@vger.kernel.org, Michal Simek , anmar.oueja@linaro.org, Geert Uytterhoeven , Rob Herring , linux-arm-kernel@lists.infradead.org, David Gibson Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Rob Herring Add a generic rule to apply fdtoverlay in Makefile.lib, so every platform doesn't need to carry the complex rule. The platform's Makefile only needs to have this now: DTC_FLAGS_foo_base += -@ foo-dtbs := foo_base.dtb foo_overlay1.dtbo foo_overlay2.dtbo overlay-y := foo.dtb Rearrange Makefile.lib to keep DT specific stuff together. The files from overlay-y (i.e. files generated by fdtoverlay) aren't added to dtb-y here, as dtb-y is later used to generate .dt.yaml files and the files in overlay-y don't have a corresponding dts file and make dtbs_check fails for them. Signed-off-by: Rob Herring [ Viresh: Add commit log and replace dtb-y with overlay-y, handle CONFIG_OF_ALL_DTBS case, rearrange Makefile, don't add overlay-y to dtb-y to skip dtbs_check for them. ] Signed-off-by: Viresh Kumar --- scripts/Makefile.lib | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index b00855b247e0..a6e79e3be527 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -66,23 +66,16 @@ multi-used := $(multi-used-y) $(multi-used-m) real-obj-y := $(foreach m, $(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) real-obj-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)) $($(m:.o=-))),$($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)),$(m))) -always-y += $(always-m) - -# hostprogs-always-y += foo -# ... is a shorthand for -# hostprogs += foo -# always-y += foo -hostprogs += $(hostprogs-always-y) $(hostprogs-always-m) -always-y += $(hostprogs-always-y) $(hostprogs-always-m) - -# userprogs-always-y is likewise. -userprogs += $(userprogs-always-y) $(userprogs-always-m) -always-y += $(userprogs-always-y) $(userprogs-always-m) +# Add base dtb and overlay dtbo +dtb-y += $(foreach m,$(overlay-y), $(if $(strip $($(m:.dtb=-dtbs))),$($(m:.dtb=-dtbs)),)) +dtb-$(CONFIG_OF_ALL_DTBS) += $(foreach m,$(overlay-), $(if $(strip $($(m:.dtb=-dtbs))),$($(m:.dtb=-dtbs)),)) # DTB # If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built extra-y += $(dtb-y) +extra-y += $(overlay-y) extra-$(CONFIG_OF_ALL_DTBS) += $(dtb-) +extra-$(CONFIG_OF_ALL_DTBS) += $(overlay-) ifneq ($(CHECK_DTBS),) extra-y += $(patsubst %.dtb,%.dt.yaml, $(dtb-y)) @@ -91,6 +84,19 @@ extra-$(CONFIG_OF_ALL_DTBS) += $(patsubst %.dtb,%.dt.yaml, $(dtb-)) extra-$(CONFIG_OF_ALL_DTBS) += $(patsubst %.dtbo,%.dt.yaml, $(dtb-)) endif +always-y += $(always-m) + +# hostprogs-always-y += foo +# ... is a shorthand for +# hostprogs += foo +# always-y += foo +hostprogs += $(hostprogs-always-y) $(hostprogs-always-m) +always-y += $(hostprogs-always-y) $(hostprogs-always-m) + +# userprogs-always-y is likewise. +userprogs += $(userprogs-always-y) $(userprogs-always-m) +always-y += $(userprogs-always-y) $(userprogs-always-m) + # Add subdir path extra-y := $(addprefix $(obj)/,$(extra-y)) @@ -332,6 +338,15 @@ $(obj)/%.dtb: $(src)/%.dts $(DTC) FORCE $(obj)/%.dtbo: $(src)/%.dts $(DTC) FORCE $(call if_changed_dep,dtc) + +quiet_cmd_fdtoverlay = DTOVL $@ + cmd_fdtoverlay = $(objtree)/scripts/dtc/fdtoverlay -o $@ -i $(real-prereqs) + +.SECONDEXPANSION: + +$(obj)/%.dtb: $$(addprefix $$(obj)/,$$(%-dtbs)) FORCE + $(call if_changed,fdtoverlay) + DT_CHECKER ?= dt-validate DT_BINDING_DIR := Documentation/devicetree/bindings # DT_TMP_SCHEMA may be overridden from Documentation/devicetree/bindings/Makefile