From: Elliot Berman <eberman@codeaurora.org>
To: Masahiro Yamada <masahiroy@kernel.org>,
Michal Marek <michal.lkml@markovi.net>
Cc: Elliot Berman <eberman@codeaurora.org>,
linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
Matthias Maennich <maennich@google.com>,
Trilok Soni <tsoni@codeaurora.org>
Subject: [PATCH] Kbuild: Update config_data.gz only if KCONFIG_CONFIG materially changed
Date: Thu, 1 Apr 2021 15:44:32 -0700 [thread overview]
Message-ID: <1617317072-26770-1-git-send-email-eberman@codeaurora.org> (raw)
If you update the timestamp of KCONFIG_CONFIG without actually changing
anything, config_data.gz is re-generated and causes vmlinux to re-link.
When Link Time Optimization is enabled, unnecessary re-linking of
vmlinux is highly desirable since it adds several minutes to build time.
Avoid touching config_data.gz by using filechk to compare the existing
config_data.gz and update only if it changed.
The .config can be touched, for instance, by a build script which
installs the default defconfig and then applies a defconfig fragment on
top.
For a simple example on my x86 machine, I modified x86 default defconfig to set
CONFIG_IKCONFIG=y and run:
make -j50 defconfig tiny.config vmlinux
make -j50 defconfig tiny.config vmlinux
With this patch, vmlinux is not re-built as a result of config_data.gz
change.
Signed-off-by: Elliot Berman <eberman@codeaurora.org>
---
kernel/Makefile | 2 +-
scripts/Makefile.lib | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/kernel/Makefile b/kernel/Makefile
index 320f1f3..bd4e558 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -140,7 +140,7 @@ $(obj)/configs.o: $(obj)/config_data.gz
targets += config_data.gz
$(obj)/config_data.gz: $(KCONFIG_CONFIG) FORCE
- $(call if_changed,gzip)
+ $(call filechk,gzip)
$(obj)/kheaders.o: $(obj)/kheaders_data.tar.xz
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index a4fbaf8..81d3ec1 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -282,6 +282,8 @@ cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@
quiet_cmd_gzip = GZIP $@
cmd_gzip = cat $(real-prereqs) | $(KGZIP) -n -f -9 > $@
+filechk_gzip = cat $(real-prereqs) | $(KGZIP) -n -f -9
+
# DTC
# ---------------------------------------------------------------------------
DTC ?= $(objtree)/scripts/dtc/dtc
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
next reply other threads:[~2021-04-01 22:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-01 22:44 Elliot Berman [this message]
2021-04-03 5:11 ` [PATCH] Kbuild: Update config_data.gz only if KCONFIG_CONFIG materially changed Masahiro Yamada
2021-04-05 4:23 ` Elliot Berman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1617317072-26770-1-git-send-email-eberman@codeaurora.org \
--to=eberman@codeaurora.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maennich@google.com \
--cc=masahiroy@kernel.org \
--cc=michal.lkml@markovi.net \
--cc=tsoni@codeaurora.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox