From patchwork Tue Jan 9 12:07:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 186343 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp61102dyi; Tue, 9 Jan 2024 04:08:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IEXATxWAOl1k7JbDBKXBRJD9gynwO/+XPJo9IHzq6ybf5tClOomLK5tGRlFY1ffDitmA7M+ X-Received: by 2002:a05:6102:4b04:b0:467:dcad:4877 with SMTP id ia4-20020a0561024b0400b00467dcad4877mr2015540vsb.63.1704802111240; Tue, 09 Jan 2024 04:08:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704802111; cv=none; d=google.com; s=arc-20160816; b=hEklCkTprkGougLl0CEH1GNWR+8RSm1WDE0lJChvOXmPuqEuaiTNOXYTAGdnMbbGk0 XGqucXZckEJF4jkOdyTO3gWihFQbHnqZ2D7m53Bw48X5fyfF6K0HqeCgRUFu0cYwMaZ2 FtERISCth8nXOKESZyk6+Dwqea5rBbUQlzEGpuyzt6X856Cp5o957RK3FnnHG6u/xyzF CDL5n0Rq2uznEASMJ9/ddGP77G2jKtSXWwxSdSJkvboMfIK1HJF5TY8ednbZKovL02OL emM2gw0LNECs4abIefoffjzv15YQ33fDDb8G9vLyg0eJH2Kh0qZhCjvN5hXJQyFbL+xi wjsw== 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=klhZFuMFs2Pha4FImXZhof62qdKUbdSKlCwLhD3mGes=; fh=I/2MmNZ0xfeDyN6PIJexzYyObxcTEvIkeC0z7Z6DQ/c=; b=PhNLGVJWmfDuHzMn3nQ7MeWgwSuPfSm4SSMLiVvHAllcRu/QP5idnGDcJN1X69v+1w a2Gch3EbFAbxPZnXuyx9lulCV+ZCGWznEgoLctOn6/S0RdiRDZsf89I5RVmkbQrf96w2 7EZO3Xy2U/xx5dgtjHfefbQVyF693hNEjpsVAYGMhL4rlnckgOyZNGALW+x8dHqJ9Shv ZciSK8ZUVVFjHvXzgZBG31m6x+KuIEe3GHkzADVdC2oHK/z9IcI8U2bLbO3aD5B61SS/ x9TMG8mPRqJU4d1178HqCR5nbNISyuRu5+6HzyG9DJEHIEG+sn6HVLnZa8gDqQ5aVeJ6 vssQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XwGYdl4H; spf=pass (google.com: domain of linux-kernel+bounces-20827-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20827-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id n8-20020ab07488000000b007cb71baed5csi241172uap.41.2024.01.09.04.08.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 04:08:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-20827-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XwGYdl4H; spf=pass (google.com: domain of linux-kernel+bounces-20827-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20827-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 064201C23DDD for ; Tue, 9 Jan 2024 12:08:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 801FB38DE9; Tue, 9 Jan 2024 12:07:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XwGYdl4H" 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 C1CCF381AE; Tue, 9 Jan 2024 12:07:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1249C43399; Tue, 9 Jan 2024 12:07:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704802069; bh=uYa16IEEJlpGSqmjAAvT3Wz06Y8oSxPf78zrq9xQRVg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XwGYdl4HWKvN8WrzDx3lBhxVXf5qH1spEwHoYUj3ccjxwKAV4WRIaPZKTIEGC2wyy QBsnfn0mZjYKOy+WL31y6zNIxrxOPiGKjsQtnwUudrcEATTDC72xsiHaVlGCv8FXuM biu2JsE7ln2jHOP8ca15tQ2fOUB6ap3eEWgPsMOP1VAME1vDgwZ4QDkaj2QbJFj1PW 8sEkFEsJmelRjvGYA0SETCicU4kAi492LCdA5i2WoH5jkLXdyklKEFXSGkVWU/7JDb 7bGoqfOibgebZ4Y0gfWYGtehPlFBZt0ohiA5URPt6vII3IpyGpSJG71a6Ws47cPEn2 SgT4OAuQ+IxDg== 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 1/4] kbuild: create a list of all built DTB files Date: Tue, 9 Jan 2024 21:07:34 +0900 Message-Id: <20240109120738.346061-2-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: 1787614578376185718 X-GMAIL-MSGID: 1787614578376185718 It is useful to have a list of all *.dtb and *.dtbo files generated from the current build. With this commit, 'make dtbs' creates arch/*/boot/dts/dtbs-order, which lists the dtb(o) files created in the current build. It maintains the order of the dtb-y additions in Makefiles although the order is not important for DTBs. It is a (good) side effect through the reuse of the modules.order rule. Please note this list only includes the files directly added to dtb-y. For example, consider this case: foo-dtbs := foo_base.dtb foo_overlay.dtbo dtb-y := foo.dtb In this example, the list will include foo.dtb, but not foo_base.dtb or foo_overlay.dtbo. Signed-off-by: Masahiro Yamada --- .gitignore | 1 + Makefile | 4 ++-- scripts/Makefile.build | 20 ++++++++++++-------- scripts/Makefile.lib | 6 ++++++ 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 689a4fa3f547..c59dc60ba62e 100644 --- a/.gitignore +++ b/.gitignore @@ -52,6 +52,7 @@ *.xz *.zst Module.symvers +dtbs-list modules.order # diff --git a/Makefile b/Makefile index 6204a3803a90..db7f9e34a24e 100644 --- a/Makefile +++ b/Makefile @@ -1389,7 +1389,7 @@ ifneq ($(dtstree),) PHONY += dtbs dtbs_prepare dtbs_install dtbs_check dtbs: dtbs_prepare - $(Q)$(MAKE) $(build)=$(dtstree) + $(Q)$(MAKE) $(build)=$(dtstree) need-dtbslist=1 # include/config/kernel.release is actually needed when installing DTBs because # INSTALL_DTBS_PATH contains $(KERNELRELEASE). However, we do not want to make @@ -1927,7 +1927,7 @@ clean: $(clean-dirs) -o -name '*.ko.*' \ -o -name '*.dtb' -o -name '*.dtbo' \ -o -name '*.dtb.S' -o -name '*.dtbo.S' \ - -o -name '*.dt.yaml' \ + -o -name '*.dt.yaml' -o -name 'dtbs-list' \ -o -name '*.dwo' -o -name '*.lst' \ -o -name '*.su' -o -name '*.mod' \ -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 9a3063735e71..d23797dbca0f 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -71,6 +71,7 @@ endif # subdir-builtin and subdir-modorder may contain duplications. Use $(sort ...) subdir-builtin := $(sort $(filter %/built-in.a, $(real-obj-y))) subdir-modorder := $(sort $(filter %/modules.order, $(obj-m))) +subdir-dtbslist := $(sort $(filter %/dtbs-list, $(dtb-y))) targets-for-builtin := $(extra-y) @@ -387,6 +388,7 @@ $(obj)/%.asn1.c $(obj)/%.asn1.h: $(src)/%.asn1 $(objtree)/scripts/asn1_compiler # To build objects in subdirs, we need to descend into the directories $(subdir-builtin): $(obj)/%/built-in.a: $(obj)/% ; $(subdir-modorder): $(obj)/%/modules.order: $(obj)/% ; +$(subdir-dtbslist): $(obj)/%/dtbs-list: $(obj)/% ; # # Rule to compile a set of .o files into one .a file (without symbol table) @@ -403,19 +405,21 @@ $(obj)/built-in.a: $(real-obj-y) FORCE $(call if_changed,ar_builtin) # -# Rule to create modules.order file +# Rule to create modules.order and dtbs-list # -# Create commands to either record .ko file or cat modules.order from -# a subdirectory -# Add $(obj-m) as the prerequisite to avoid updating the timestamp of -# modules.order unless contained modules are updated. +# This is a list of build artifacts (module or dtb) from the current Makefile +# and its sub-directories. The timestamp should be updated when any of the +# member files. -cmd_modules_order = { $(foreach m, $(real-prereqs), \ - $(if $(filter %/modules.order, $m), cat $m, echo $m);) :; } \ +cmd_gen_order = { $(foreach m, $(real-prereqs), \ + $(if $(filter %/$(notdir $@), $m), cat $m, echo $m);) :; } \ > $@ $(obj)/modules.order: $(obj-m) FORCE - $(call if_changed,modules_order) + $(call if_changed,gen_order) + +$(obj)/dtbs-list: $(dtb-y) FORCE + $(call if_changed,gen_order) # # Rule to compile a set of .o files into one .a file (with symbol table) diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index cd5b181060f1..b35d39022a30 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -45,6 +45,11 @@ else obj-y := $(filter-out %/, $(obj-y)) endif +ifdef need-dtbslist +dtb-y += $(addsuffix /dtbs-list, $(subdir-ym)) +always-y += dtbs-list +endif + # Expand $(foo-objs) $(foo-y) etc. by replacing their individuals suffix-search = $(strip $(foreach s, $3, $($(1:%$(strip $2)=%$s)))) # List composite targets that are constructed by combining other targets @@ -99,6 +104,7 @@ lib-y := $(addprefix $(obj)/,$(lib-y)) real-obj-y := $(addprefix $(obj)/,$(real-obj-y)) real-obj-m := $(addprefix $(obj)/,$(real-obj-m)) multi-obj-m := $(addprefix $(obj)/, $(multi-obj-m)) +dtb-y := $(addprefix $(obj)/, $(dtb-y)) multi-dtb-y := $(addprefix $(obj)/, $(multi-dtb-y)) real-dtb-y := $(addprefix $(obj)/, $(real-dtb-y)) subdir-ym := $(addprefix $(obj)/,$(subdir-ym)) 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) From patchwork Tue Jan 9 12:07:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 186345 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp61427dyi; Tue, 9 Jan 2024 04:09:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IEsekfSyqe+GIAuRzhtixu7vb246shEOPcZEhu4cupN8UVIg8Iz85GihRpyeBl7tW1EDhFC X-Received: by 2002:a05:620a:2ad7:b0:781:428e:bc0 with SMTP id bn23-20020a05620a2ad700b00781428e0bc0mr5639658qkb.51.1704802143435; Tue, 09 Jan 2024 04:09:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704802143; cv=none; d=google.com; s=arc-20160816; b=gdnqIV8XSIGF+RdU/4UIgtHfEi1vOei2L6sAh8B+2JA0I8fcnbz60uG1Jn14OHul4Z Nq9gQicD6gyqj+pKxH8AmgkKregdvhzr6bQodb2obTXY/wEbl1P6yIDVkl/6ABIWVQz1 HePROR5r8LYFdFkx725zTIOwYqKU0soYOJUuN8/bSb/4ksYk5HeNA+18imKjXqz2Hbat lOAaQAJxNW2T+8+xdjMBBJDr7OXgOFzgAv8UfMKfyaHrm4NHwtW//wsikUkyDwfPG/sm dhh2vJdImj5TQccdm3z4ch3BITrNFtojSslBtxYm/iF2v5ICCQ25dnpVxXiatSP6P1Dn MR6g== 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=FfzJJYAdaNX23Nm8NJjjuM01qgJXHsj0llN9fgNqkhs=; fh=I/2MmNZ0xfeDyN6PIJexzYyObxcTEvIkeC0z7Z6DQ/c=; b=b/DwCrfg1Tbj3BS4nW0kpiTNR7csvVavNSqh7Q4isTLYgHzrGXBvy4LpuYEFqeA8aT Zy1V1ImChEWpnw09DW5BTH4wXW+CPsGmvgcHUN1ZtupI22OA+Bc6i27TDI9H9Oui+mSc 7T17feJSfRI+R5eTYAnnMqNYmgeawp/Kz8viZcmeTBpNVnLEWG2+uaVYpVcDHK7dQcw8 EU32rNUwa1D6rhvRw/zO2+MGALRTGcs21G7R8G9l4FlWFS9QPOV1Ft4w5LNXk2y8/4qS lSulXdZmi2YIbDhyQmkGnvM1v/SFSHsULUsSaSq4b92QQtIevpapxTWwlyRj8b0bUgAP 7DrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rzw3zg6J; spf=pass (google.com: domain of linux-kernel+bounces-20829-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20829-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id i10-20020a05620a404a00b0078332a8ac7fsi62272qko.725.2024.01.09.04.09.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 04:09:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-20829-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rzw3zg6J; spf=pass (google.com: domain of linux-kernel+bounces-20829-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20829-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 3C5111C23EAE for ; Tue, 9 Jan 2024 12:09:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3E82538FB9; Tue, 9 Jan 2024 12:07:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rzw3zg6J" 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 A0D9638DFC; Tue, 9 Jan 2024 12:07:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90B53C433C7; Tue, 9 Jan 2024 12:07:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704802073; bh=yYqdl2V/WrEu6szOfBy/qaZwIUQ0XEnoi+ITcWxYigI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rzw3zg6JH75t7XiuBwPmn0OJf24D9UAvjZC8JDmGcEL8BaHSamz0VfM5IXu3vo+A/ J+E9jdR5QV/nlNq+setc8BpW/3gYxYB8be0V9D1VTdkNa/8l+UQWYeEyAc9THl2CZr SGSo+zAQ/+2vs8mwCJHY+IhVvxUNPuiv9m8pzZA+d/YteiGqQCg8QAfg2x5v1PnRq7 IGquQr/f6QIxxHX/wtgkEl+c/ikLOen0zDaZWVWeffh2ngCF0jPrkb8+s1Sk08qkND 7h6EhuPww6H6f/1n+GvkwUV+vRhp4Wf7vUHdV4jHjjm4zJEg3ZqDjrZl9WVLVBxg4r Xl6Is/9SvBOfw== 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 3/4] kbuild: create a list of base and overlays for each DTB Date: Tue, 9 Jan 2024 21:07:36 +0900 Message-Id: <20240109120738.346061-4-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: 1787614612638549941 X-GMAIL-MSGID: 1787614612638549941 Some *.dtb files are assembled from a base DTB and overlays, but once they are built, there is no way to propagate such information to succeeding processes. This commit introduces the generation of *.dtlst files, listing the component *.dtb(o) files that construct the corresponding *.dtb. This is analogous to *.mod, which lists component objects for each module. Signed-off-by: Masahiro Yamada --- .gitignore | 1 + Makefile | 2 +- scripts/Makefile.build | 6 ++++++ scripts/Makefile.lib | 2 ++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index c59dc60ba62e..912cb713ad74 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ *.dtbo *.dtb.S *.dtbo.S +*.dtlst *.dwo *.elf *.gcno diff --git a/Makefile b/Makefile index dae6825b8082..3521bdad6db7 100644 --- a/Makefile +++ b/Makefile @@ -1927,7 +1927,7 @@ clean: $(clean-dirs) -o -name '*.ko.*' \ -o -name '*.dtb' -o -name '*.dtbo' \ -o -name '*.dtb.S' -o -name '*.dtbo.S' \ - -o -name '*.dt.yaml' -o -name 'dtbs-list' \ + -o -name '*.dt.yaml' -o -name '*.dtlst' -o -name 'dtbs-list' \ -o -name '*.dwo' -o -name '*.lst' \ -o -name '*.su' -o -name '*.mod' \ -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ diff --git a/scripts/Makefile.build b/scripts/Makefile.build index d23797dbca0f..e9fcf330ff39 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -252,6 +252,12 @@ cmd_mod = printf '%s\n' $(call real-search, $*.o, .o, -objs -y -m) | \ $(obj)/%.mod: FORCE $(call if_changed,mod) +cmd_dt_list = printf '%s\n' $(call real-search, $*.dtb, .dtb, -dtbs) | \ + $(AWK) '!x[$$0]++ { print("$(obj)/"$$0) }' > $@ + +$(obj)/%.dtlst: FORCE + $(call if_changed,dt_list) + quiet_cmd_cc_lst_c = MKLST $@ cmd_cc_lst_c = $(CC) $(c_flags) -g -c -o $*.o $< && \ $(CONFIG_SHELL) $(srctree)/scripts/makelst $*.o \ diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index b35d39022a30..0a492a4e4fbb 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -93,6 +93,8 @@ base-dtb-y := $(filter %.dtb, $(call real-search, $(multi-dtb-y), .dtb, -dtbs)) always-y += $(dtb-y) +always-y += $(patsubst %.dtb, %.dtlst, $(filter %.dtb, $(dtb-y))) + # Add subdir path ifneq ($(obj),.) From patchwork Tue Jan 9 12:07:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 186346 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp61552dyi; Tue, 9 Jan 2024 04:09:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IFag1z7Erw4BHsZLlfIv0MAb3XleXzntlfLhAiaU1Xb8hsqABinrWDBPxgkcEOiWKXRoYcy X-Received: by 2002:a17:906:2210:b0:a26:88f4:3fae with SMTP id s16-20020a170906221000b00a2688f43faemr485643ejs.67.1704802157798; Tue, 09 Jan 2024 04:09:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704802157; cv=none; d=google.com; s=arc-20160816; b=vngm576V9YGjVjOR24k/Q4hEQghsbwtLxYlTj5WmLpHbey7asynnEFieStUuWa0EVM qktt1Xi229GbyJ6QmghIcIfNHeo6PJ5LjOOi2UlTWe81d9ArgcWhld87Vfav+iSByUBh nczOwsn5J4zm57wcEG3kAFDCjt2nefj2qpr14oyrR5rWIcMEtpUORFxwGUgLQ10IGYv9 U3wM5VwoFu1syhNF/AtEHM7V1BBS3UlDvq70PO5N+9iFzcu5aO5Ac6oUmBfd92V9vixr hPJRyZnCDCxgSrKfMjPgFYi6LVXZoC101o10I6rzDq9ehS5+Ot0GVqMhUpdoLJh0n63U v+eg== 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=jrLMKyPdWzAIC82IXhX2YBCqjy1u/aoe1zR03QnkLBY=; fh=aN2kD2oByOQCLFiYXd7TyKLQSQPEZSL4i6gciY+4Zlg=; b=EZiS8mCm/BUgXyKFd5TdK/pceRRtNYN7/f8sXRwSGDp6hKn+LysZemoWJc4bH1YPuA sVjYQpCngCJyTJKYj0rBdlnbtxhjhYww8SMGtlJtHd/KdRHVtjMAHLAwpolxvDS+TOzR u9W5xv2ZV+uC3lsez4MiSQ5p14z39weTrIbF6O0ewXsA8U5JKwnCCoR5DRN4HIZ5hoP+ J+Btu+jg4cLBsKw/Np6mQE70dEw2Z18q5oCPHkvmpd8On+HAZY6AkcyiY6eZWVlzREc3 MpTMGkpEo034Ke7SwyXWqr/kTrDkOQizr3bx8kmInD1AIqZkEL7sJCTb6FOGMXcxFZSp 8Tfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="DbvvzB/W"; spf=pass (google.com: domain of linux-kernel+bounces-20830-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20830-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 s21-20020a170906169500b00a27dcb8c6casi753111ejd.878.2024.01.09.04.09.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 04:09:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-20830-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="DbvvzB/W"; spf=pass (google.com: domain of linux-kernel+bounces-20830-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20830-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 69F641F2595D for ; Tue, 9 Jan 2024 12:09:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 55D3F39859; Tue, 9 Jan 2024 12:07:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DbvvzB/W" 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 B472038FA6; Tue, 9 Jan 2024 12:07:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F25DC43394; Tue, 9 Jan 2024 12:07:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704802075; bh=MZbzN22IX64OiGkpAjMsQ5NKuAEc1kV5o4lDIUMEQFM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DbvvzB/WipWO1m+9QDyIUGPgsBhQaQ1OsuX1m2GRu7ZM0lKndEJKtlkRqgMAUWXzt TJzYLXMvrCV/MlTEnRvN7LZgbirbseq2QPuZLdVdI8QaxYiZMlL32KYZMT9+RA8dwC y3DBkqM7g21tzJd9wKKt6XYksspHLVzZm7FFPAh8jsLAMwGr6i+MHyT0Il4TI1ILj4 1S3xvWz50/z0zMl40PZYZoneUu81Zld07pTddyhS3fNtMw4y3DNm5m3nzVSkPac0VD xpwpPWUH05jChaK+RHn8VVB6JQiVF2gA44R5RhtsAm560gWml85FxDyhjngRMC//nF mrABK+fq+yCaw== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: devicetree@vger.kernel.org, Rob Herring , Simon Glass , Masahiro Yamada , Jonathan Corbet , Nathan Chancellor , Nick Desaulniers , Nicolas Schier , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] kbuild: allow 'make dtbs_install' to install primitive DTBs Date: Tue, 9 Jan 2024 21:07:37 +0900 Message-Id: <20240109120738.346061-5-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: 1787614627286348181 X-GMAIL-MSGID: 1787614627286348181 Commit 15d16d6dadf6 ("kbuild: Add generic rule to apply fdtoverlay") introduced the -dtbs syntax to apply overlays during the build process. However, scripts/Makefile.dtbinst is not aware of the -dtbs syntax, so 'make dtbs_install' installs the files directly added to dtb-y. (Presumably, it was intentional.) For example, consider this case: foo1-dtbs := foo_base.dtb foo_overlay1.dtbo foo2-dtbs := foo_base.dtb foo_overlay2.dtbo dtb-y := foo1.dtb foo2.dtb 'make dtbs_install' only installs foo1.dtb and foo2.dtb. It is suitable when the boot image supports a single hardware configuration, or when the boot loader in use does not support applying overlays. However, when creating a boot image with multiple board supports, it wastes storage space, as foo1.dtb and foo2.dtb have foo_base.dtb in common. From a space perspective, a more optimal solution is to install foo_base.dtb, foo_overlay1.dtbo, and foo_overlay2.dtbo, then assemble the final dtb (either foo1.dtb or foo2.dtb) on the boot loader. This commit adds a new flag, INSTALL_DTBS_PRIMITIVE. With INSTALL_DTBS_PRIMITIVE=1, 'make dtbs_install' will install primitive files (such as foo_base.dtb, foo_overlay1.dtbo, and foo_overlay2.dtbo in this case). Without INSTALL_DTBS_PRIMITIVE, the current behavior is maintained (foo1.dtb and foo2.dtb will be installed in this case). Signed-off-by: Masahiro Yamada --- Documentation/kbuild/kbuild.rst | 6 ++++++ scripts/Makefile.dtbinst | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Documentation/kbuild/kbuild.rst b/Documentation/kbuild/kbuild.rst index 9c8d1d046ea5..d803ca5afc07 100644 --- a/Documentation/kbuild/kbuild.rst +++ b/Documentation/kbuild/kbuild.rst @@ -249,6 +249,12 @@ INSTALL_DTBS_PATH specifies where to install device tree blobs for relocations required by build roots. This is not defined in the makefile but the argument can be passed to make if needed. +INSTALL_DTBS_PRIMITIVE +---------------------- +INSTALL_DTBS_PRIMITIVE, if defined, will cause the dtbs_install target to +install the base dtb and overlay dtbo files instead of assembled dtb files +constructed by overlay application. + KBUILD_ABS_SRCTREE -------------------------------------------------- Kbuild uses a relative path to point to the tree when possible. For instance, diff --git a/scripts/Makefile.dtbinst b/scripts/Makefile.dtbinst index 67956f6496a5..14111a86987a 100644 --- a/scripts/Makefile.dtbinst +++ b/scripts/Makefile.dtbinst @@ -22,7 +22,13 @@ quiet_cmd_dtb_install = INSTALL $@ $(dst)/%: $(obj)/% $(call cmd,dtb_install) -dtbs := $(patsubst $(obj)/%,%,$(call read-file, $(obj)/dtbs-list)) +dtbs := $(call read-file, $(obj)/dtbs-list) + +ifdef INSTALL_DTBS_PRIMITIVE +dtbs := $(foreach f, $(dtbs), $(if $(filter %.dtb,$(f)),$(call read-file, $(patsubst %.dtb,%.dtlst,$(f))),$(f))) +endif + +dtbs := $(patsubst $(obj)/%,%,$(dtbs)) ifdef CONFIG_ARCH_WANT_FLAT_DTB_INSTALL