]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
kbuild: Show marked Kconfig fragments in "help"
authorKees Cook <keescook@chromium.org>
Thu, 31 Aug 2023 19:13:39 +0000 (12:13 -0700)
committerMasahiro Yamada <masahiroy@kernel.org>
Sun, 3 Sep 2023 17:04:20 +0000 (02:04 +0900)
Currently the Kconfig fragments in kernel/configs and arch/*/configs
that aren't used internally aren't discoverable through "make help",
which consists of hard-coded lists of config fragments. Instead, list
all the fragment targets that have a "# Help: " comment prefix so the
targets can be generated dynamically.

Add logic to the Makefile to search for and display the fragment and
comment. Add comments to fragments that are intended to be direct targets.

Signed-off-by: Kees Cook <keescook@chromium.org>
Co-developed-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
20 files changed:
Makefile
arch/arm/configs/dram_0x00000000.config
arch/arm/configs/dram_0xc0000000.config
arch/arm/configs/dram_0xd0000000.config
arch/arm/configs/lpae.config
arch/arm64/configs/virt.config
arch/powerpc/configs/disable-werror.config
arch/powerpc/configs/security.config
arch/riscv/configs/32-bit.config
arch/riscv/configs/64-bit.config
arch/s390/configs/btf.config
arch/s390/configs/kasan.config
arch/x86/Makefile
kernel/configs/debug.config
kernel/configs/kvm_guest.config
kernel/configs/nopm.config
kernel/configs/rust.config
kernel/configs/x86_debug.config
kernel/configs/xen.config
scripts/kconfig/Makefile

index e21bf66af6fd3bb4eb3150157e62e808c1ab245a..23cd62a5ff0595b9a4c315eefcd46744280da95f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1552,7 +1552,6 @@ help:
        @echo  '  mrproper        - Remove all generated files + config + various backup files'
        @echo  '  distclean       - mrproper + remove editor backup and patch files'
        @echo  ''
-       @echo  'Configuration targets:'
        @$(MAKE) -f $(srctree)/scripts/kconfig/Makefile help
        @echo  ''
        @echo  'Other generic targets:'
index db96dcb420cebec5b5f4594e78506177bc3d3af3..8803a0f58343c8f2f41bc9fde54cdcb068df803e 100644 (file)
@@ -1 +1,2 @@
+# Help: DRAM base at 0x00000000
 CONFIG_DRAM_BASE=0x00000000
index 343d5333d973d502515c55a1015fb4c78298face..aab8f864686b52c5bb24824c2db94667d7f4ada3 100644 (file)
@@ -1 +1,2 @@
+# Help: DRAM base at 0xc0000000
 CONFIG_DRAM_BASE=0xc0000000
index 61ba7045f8a139ef5321224e92b226f8725bb53b..4aabce4ea3d46505a327f34f7bc6c1845fe0d2fa 100644 (file)
@@ -1 +1,2 @@
+# Help: DRAM base at 0xd0000000
 CONFIG_DRAM_BASE=0xd0000000
index a6d6f7ab3c01a130d9086af74290fdd37bd3bc82..1ab94da8345d32906bae6ba2bb24ce9a04e751b0 100644 (file)
@@ -1,2 +1,3 @@
+# Help: Enable Large Physical Address Extension mode
 CONFIG_ARM_LPAE=y
 CONFIG_VMSPLIT_2G=y
index 6865d54e68f8880eb86705b1ce8fc1c446200d24..c47c36f8f67b7c4b4c9e548d5f15f1486bf9c8d2 100644 (file)
@@ -1,3 +1,4 @@
+# Help: Virtualization guest
 #
 # Base options for platforms
 #
index 6ea12a12432c9dc831d7c2f189b260a228fa40fb..7776b91da37f13c5e213791b89cdc6588e55afbf 100644 (file)
@@ -1 +1,2 @@
+# Help: Disable -Werror
 CONFIG_PPC_DISABLE_WERROR=y
index 1c91a35c6a733ac5961336dea14dc9faba0e917e..0d54e29e2cdfc6ef34aa921855f8ba5202a6a78a 100644 (file)
@@ -1,3 +1,5 @@
+# Help: Common security options for PowerPC builds
+
 # This is the equivalent of booting with lockdown=integrity
 CONFIG_SECURITY=y
 CONFIG_SECURITYFS=y
@@ -12,4 +14,4 @@ CONFIG_INIT_ON_ALLOC_DEFAULT_ON=y
 
 # UBSAN bounds checking is very cheap and good for hardening
 CONFIG_UBSAN=y
-# CONFIG_UBSAN_MISC is not set
\ No newline at end of file
+# CONFIG_UBSAN_MISC is not set
index f6af0f708df4a6e728c168542966060822f50f4b..16ee163847b44779ee44948b0f53a2251da9503a 100644 (file)
@@ -1,3 +1,4 @@
+# Help: Build a 32-bit image
 CONFIG_ARCH_RV32I=y
 CONFIG_32BIT=y
 # CONFIG_PORTABLE is not set
index 313edc554d84cc0fbe63b3a1e9c903a7fd684560..d872a2d533f20e2268b8ccabafef69a7e5631810 100644 (file)
@@ -1,2 +1,3 @@
+# Help: Build a 64-bit image
 CONFIG_ARCH_RV64I=y
 CONFIG_64BIT=y
index 39227b4511aff8f781d8aa72657fce051a9d981f..eb7f84f5925cf36a9bc21b7d398a5c56d498b6d8 100644 (file)
@@ -1 +1,2 @@
+# Help: Enable BTF debug info
 CONFIG_DEBUG_INFO_BTF=y
index 700a8b25c3ffc057f59e099590574ddf15ce0bd1..84c2b551e9927bb26b3a68a5cafa969be2c857b7 100644 (file)
@@ -1,3 +1,4 @@
+# Help: Enable KASan for debugging
 CONFIG_KASAN=y
 CONFIG_KASAN_INLINE=y
 CONFIG_KASAN_VMALLOC=y
index fdc2e3abd6152f53530f687a3f9041c020065609..c4b2a8a19fc831c8bb53b10166142fa56aed56c7 100644 (file)
@@ -335,9 +335,5 @@ define archhelp
   echo  '                        bzdisk/fdimage*/hdimage/isoimage also accept:'
   echo  '                        FDARGS="..."  arguments for the booted kernel'
   echo  '                        FDINITRD=file initrd for the booted kernel'
-  echo  ''
-  echo  '  kvm_guest.config    - Enable Kconfig items for running this kernel as a KVM guest'
-  echo  '  xen.config          - Enable Kconfig items for running this kernel as a Xen guest'
-  echo  '  x86_debug.config    - Enable tip tree debugging options for testing'
 
 endef
index e8db8d938661774a8917a42951d519f7bf415c77..4722b998a32453243cf0f7d29e081a48bc8e406e 100644 (file)
@@ -1,3 +1,5 @@
+# Help: Debugging for CI systems and finding regressions
+#
 # The config is based on running daily CI for enterprise Linux distros to
 # seek regressions on linux-next builds on different bare-metal and virtual
 # platforms. It can be used for example,
index 208481d9109030403357b36ada51074f14f37293..d0877063d925cd6db3136c9efd175669c1317131 100644 (file)
@@ -1,3 +1,4 @@
+# Help: Bootable as a KVM guest
 CONFIG_NET=y
 CONFIG_NET_CORE=y
 CONFIG_NETDEVICES=y
index 81ff078635769ef5ee6dd09ca9a1abe1696df639..ebfdc3d8aa9add0d5e90ed373b58e2cbc8cce4ec 100644 (file)
@@ -1,3 +1,5 @@
+# Help: Disable Power Management
+
 CONFIG_PM=n
 CONFIG_SUSPEND=n
 CONFIG_HIBERNATION=n
index 38a7c5362c9cf1f8b5956e673de7c90359bf7503..2c6e001a728497e53174b3b3adc6282219f128d0 100644 (file)
@@ -1 +1,2 @@
+# Help: Enable Rust
 CONFIG_RUST=y
index 6fac5b405334e199148a41a3320809b8fa7423eb..35f48671b8d5c2cde361b3129ee1e56051663781 100644 (file)
@@ -1,3 +1,4 @@
+# Help: Debugging options for tip tree testing
 CONFIG_X86_DEBUG_FPU=y
 CONFIG_LOCK_STAT=y
 CONFIG_DEBUG_VM=y
index 436f806aa1ed0d31714c90f9bfe027adaf16ca7b..6878b9a49be8d442f01c5ffb28e27bf413d28fd0 100644 (file)
@@ -1,3 +1,5 @@
+# Help: Bootable as a Xen guest
+#
 # global stuff - these enable us to allow some
 # of the not so generic stuff below for xen
 CONFIG_PARAVIRT=y
index af1c96198f4919c1af966e5fc06dcddb7c405fef..4eee155121a8b37c201e70c8327c3ea556d5cd94 100644 (file)
@@ -93,11 +93,13 @@ endif
 %_defconfig: $(obj)/conf
        $(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig)
 
-configfiles=$(wildcard $(srctree)/kernel/configs/$@ $(srctree)/arch/$(SRCARCH)/configs/$@)
+configfiles = $(wildcard $(srctree)/kernel/configs/$(1) $(srctree)/arch/$(SRCARCH)/configs/$(1))
+all-config-fragments = $(call configfiles,*.config)
+config-fragments = $(call configfiles,$@)
 
 %.config: $(obj)/conf
-       $(if $(call configfiles),, $(error No configuration exists for this target on this architecture))
-       $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m .config $(configfiles)
+       $(if $(config-fragments),, $(error $@ fragment does not exists on this architecture))
+       $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m .config $(config-fragments)
        $(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
 
 PHONY += tinyconfig
@@ -115,6 +117,7 @@ clean-files += tests/.cache
 
 # Help text used by make help
 help:
+       @echo  'Configuration targets:'
        @echo  '  config          - Update current config utilising a line-oriented program'
        @echo  '  nconfig         - Update current config utilising a ncurses menu based program'
        @echo  '  menuconfig      - Update current config utilising a menu based program'
@@ -141,6 +144,12 @@ help:
        @echo  '                    default value without prompting'
        @echo  '  tinyconfig      - Configure the tiniest possible kernel'
        @echo  '  testconfig      - Run Kconfig unit tests (requires python3 and pytest)'
+       @echo  ''
+       @echo  'Configuration topic targets:'
+       @$(foreach f, $(all-config-fragments), \
+               if help=$$(grep -m1 '^# Help: ' $(f)); then \
+                       printf '  %-25s - %s\n' '$(notdir $(f))' "$${help#*: }"; \
+               fi;)
 
 # ===========================================================================
 # object files used by all kconfig flavours