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: 380216 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1057250jah; Wed, 10 Feb 2021 03:16:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJwaAhOkOa03wNaY1Gt1cyOVtLA0jzE/dedN+QfnrVNQUZ9WJB9EJM4dp0T+rZkrdJuTORgB X-Received: by 2002:a17:906:f195:: with SMTP id gs21mr2430315ejb.225.1612955770436; Wed, 10 Feb 2021 03:16:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612955770; cv=none; d=google.com; s=arc-20160816; b=X6qvxp3sZYjxy3JYIeBJbwm2eyHtZTuE1iwzPznsIIEU3uUsgvGC0iNLQG2G1s/Wa/ D0A8KftmJiix7VpJfoDqUB+DonG72h26g4HSHwwH/4tfwneI3MrHCl4unXGffrdvsoyg WKd7LtE6UoVFMCphdq1KMxtvRfHFGZDr8DEJA+ntlYN2LalLc8M/SnELTfO6H3LytzfV o020gvgw/zKWN+qtLUfOt9ibC+3VX8qUVFWyZmKiMFcg4yqZGeH0PT1F/U6CWr7LDrT5 ReKVyENjmqMXsmpPWMEyIEHEQMVK2sGjRZieBPzaSUocNDFuSDMpYUBzCVwS4ldhAuKK xIJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=O8YkywS7lLAIufhvKkJi5/1g3qyP+3mleUpUq6JaIRY=; b=mb85wxdYxp1ryiVAYLiZLNVO9Dlf35Z46n+NPFy5G1cNC5HL+DoP8J5XtWl6vmNwH2 uC3kiMpXP+p2rJz/GWuuGhAr7sMJ0RQd9eyCSy9CS+PkXNteJPSDaE8Lzs2bQHYV7CSY 9/ET8XqZz8bp5opDAwxDyLNJsTzQkuvOlwjoXBNgGFKKRydYmtHUvc7A7Ax1+z4F80u4 Ys5CxzMRMacHuGuu/NatarIS+yOLK09pYVAlKNzMuACKmEAPFU3AdOUmQ/vcMzkUjw2E GMMmFQf77qRqRHKrf17KVa8mRl+9npzzPEo9iMlqy6JIZulHaSF44+CyQE/zcVMcR6ke hlaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ONM9R6OI; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kw2si1074771ejc.366.2021.02.10.03.16.10; Wed, 10 Feb 2021 03:16:10 -0800 (PST) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ONM9R6OI; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230523AbhBJLP6 (ORCPT + 6 others); Wed, 10 Feb 2021 06:15:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230471AbhBJLOY (ORCPT ); Wed, 10 Feb 2021 06:14:24 -0500 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB180C061797 for ; Wed, 10 Feb 2021 03:13:42 -0800 (PST) Received: by mail-pf1-x436.google.com with SMTP id 189so1045218pfy.6 for ; Wed, 10 Feb 2021 03:13:42 -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=H88mqqn/61Ep9ofie5fgv+uhJLvMKjpWD85H5JEl0R75IFMLxdjc1gIsGMw+LmbKPI TLEl7J84ITJ9DN6JOD4R1fAw/Y/mrBVAjn3+pyZcCwl9NOMaTDwT8DzdPFiWT5hzWdoU NUfzpPt+/S2j3pKC98mCaP2HO+mAhL5uVekjFtRSfR9iz1XXENuYiaJDc/Vq2bgeu3Zk AxpGpmyyqMTsi7DCD2NdPmjvtZlGdgRLISKe9Rck2NaUEv2+Gbu486v/8jiIkFhFcF3D b20GO7GU70eroh9bHOWW9lQzqDDkhw3HRk7Oy2HVhgchr20wprArxlcFrGfNKcd/wLKh wftg== X-Gm-Message-State: AOAM530KL+gr4kqOdgcsmEKoUnme1I/ThZkWkhCO+fuvGJCEH/444y31 pAwvvIwd8E8armtOPiGqw1pYpg== 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 Cc: Viresh Kumar , Vincent Guittot , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, anmar.oueja@linaro.org, Bill Mills , David Gibson , devicetree@vger.kernel.org, linux-kbuild@vger.kernel.org, Geert Uytterhoeven , Michal Simek , Rob Herring 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 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.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(-) -- 2.25.0.rc1.19.g042ed3e048af 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