Skip to content

Commit 01f0e5c

Browse files
committed
Merge tag 'kconfig-v4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
Pull Kconfig updates from Masahiro Yamada: - show clearer error messages where pkg-config is needed, but not installed - rename SYMBOL_AUTO to SYMBOL_NO_WRITE to reflect its semantics - create all necessary directories by Kconfig tool itself instead of Makefile - update the .config unconditionally when syncconfig is invoked - use 'include' directive instead of '-include' where include/config/{auto,tristate}.conf is mandatory - do not try to update the .config when running install targets - add .DELETE_ON_ERROR to delete partially updated files - misc cleanups and fixes * tag 'kconfig-v4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: kconfig: remove P_ENV property type kconfig: remove unused sym_get_env_prop() function kconfig: fix the rule of mainmenu_stmt symbol init/Kconfig: Use short unix-style option instead of --longname Kbuild: Makefile.modbuiltin: include auto.conf and tristate.conf mandatory kbuild: remove auto.conf from prerequisite of phony targets kbuild: do not update config for 'make kernelrelease' kbuild: do not update config when running install targets kbuild: add .DELETE_ON_ERROR special target kbuild: use 'include' directive to load auto.conf from top Makefile kconfig: allow all config targets to write auto.conf if missing kconfig: make syncconfig update .config regardless of sym_change_count kconfig: create directories needed for syncconfig by itself kconfig: remove unneeded directory generation from local*config kconfig: split out useful helpers in confdata.c kconfig: rename file_write_dep and move it to confdata.c kconfig: fix typos in description of "choice" in kconfig-language.txt kconfig: handle format string before calling conf_message_callback() kconfig: rename SYMBOL_AUTO to SYMBOL_NO_WRITE kconfig: check for pkg-config on make {menu,n,g,x}config
2 parents e026bcc + 1880861 commit 01f0e5c

21 files changed

Lines changed: 227 additions & 146 deletions

‎Documentation/kbuild/kconfig-language.txt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ choices:
370370

371371
This defines a choice group and accepts any of the above attributes as
372372
options. A choice can only be of type bool or tristate. If no type is
373-
specified for a choice, it's type will be determined by the type of
373+
specified for a choice, its type will be determined by the type of
374374
the first choice element in the group or remain unknown if none of the
375375
choice elements have a type specified, as well.
376376

@@ -384,7 +384,7 @@ A choice accepts another option "optional", which allows to set the
384384
choice to 'n' and no entry needs to be selected.
385385
If no [symbol] is associated with a choice, then you can not have multiple
386386
definitions of that choice. If a [symbol] is associated to the choice,
387-
then you may define the same choice (ie. with the same entries) in another
387+
then you may define the same choice (i.e. with the same entries) in another
388388
place.
389389

390390
comment:

‎Documentation/process/changes.rst‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@ The build system has, as of 4.13, switched to using thin archives (`ar T`)
8181
rather than incremental linking (`ld -r`) for built-in.a intermediate steps.
8282
This requires binutils 2.20 or newer.
8383

84+
pkg-config
85+
----------
86+
87+
The build system, as of 4.18, requires pkg-config to check for installed
88+
kconfig tools and to determine flags settings for use in
89+
'make {menu,n,g,x}config'. Previously pkg-config was being used but not
90+
verified or documented.
91+
8492
Flex
8593
----
8694

‎Makefile‎

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -225,17 +225,30 @@ no-dot-config-targets := $(clean-targets) \
225225
cscope gtags TAGS tags help% %docs check% coccicheck \
226226
$(version_h) headers_% archheaders archscripts \
227227
%asm-generic kernelversion %src-pkg
228+
no-sync-config-targets := $(no-dot-config-targets) install %install \
229+
kernelrelease
228230

229-
config-targets := 0
230-
mixed-targets := 0
231-
dot-config := 1
231+
config-targets := 0
232+
mixed-targets := 0
233+
dot-config := 1
234+
may-sync-config := 1
232235

233236
ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
234237
ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)
235238
dot-config := 0
236239
endif
237240
endif
238241

242+
ifneq ($(filter $(no-sync-config-targets), $(MAKECMDGOALS)),)
243+
ifeq ($(filter-out $(no-sync-config-targets), $(MAKECMDGOALS)),)
244+
may-sync-config := 0
245+
endif
246+
endif
247+
248+
ifneq ($(KBUILD_EXTMOD),)
249+
may-sync-config := 0
250+
endif
251+
239252
ifeq ($(KBUILD_EXTMOD),)
240253
ifneq ($(filter config %config,$(MAKECMDGOALS)),)
241254
config-targets := 1
@@ -585,7 +598,7 @@ virt-y := virt/
585598
endif # KBUILD_EXTMOD
586599

587600
ifeq ($(dot-config),1)
588-
-include include/config/auto.conf
601+
include include/config/auto.conf
589602
endif
590603

591604
# The all: target is the default when no target is given on the
@@ -607,7 +620,7 @@ ARCH_CFLAGS :=
607620
include arch/$(SRCARCH)/Makefile
608621

609622
ifeq ($(dot-config),1)
610-
ifeq ($(KBUILD_EXTMOD),)
623+
ifeq ($(may-sync-config),1)
611624
# Read in dependencies to all Kconfig* files, make sure to run syncconfig if
612625
# changes are detected. This should be included after arch/$(SRCARCH)/Makefile
613626
# because some architectures define CROSS_COMPILE there.
@@ -622,8 +635,9 @@ $(KCONFIG_CONFIG) include/config/auto.conf.cmd: ;
622635
include/config/%.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd
623636
$(Q)$(MAKE) -f $(srctree)/Makefile syncconfig
624637
else
625-
# external modules needs include/generated/autoconf.h and include/config/auto.conf
626-
# but do not care if they are up-to-date. Use auto.conf to trigger the test
638+
# External modules and some install targets need include/generated/autoconf.h
639+
# and include/config/auto.conf but do not care if they are up-to-date.
640+
# Use auto.conf to trigger the test
627641
PHONY += include/config/auto.conf
628642

629643
include/config/auto.conf:
@@ -635,11 +649,7 @@ include/config/auto.conf:
635649
echo >&2 ; \
636650
/bin/false)
637651

638-
endif # KBUILD_EXTMOD
639-
640-
else
641-
# Dummy target needed, because used as prerequisite
642-
include/config/auto.conf: ;
652+
endif # may-sync-config
643653
endif # $(dot-config)
644654

645655
KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,)
@@ -1035,15 +1045,14 @@ define filechk_kernel.release
10351045
endef
10361046

10371047
# Store (new) KERNELRELEASE string in include/config/kernel.release
1038-
include/config/kernel.release: include/config/auto.conf FORCE
1048+
include/config/kernel.release: $(srctree)/Makefile FORCE
10391049
$(call filechk,kernel.release)
10401050

10411051
# Additional helpers built in scripts/
10421052
# Carefully list dependencies so we do not try to build scripts twice
10431053
# in parallel
10441054
PHONY += scripts
1045-
scripts: scripts_basic include/config/auto.conf include/config/tristate.conf \
1046-
asm-generic gcc-plugins $(autoksyms_h)
1055+
scripts: scripts_basic asm-generic gcc-plugins $(autoksyms_h)
10471056
$(Q)$(MAKE) $(build)=$(@)
10481057

10491058
# Things we need to do before we recursively start building the kernel
@@ -1073,8 +1082,7 @@ endif
10731082
# that need to depend on updated CONFIG_* values can be checked here.
10741083
prepare2: prepare3 outputmakefile asm-generic
10751084

1076-
prepare1: prepare2 $(version_h) $(autoksyms_h) include/generated/utsrelease.h \
1077-
include/config/auto.conf
1085+
prepare1: prepare2 $(version_h) $(autoksyms_h) include/generated/utsrelease.h
10781086
$(cmd_crmodverdir)
10791087

10801088
archprepare: archheaders archscripts prepare1 scripts_basic
@@ -1212,7 +1220,7 @@ modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin
12121220
modules.builtin: $(vmlinux-dirs:%=%/modules.builtin)
12131221
$(Q)$(AWK) '!x[$$0]++' $^ > $(objtree)/modules.builtin
12141222

1215-
%/modules.builtin: include/config/auto.conf
1223+
%/modules.builtin: include/config/auto.conf include/config/tristate.conf
12161224
$(Q)$(MAKE) $(modbuiltin)=$*
12171225

12181226

‎init/Kconfig‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ config DEFCONFIG_LIST
22
string
33
depends on !UML
44
option defconfig_list
5-
default "/lib/modules/$(shell,uname --release)/.config"
5+
default "/lib/modules/$(shell,uname -r)/.config"
66
default "/etc/kernel-config"
7-
default "/boot/config-$(shell,uname --release)"
7+
default "/boot/config-$(shell,uname -r)"
88
default ARCH_DEFCONFIG
99
default "arch/$(ARCH)/defconfig"
1010

‎scripts/Kbuild.include‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,3 +400,6 @@ endif
400400
endef
401401
#
402402
###############################################################################
403+
404+
# delete partially updated (i.e. corrupted) files on error
405+
.DELETE_ON_ERROR:

‎scripts/Makefile.modbuiltin‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ src := $(obj)
88
PHONY := __modbuiltin
99
__modbuiltin:
1010

11-
-include include/config/auto.conf
11+
include include/config/auto.conf
1212
# tristate.conf sets tristate variables to uppercase 'Y' or 'M'
1313
# That way, we get the list of built-in modules in obj-Y
14-
-include include/config/tristate.conf
14+
include include/config/tristate.conf
1515

1616
include scripts/Kbuild.include
1717

‎scripts/kconfig/Makefile‎

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
# Kernel configuration targets
44
# These targets are used from top-level makefile
55

6-
PHONY += xconfig gconfig menuconfig config syncconfig \
7-
localmodconfig localyesconfig
6+
PHONY += xconfig gconfig menuconfig config localmodconfig localyesconfig
87

98
ifdef KBUILD_KCONFIG
109
Kconfig := $(KBUILD_KCONFIG)
@@ -34,14 +33,7 @@ config: $(obj)/conf
3433
nconfig: $(obj)/nconf
3534
$< $(silent) $(Kconfig)
3635

37-
# This has become an internal implementation detail and is now deprecated
38-
# for external use.
39-
syncconfig: $(obj)/conf
40-
$(Q)mkdir -p include/config include/generated
41-
$< $(silent) --$@ $(Kconfig)
42-
4336
localyesconfig localmodconfig: $(obj)/conf
44-
$(Q)mkdir -p include/config include/generated
4537
$(Q)perl $(srctree)/$(src)/streamline_config.pl --$@ $(srctree) $(Kconfig) > .tmp.config
4638
$(Q)if [ -f .config ]; then \
4739
cmp -s .tmp.config .config || \
@@ -56,8 +48,12 @@ localyesconfig localmodconfig: $(obj)/conf
5648
$(Q)rm -f .tmp.config
5749

5850
# These targets map 1:1 to the commandline options of 'conf'
51+
#
52+
# Note:
53+
# syncconfig has become an internal implementation detail and is now
54+
# deprecated for external use
5955
simple-targets := oldconfig allnoconfig allyesconfig allmodconfig \
60-
alldefconfig randconfig listnewconfig olddefconfig
56+
alldefconfig randconfig listnewconfig olddefconfig syncconfig
6157
PHONY += $(simple-targets)
6258

6359
$(simple-targets): $(obj)/conf
@@ -215,6 +211,7 @@ $(obj)/zconf.tab.o: $(obj)/zconf.lex.c
215211

216212
# check if necessary packages are available, and configure build flags
217213
define filechk_conf_cfg
214+
$(CONFIG_SHELL) $(srctree)/scripts/kconfig/check-pkgconfig.sh; \
218215
$(CONFIG_SHELL) $<
219216
endef
220217

‎scripts/kconfig/check-pkgconfig.sh‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
# SPDX-License-Identifier: GPL-2.0
3+
# Check for pkg-config presence
4+
5+
if [ -z $(command -v pkg-config) ]; then
6+
echo "'make *config' requires 'pkg-config'. Please install it." 1>&2
7+
exit 1
8+
fi

‎scripts/kconfig/conf.c‎

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,7 @@ int main(int ac, char **av)
496496
int opt;
497497
const char *name, *defconfig_file = NULL /* gcc uninit */;
498498
struct stat tmpstat;
499+
int no_conf_write = 0;
499500

500501
tty_stdio = isatty(0) && isatty(1);
501502

@@ -633,13 +634,14 @@ int main(int ac, char **av)
633634
}
634635

635636
if (sync_kconfig) {
636-
if (conf_get_changed()) {
637-
name = getenv("KCONFIG_NOSILENTUPDATE");
638-
if (name && *name) {
637+
name = getenv("KCONFIG_NOSILENTUPDATE");
638+
if (name && *name) {
639+
if (conf_get_changed()) {
639640
fprintf(stderr,
640641
"\n*** The configuration requires explicit update.\n\n");
641642
return 1;
642643
}
644+
no_conf_write = 1;
643645
}
644646
}
645647

@@ -684,29 +686,32 @@ int main(int ac, char **av)
684686
break;
685687
}
686688

687-
if (sync_kconfig) {
688-
/* syncconfig is used during the build so we shall update autoconf.
689-
* All other commands are only used to generate a config.
690-
*/
691-
if (conf_get_changed() && conf_write(NULL)) {
692-
fprintf(stderr, "\n*** Error during writing of the configuration.\n\n");
693-
exit(1);
694-
}
695-
if (conf_write_autoconf()) {
696-
fprintf(stderr, "\n*** Error during update of the configuration.\n\n");
697-
return 1;
698-
}
699-
} else if (input_mode == savedefconfig) {
689+
if (input_mode == savedefconfig) {
700690
if (conf_write_defconfig(defconfig_file)) {
701691
fprintf(stderr, "n*** Error while saving defconfig to: %s\n\n",
702692
defconfig_file);
703693
return 1;
704694
}
705695
} else if (input_mode != listnewconfig) {
706-
if (conf_write(NULL)) {
696+
if (!no_conf_write && conf_write(NULL)) {
707697
fprintf(stderr, "\n*** Error during writing of the configuration.\n\n");
708698
exit(1);
709699
}
700+
701+
/*
702+
* Create auto.conf if it does not exist.
703+
* This prevents GNU Make 4.1 or older from emitting
704+
* "include/config/auto.conf: No such file or directory"
705+
* in the top-level Makefile
706+
*
707+
* syncconfig always creates or updates auto.conf because it is
708+
* used during the build.
709+
*/
710+
if (conf_write_autoconf(sync_kconfig) && sync_kconfig) {
711+
fprintf(stderr,
712+
"\n*** Error during sync of the configuration.\n\n");
713+
return 1;
714+
}
710715
}
711716
return 0;
712717
}

0 commit comments

Comments
 (0)