All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masahiro Yamada <masahiroy@kernel.org>
To: linux-kbuild@vger.kernel.org
Cc: Masahiro Yamada <masahiroy@kernel.org>,
	Elliot Berman <eberman@codeaurora.org>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 5/5] kbuild: update config_data.gz only when the content of .config is changed
Date: Sun, 25 Apr 2021 15:24:07 +0900	[thread overview]
Message-ID: <20210425062407.1183801-5-masahiroy@kernel.org> (raw)
In-Reply-To: <20210425062407.1183801-1-masahiroy@kernel.org>

If the timestamp of the .config file is updated, config_data.gz is
regenerated, then vmlinux is re-linked. This occurs even if the content
of the .config has actually not changed.

This issue was mitigated by commit 67424f61f813 ("kconfig: do not write
.config if the content is the same"); Kconfig does not update the
.config when it ends up with the identical configuration.

The issue is remaining when the .config is created by *_defconfig with
some config fragment(s) applied on top.

This is typical for powerpc and mips, where several *_defconfig targets
are constructed by (ab)using merge_config.sh.

One workaround is to have the copy of the .config. The filechk rule
updates the copy, kernel/config_data, by checking the content instead
of the timestamp.

With this commit, the second run with the same configuration avoids
the needless rebuilds.

  $ make ARCH=mips defconfig all
   [ snip ]
  $ make ARCH=mips defconfig all
  *** Default configuration is based on target '32r2el_defconfig'
  Using ./arch/mips/configs/generic_defconfig as base
  Merging arch/mips/configs/generic/32r2.config
  Merging arch/mips/configs/generic/el.config
  Merging ./arch/mips/configs/generic/board-boston.config
  Merging ./arch/mips/configs/generic/board-ni169445.config
  Merging ./arch/mips/configs/generic/board-ocelot.config
  Merging ./arch/mips/configs/generic/board-ranchu.config
  Merging ./arch/mips/configs/generic/board-sead-3.config
  Merging ./arch/mips/configs/generic/board-xilfpga.config
  #
  # configuration written to .config
  #
    SYNC    include/config/auto.conf
    CALL    scripts/checksyscalls.sh
    CALL    scripts/atomic/check-atomics.sh
    CHK     include/generated/compile.h
    CHK     include/generated/autoksyms.h

Reported-by: Elliot Berman <eberman@codeaurora.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 kernel/.gitignore | 1 +
 kernel/Makefile   | 9 +++++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/kernel/.gitignore b/kernel/.gitignore
index 4dc1ffe9770b..c6b299a6b786 100644
--- a/kernel/.gitignore
+++ b/kernel/.gitignore
@@ -1,2 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0-only
+/config_data
 /kheaders.md5
diff --git a/kernel/Makefile b/kernel/Makefile
index 320f1f3941b7..605ec3e70cb7 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -138,10 +138,15 @@ obj-$(CONFIG_SCF_TORTURE_TEST) += scftorture.o
 
 $(obj)/configs.o: $(obj)/config_data.gz
 
-targets += config_data.gz
-$(obj)/config_data.gz: $(KCONFIG_CONFIG) FORCE
+targets += config_data config_data.gz
+$(obj)/config_data.gz: $(obj)/config_data FORCE
 	$(call if_changed,gzip)
 
+filechk_cat = cat $<
+
+$(obj)/config_data: $(KCONFIG_CONFIG) FORCE
+	$(call filechk,cat)
+
 $(obj)/kheaders.o: $(obj)/kheaders_data.tar.xz
 
 quiet_cmd_genikh = CHK     $(obj)/kheaders_data.tar.xz
-- 
2.27.0


  parent reply	other threads:[~2021-04-25  6:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-25  6:24 [PATCH 1/5] kernel/.gitgnore: remove stale timeconst.h and hz.bc Masahiro Yamada
2021-04-25  6:24 ` [PATCH 2/5] .gitignore: move tags and TAGS close to other tag files Masahiro Yamada
2021-04-25  6:24 ` [PATCH 3/5] .gitignore: ignore only top-level modules.builtin Masahiro Yamada
2021-04-25  6:24 ` [PATCH 4/5] .gitignore: prefix local generated files with a slash Masahiro Yamada
2021-04-26 10:50   ` Miguel Ojeda
2021-04-26 15:33   ` Rob Herring
2021-04-26 18:55   ` Paraschiv, Andra-Irina
2021-04-25  6:24 ` Masahiro Yamada [this message]
2021-05-05 17:48 ` [PATCH 1/5] kernel/.gitgnore: remove stale timeconst.h and hz.bc Masahiro Yamada

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=20210425062407.1183801-5-masahiroy@kernel.org \
    --to=masahiroy@kernel.org \
    --cc=eberman@codeaurora.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.