From patchwork Tue Jan 9 12:07:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 186344 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp61237dyi; Tue, 9 Jan 2024 04:08:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IH2/kJcec8OD/NkiDYlEto6WbYxJnr5B2Riy+w3QpxRaR/NOJbnyJksG7ZrYr4+0dGjyCrZ X-Received: by 2002:a17:906:7801:b0:a26:edeb:8b11 with SMTP id u1-20020a170906780100b00a26edeb8b11mr492761ejm.36.1704802125058; Tue, 09 Jan 2024 04:08:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704802125; cv=none; d=google.com; s=arc-20160816; b=jmKF41zIgfZJ1UCEpaY3LcGq6yMLYnL2637cROyJMTZ+zh8OLE6U+mLrS2n4nY/z/i xJmer+5GmmjySe5USl+Rv1gVmIH+OxQK4n/056csf9FPn0OsEJljWNOgL2fvRng1FkeA l0AQ+hHli0/YOYd/EGzy33IvEl4HN+nJWNkEQu/ozuvrFPTikbIkpyJhcu0B8pdsIemJ 4grMgRMBeFL1uh2bOu4zNFfdc7qmyAueEFtjAZNm2viactGf1H/Heli7Dc1mwJIUAgIk kDL2Sgh7Fpi2O9Q9Gc/Y3lzpX4cnXGRIblb90rCSfHjHVRGHmYo/lQ6jFmWmfSbJMSZr XpXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Po/jEVQCKd2sUbxuOT5nlLWeZKTaHXBYlnwRFyldfpw=; fh=I/2MmNZ0xfeDyN6PIJexzYyObxcTEvIkeC0z7Z6DQ/c=; b=UbGao3cZiLijxWkArr95NE34/UdVRD1sHSRxSffeT5N8EMYtzthBVrU6HtyuURbQdx Z3r6CupOT016caZ4Dw3SkInkRpofneMYyoiOtgMwZqH5tJXcaL4OzUiAH+se2jZ23xTC TJ0KC8LujXrcoXEnLRyx5qkNQl0VDrG6OcIgYW42lb0SRu9Un2cuAhzX/fS3uL00oNG1 SZQDxw/ax9182ascndtGdCGfVrJPVTMf589kJOtMw1oRsonU+Jptefmn75RzzPYeR4V1 dIhplpe2XmJsW/XGqV2zXrZ3EH9uXZ6dy4Xrue22Wyr6It1J+8E55Q6wxql5Am5XKyQE E5Cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JZhQQiq1; spf=pass (google.com: domain of linux-kernel+bounces-20828-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20828-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id ha13-20020a170906a88d00b00a2abdf736d9si727026ejb.186.2024.01.09.04.08.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 04:08:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-20828-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JZhQQiq1; spf=pass (google.com: domain of linux-kernel+bounces-20828-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20828-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 803451F25621 for ; Tue, 9 Jan 2024 12:08:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0058F38F8B; Tue, 9 Jan 2024 12:07:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JZhQQiq1" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 559C5381A2; Tue, 9 Jan 2024 12:07:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1A43C43390; Tue, 9 Jan 2024 12:07:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704802071; bh=0i7egdX2nZv01YOBcXbZOK2my3bgeNy9DuIuiyc852c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JZhQQiq16hZd3VAds5HeEend/8zOji+3Gy2B7/Z153/q/SYl++wP8N2JJe3yotR6j HCmmjQoUyKBXQkp0JfNUyJ+GBoH5l3unv7bPQgNYngXx4xzLkFnz4iDgBtIVt2d7wi 3CY/3m9IJ5uRNQe7QN8VaGs6UWL+uXn1F5TL/VB3p13Tnz/RpQmEyPn0bz0qo7KudX cWMaexrdMZNFdjWCRtBRu4SOKukeZ2dMddOSB5z1wdEXOgxdjYR9frnhfHm5rjyBwd LiZKQ35fZ0RDfg2OHvoxUSzZZENM1c0N9yxTdr6Y2ERIPuugu4Yi/zbzcuX0s00b09 e5/pRgqlLb+LA== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: devicetree@vger.kernel.org, Rob Herring , Simon Glass , Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier , linux-kernel@vger.kernel.org Subject: [PATCH 2/4] kbuild: simplify dtbs_install by reading the list of compiled DTBs Date: Tue, 9 Jan 2024 21:07:35 +0900 Message-Id: <20240109120738.346061-3-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240109120738.346061-1-masahiroy@kernel.org> References: <20240109120738.346061-1-masahiroy@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787614593143365071 X-GMAIL-MSGID: 1787614593143365071 Retrieve the list of *.dtb(o) files from arch/*/boot/dts/dtbs-list instead of traversing the directory tree again. Please note that 'make dtbs_install' installs *.dtb(o) files directly added to dtb-y because scripts/Makefile.dtbinst installs $(dtb-y) without expanding the -dtbs suffix. This commit preserves this behavior. Signed-off-by: Masahiro Yamada --- Makefile | 2 +- scripts/Kbuild.include | 6 ------ scripts/Makefile.dtbinst | 32 ++++++++++++++++++-------------- 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index db7f9e34a24e..dae6825b8082 100644 --- a/Makefile +++ b/Makefile @@ -1407,7 +1407,7 @@ endif dtbs_check: dtbs dtbs_install: - $(Q)$(MAKE) $(dtbinst)=$(dtstree) dst=$(INSTALL_DTBS_PATH) + $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.dtbinst obj=$(dtstree) ifdef CONFIG_OF_EARLY_FLATTREE all: dtbs diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 7778cc97a4e0..2f331879816b 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -113,12 +113,6 @@ endef # $(Q)$(MAKE) $(build)=dir build := -f $(srctree)/scripts/Makefile.build obj -### -# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.dtbinst obj= -# Usage: -# $(Q)$(MAKE) $(dtbinst)=dir -dtbinst := -f $(srctree)/scripts/Makefile.dtbinst obj - ### # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj= # Usage: diff --git a/scripts/Makefile.dtbinst b/scripts/Makefile.dtbinst index 4405d5b67578..67956f6496a5 100644 --- a/scripts/Makefile.dtbinst +++ b/scripts/Makefile.dtbinst @@ -8,32 +8,36 @@ # $INSTALL_PATH/dtbs/$KERNELRELEASE # ========================================================================== -src := $(obj) - PHONY := __dtbs_install __dtbs_install: include include/config/auto.conf include $(srctree)/scripts/Kbuild.include -include $(kbuild-file) -dtbs := $(addprefix $(dst)/, $(dtb-y) $(if $(CONFIG_OF_ALL_DTBS),$(dtb-))) -subdirs := $(addprefix $(obj)/, $(subdir-y) $(subdir-m)) - -__dtbs_install: $(dtbs) $(subdirs) - @: +dst := $(INSTALL_DTBS_PATH) quiet_cmd_dtb_install = INSTALL $@ cmd_dtb_install = install -D $< $@ -$(dst)/%.dtb: $(obj)/%.dtb +$(dst)/%: $(obj)/% $(call cmd,dtb_install) -$(dst)/%.dtbo: $(obj)/%.dtbo - $(call cmd,dtb_install) +dtbs := $(patsubst $(obj)/%,%,$(call read-file, $(obj)/dtbs-list)) -PHONY += $(subdirs) -$(subdirs): - $(Q)$(MAKE) $(dtbinst)=$@ dst=$(if $(CONFIG_ARCH_WANT_FLAT_DTB_INSTALL),$(dst),$(patsubst $(obj)/%,$(dst)/%,$@)) +ifdef CONFIG_ARCH_WANT_FLAT_DTB_INSTALL + +define gen_install_rules +$(dst)/%: $(obj)/$(1)% + $$(call cmd,dtb_install) +endef + +$(foreach d, $(sort $(dir $(dtbs))), $(eval $(call gen_install_rules,$(d)))) + +dtbs := $(notdir $(dtbs)) + +endif # CONFIG_ARCH_WANT_FLAT_DTB_INSTALL + +__dtbs_install: $(addprefix $(dst)/, $(dtbs)) + @: .PHONY: $(PHONY)