From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: linux-kbuild@vger.kernel.org
Cc: Dirk Gouders <dirk@gouders.net>,
Ulf Magnusson <ulfalizer@gmail.com>,
Sam Ravnborg <sam@ravnborg.org>,
Masahiro Yamada <yamada.masahiro@socionext.com>,
Michal Marek <michal.lkml@markovi.net>,
linux-kernel@vger.kernel.org
Subject: [PATCH v4 09/11] kbuild: do not update config when running install targets
Date: Fri, 20 Jul 2018 16:46:34 +0900 [thread overview]
Message-ID: <1532072796-7947-10-git-send-email-yamada.masahiro@socionext.com> (raw)
In-Reply-To: <1532072796-7947-1-git-send-email-yamada.masahiro@socionext.com>
"make syncconfig" is automatically invoked when any of the following
happens:
- .config is updated
- any of Kconfig files is updated
- any of environment variables referenced in Kconfig is changed
Then, it updates configuration files such as include/config/auto.conf
include/generated/autoconf.h, etc.
Even install targets (install, modules_install, etc.) are no exception.
However, they should never ever modify the source tree. Install
targets are often run with root privileges. Once those configuration
files are owned by root, "make mrproper" would end up with permission
error.
Install targets should just copy things blindly. They should not care
whether the configuration is up-to-date or not. This makes more sense
because we are interested in the configuration that was used in the
previous kernel building.
This issue has existed since before, but rarely happened. I expect
more chance where people are hit by this; with the new Kconfig syntax
extension, the .config now contains the compiler information. If you
cross-compile the kernel with CROSS_COMPILE, but forget to pass it
for "make install", you meet "any of environment variables referenced
in Kconfig is changed" because $(CC) is referenced in Kconfig.
Another scenario is the compiler upgrade before the installation.
Install targets need the configuration. "make modules_install" refer
to CONFIG_MODULES etc. "make dtbs_install" also needs CONFIG_ARCH_*
to decide which dtb files to install. However, the auto-update of
the configuration files should be avoided. We already do this for
external modules.
Now, Make targets are categorized into 3 groups:
[1] Do not need the kernel configuration at all
help, coccicheck, headers_install etc.
[2] Need the latest kernel configuration
If new config options are added, Kconfig will show prompt to
ask user's selection.
Build targets such as vmlinux, in-kernel modules are the cases.
[3] Need the kernel configuration, but do not want to update it
Install targets except headers_install, and external modules
are the cases.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---
Changes in v4: None
Makefile | 27 ++++++++++++++++++++-------
1 file changed, 20 insertions(+), 7 deletions(-)
diff --git a/Makefile b/Makefile
index 2fa9830..ad83917 100644
--- a/Makefile
+++ b/Makefile
@@ -225,10 +225,12 @@ no-dot-config-targets := $(clean-targets) \
cscope gtags TAGS tags help% %docs check% coccicheck \
$(version_h) headers_% archheaders archscripts \
kernelversion %src-pkg
+no-sync-config-targets := $(no-dot-config-targets) install %install
-config-targets := 0
-mixed-targets := 0
-dot-config := 1
+config-targets := 0
+mixed-targets := 0
+dot-config := 1
+may-sync-config := 1
ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)
@@ -236,6 +238,16 @@ ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
endif
endif
+ifneq ($(filter $(no-sync-config-targets), $(MAKECMDGOALS)),)
+ ifeq ($(filter-out $(no-sync-config-targets), $(MAKECMDGOALS)),)
+ may-sync-config := 0
+ endif
+endif
+
+ifneq ($(KBUILD_EXTMOD),)
+ may-sync-config := 0
+endif
+
ifeq ($(KBUILD_EXTMOD),)
ifneq ($(filter config %config,$(MAKECMDGOALS)),)
config-targets := 1
@@ -607,7 +619,7 @@ ARCH_CFLAGS :=
include arch/$(SRCARCH)/Makefile
ifeq ($(dot-config),1)
-ifeq ($(KBUILD_EXTMOD),)
+ifeq ($(may-sync-config),1)
# Read in dependencies to all Kconfig* files, make sure to run syncconfig if
# changes are detected. This should be included after arch/$(SRCARCH)/Makefile
# because some architectures define CROSS_COMPILE there.
@@ -622,8 +634,9 @@ $(KCONFIG_CONFIG) include/config/auto.conf.cmd: ;
include/config/%.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd
$(Q)$(MAKE) -f $(srctree)/Makefile syncconfig
else
-# external modules needs include/generated/autoconf.h and include/config/auto.conf
-# but do not care if they are up-to-date. Use auto.conf to trigger the test
+# External modules and some install targets need include/generated/autoconf.h
+# and include/config/auto.conf but do not care if they are up-to-date.
+# Use auto.conf to trigger the test
PHONY += include/config/auto.conf
include/config/auto.conf:
@@ -635,7 +648,7 @@ include/config/auto.conf:
echo >&2 ; \
/bin/false)
-endif # KBUILD_EXTMOD
+endif # may-sync-config
else
# Dummy target needed, because used as prerequisite
--
2.7.4
next prev parent reply other threads:[~2018-07-20 7:48 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-20 7:46 [PATCH v4 00/11] kbuild/kconfig: do not update config during installation Masahiro Yamada
2018-07-20 7:46 ` [PATCH v4 01/11] kconfig: rename file_write_dep and move it to confdata.c Masahiro Yamada
2018-07-20 7:46 ` [PATCH v4 02/11] kconfig: split out useful helpers in confdata.c Masahiro Yamada
2018-07-20 7:46 ` [PATCH v4 03/11] kconfig: remove unneeded directory generation from local*config Masahiro Yamada
2018-07-20 7:46 ` [PATCH v4 04/11] kconfig: create directories needed for syncconfig by itself Masahiro Yamada
2018-07-20 7:46 ` [PATCH v4 05/11] kconfig: make syncconfig update .config regardless of sym_change_count Masahiro Yamada
2018-07-20 7:46 ` [PATCH v4 06/11] kconfig: allow all config targets to write auto.conf if missing Masahiro Yamada
2018-07-20 7:46 ` [PATCH v4 07/11] kbuild: use 'include' directive to load auto.conf from top Makefile Masahiro Yamada
2018-09-03 9:39 ` Borislav Petkov
2018-09-03 9:54 ` Masahiro Yamada
2018-09-03 10:00 ` Borislav Petkov
2018-09-05 22:53 ` Segher Boessenkool
2018-09-06 0:46 ` Masahiro Yamada
2018-07-20 7:46 ` [PATCH v4 08/11] kbuild: add .DELETE_ON_ERROR special target Masahiro Yamada
2018-07-20 7:46 ` Masahiro Yamada [this message]
2018-07-20 7:46 ` [PATCH v4 10/11] kbuild: do not update config for 'make kernelrelease' Masahiro Yamada
2018-07-20 7:46 ` [PATCH v4 11/11] kbuild: remove auto.conf from prerequisite of phony targets Masahiro Yamada
2018-07-25 14:40 ` [PATCH v4 00/11] kbuild/kconfig: do not update config during installation 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=1532072796-7947-10-git-send-email-yamada.masahiro@socionext.com \
--to=yamada.masahiro@socionext.com \
--cc=dirk@gouders.net \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.lkml@markovi.net \
--cc=sam@ravnborg.org \
--cc=ulfalizer@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).