kbuild: use KBUILD_DEFCONFIG as the fallback for DEFCONFIG_LIST
Subsystems (6)
PATCH 1/1 kbuild: use KBUILD_DEFCONFIG as the fallback for DEFCONFIG_LIST
Most of the Kconfig commands (except defconfig and all*config) read the .config file as a base set of CONFIG options.
When it does not exist, the files in DEFCONFIG_LIST are searched in this order and loaded if found.
I do not see much sense in the last two lines in DEFCONFIG_LIST.
[1] ARCH_DEFCONFIG
The entry for DEFCONFIG_LIST is guarded by 'depends on !UML'. So, the ARCH_DEFCONFIG definition in arch/x86/um/Kconfig is meaningless.
arch/{sh,sparc,x86}/Kconfig define ARCH_DEFCONFIG depending on 32 or 64 bit variant symbols. This is a little bit strange; ARCH_DEFCONFIG should be a fixed string because the base config file is loaded before the symbol evaluation stage.
Using KBUILD_DEFCONFIG makes more sense because it is fixed before Kconfig is invoked. Fortunately, arch/{sh,sparc,x86}/Makefile define it in the same way, and it works as expected. Hence, replace ARCH_DEFCONFIG with "arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)".
[2] arch/$(ARCH)/defconfig
This file path is no longer valid. The defconfig files are always located in the arch configs/ directories.
$ find arch -name defconfig | sort arch/alpha/configs/defconfig arch/arm64/configs/defconfig arch/csky/configs/defconfig arch/nds32/configs/defconfig arch/riscv/configs/defconfig arch/s390/configs/defconfig arch/unicore32/configs/defconfig
The path arch/*/configs/defconfig is already covered by "arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)". So, this file path is not necessary.
I moved the default KBUILD_DEFCONFIG to the top Makefile. Otherwise, the 7 architectures listed above would end up with endless loop of syncconfig.
---
Makefile | 3 +++ arch/sh/Kconfig | 5 ----- arch/sparc/Kconfig | 5 ----- arch/x86/Kconfig | 5 ----- arch/x86/um/Kconfig | 5 ----- init/Kconfig | 3 +-- scripts/kconfig/Makefile | 4 ---- 7 files changed, 4 insertions(+), 26 deletions(-)
Makefile +3 -0
@@ -388,6 +388,9 @@ endif KCONFIG_CONFIG ?= .config export KCONFIG_CONFIG +# Default file for 'make defconfig'. This may be overridden by arch-Makefile. +export KBUILD_DEFCONFIG := defconfig + # SHELL used by kbuild CONFIG_SHELL := sh
arch/sh/Kconfig +0 -5
@@ -87,11 +87,6 @@ config SUPERH64 select HAVE_EXIT_THREAD select KALLSYMS -config ARCH_DEFCONFIG - string - default "arch/sh/configs/shx3_defconfig" if SUPERH32 - default "arch/sh/configs/cayman_defconfig" if SUPERH64 - config GENERIC_BUG def_bool y depends on BUG && SUPERH32
arch/sparc/Kconfig +0 -5
@@ -95,11 +95,6 @@ config SPARC64 select PCI_DOMAINS if PCI select ARCH_HAS_GIGANTIC_PAGE -config ARCH_DEFCONFIG - string - default "arch/sparc/configs/sparc32_defconfig" if SPARC32 - default "arch/sparc/configs/sparc64_defconfig" if SPARC64 - config ARCH_PROC_KCORE_TEXT def_bool y
arch/x86/Kconfig +0 -5
@@ -240,11 +240,6 @@ config OUTPUT_FORMAT default "elf32-i386" if X86_32 default "elf64-x86-64" if X86_64 -config ARCH_DEFCONFIG - string - default "arch/x86/configs/i386_defconfig" if X86_32 - default "arch/x86/configs/x86_64_defconfig" if X86_64 - config LOCKDEP_SUPPORT def_bool y
arch/x86/um/Kconfig +0 -5
@@ -27,11 +27,6 @@ config X86_64 def_bool 64BIT select MODULES_USE_ELF_RELA -config ARCH_DEFCONFIG - string - default "arch/um/configs/i386_defconfig" if X86_32 - default "arch/um/configs/x86_64_defconfig" if X86_64 - config 3_LEVEL_PGTABLES bool "Three-level pagetables" if !64BIT default 64BIT
init/Kconfig +1 -2
@@ -6,8 +6,7 @@ config DEFCONFIG_LIST default "/lib/modules/$(shell,uname -r)/.config" default "/etc/kernel-config" default "/boot/config-$(shell,uname -r)" - default ARCH_DEFCONFIG - default "arch/$(ARCH)/defconfig" + default "arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)" config CC_IS_GCC def_bool $(success,$(CC) --version | head -n 1 | grep -q gcc)
scripts/kconfig/Makefile +0 -4
@@ -12,10 +12,6 @@ else Kconfig := Kconfig endif -ifndef KBUILD_DEFCONFIG -KBUILD_DEFCONFIG := defconfig -endif - ifeq ($(quiet),silent_) silent := -s endif
Signature · 1 line
2.17.1
Quoted 42 lines · Masahiro Yamada
Most of the
Kconfigcommands (except defconfig and all*config) read the .config file as a base set of CONFIG options.When it does not exist, the files in
DEFCONFIG_LISTare searched in this order and loaded if found.I do not see much sense in the last two lines in
DEFCONFIG_LIST.[1]
ARCH_DEFCONFIGThe entry for
DEFCONFIG_LISTis guarded by 'depends on !UML'. So, theARCH_DEFCONFIGdefinition inarch/x86/um/Kconfigis meaningless.
arch/{sh,sparc,x86}/KconfigdefineARCH_DEFCONFIGdepending on 32 or 64 bit variant symbols. This is a little bit strange;ARCH_DEFCONFIGshould be a fixed string because the base config file is loaded before the symbol evaluation stage.Using
KBUILD_DEFCONFIGmakes more sense because it is fixed beforeKconfigis invoked. Fortunately,arch/{sh,sparc,x86}/Makefiledefine it in the same way, and it works as expected. Hence, replaceARCH_DEFCONFIGwith "arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)".[2] arch/$(ARCH)/defconfig
This file path is no longer valid. The defconfig files are always located in the arch configs/ directories.
$ find arch -name defconfig | sort arch/alpha/configs/defconfig arch/arm64/configs/defconfig arch/csky/configs/defconfig arch/nds32/configs/defconfig arch/riscv/configs/defconfig arch/s390/configs/defconfig arch/unicore32/configs/defconfigThe path
arch/*/configs/defconfigis already covered by "arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)". So, this file path is not necessary.
Quoted 5 lines
I moved the default
KBUILD_DEFCONFIGto the topMakefile. Otherwise, the 7 architectures listed above would end up with endless loop of syncconfig.Signed-off-by Masahiro Yamada <[email protected]>
I forgot to say this.
This is v2.
Changes in v2:
- Move KBUILD_DEFCONFIG to fix endless loop of syncconfig
Quoted 121 lines
---
Makefile | 3 +++ arch/sh/Kconfig | 5 ----- arch/sparc/Kconfig | 5 ----- arch/x86/Kconfig | 5 ----- arch/x86/um/Kconfig | 5 ----- init/Kconfig | 3 +-- scripts/kconfig/Makefile | 4 ---- 7 files changed, 4 insertions(+), 26 deletions(-)Makefile +3
-0@@ -388,6 +388,9 @@ endif KCONFIG_CONFIG ?= .config export KCONFIG_CONFIG +# Default file for 'make defconfig'. This may be overridden by arch-Makefile. +export KBUILD_DEFCONFIG := defconfig + # SHELL used by kbuild CONFIG_SHELL := sharch/sh/Kconfig +0
-5@@ -87,11 +87,6 @@ config SUPERH64 select HAVE_EXIT_THREAD select KALLSYMS -config ARCH_DEFCONFIG - string - default "arch/sh/configs/shx3_defconfig" if SUPERH32 - default "arch/sh/configs/cayman_defconfig" if SUPERH64 - config GENERIC_BUG def_bool y depends on BUG && SUPERH32arch/sparc/Kconfig +0
-5@@ -95,11 +95,6 @@ config SPARC64 select PCI_DOMAINS if PCI select ARCH_HAS_GIGANTIC_PAGE -config ARCH_DEFCONFIG - string - default "arch/sparc/configs/sparc32_defconfig" if SPARC32 - default "arch/sparc/configs/sparc64_defconfig" if SPARC64 - config ARCH_PROC_KCORE_TEXT def_bool yarch/x86/Kconfig +0
-5@@ -240,11 +240,6 @@ config OUTPUT_FORMAT default "elf32-i386" if X86_32 default "elf64-x86-64" if X86_64 -config ARCH_DEFCONFIG - string - default "arch/x86/configs/i386_defconfig" if X86_32 - default "arch/x86/configs/x86_64_defconfig" if X86_64 - config LOCKDEP_SUPPORT def_bool yarch/x86/um/Kconfig +0
-5@@ -27,11 +27,6 @@ config X86_64 def_bool 64BIT select MODULES_USE_ELF_RELA -config ARCH_DEFCONFIG - string - default "arch/um/configs/i386_defconfig" if X86_32 - default "arch/um/configs/x86_64_defconfig" if X86_64 - config 3_LEVEL_PGTABLES bool "Three-level pagetables" if !64BIT default 64BITinit/Kconfig +1
-2@@ -6,8 +6,7 @@ config DEFCONFIG_LIST default "/lib/modules/$(shell,uname -r)/.config" default "/etc/kernel-config" default "/boot/config-$(shell,uname -r)" - default ARCH_DEFCONFIG - default "arch/$(ARCH)/defconfig" + default "arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)" config CC_IS_GCC def_bool $(success,$(CC) --version | head -n 1 | grep -q gcc)scripts/kconfig/Makefile +0
-5@@ -12,10 +12,6 @@ else Kconfig := Kconfig endif -ifndef KBUILD_DEFCONFIG -KBUILD_DEFCONFIG := defconfig -endif - ifeq ($(quiet),silent_) silent := -s endif --2.17.1
Signature · 2 lines
Best Regards Masahiro Yamada
Quoted 48 lines · Masahiro Yamada
Quoted 46 lines · Masahiro Yamada
Most of the
Kconfigcommands (except defconfig and all*config) read the .config file as a base set of CONFIG options.When it does not exist, the files in
DEFCONFIG_LISTare searched in this order and loaded if found.I do not see much sense in the last two lines in
DEFCONFIG_LIST.[1]
ARCH_DEFCONFIGThe entry for
DEFCONFIG_LISTis guarded by 'depends on !UML'. So, theARCH_DEFCONFIGdefinition inarch/x86/um/Kconfigis meaningless.
arch/{sh,sparc,x86}/KconfigdefineARCH_DEFCONFIGdepending on 32 or 64 bit variant symbols. This is a little bit strange;ARCH_DEFCONFIGshould be a fixed string because the base config file is loaded before the symbol evaluation stage.Using
KBUILD_DEFCONFIGmakes more sense because it is fixed beforeKconfigis invoked. Fortunately,arch/{sh,sparc,x86}/Makefiledefine it in the same way, and it works as expected. Hence, replaceARCH_DEFCONFIGwith "arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)".[2] arch/$(ARCH)/defconfig
This file path is no longer valid. The defconfig files are always located in the arch configs/ directories.
$ find arch -name defconfig | sort arch/alpha/configs/defconfig arch/arm64/configs/defconfig arch/csky/configs/defconfig arch/nds32/configs/defconfig arch/riscv/configs/defconfig arch/s390/configs/defconfig arch/unicore32/configs/defconfigThe path
arch/*/configs/defconfigis already covered by "arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)". So, this file path is not necessary.I moved the default
KBUILD_DEFCONFIGto the topMakefile. Otherwise, the 7 architectures listed above would end up with endless loop of syncconfig.
Quoted 10 lines
Quoted 1 line
Signed-off-by Masahiro Yamada <[email protected]>I forgot to say this.
This is v2.Changes in v2:
- MoveKBUILD_DEFCONFIGto fix endless loop of syncconfig
Applied to linux-kbuild.
Best Regards
Masahiro Yamada