Message ID | 20230825194329.gonna.911-kees@kernel.org (mailing list archive) |
---|---|
Headers | show |
Series | kbuild: Show Kconfig fragments in "help" | expand |
On Sat, Aug 26, 2023 at 4:55 AM Kees Cook <keescook@chromium.org> wrote: > > Hi, > > This is my series to show *.config targets in the "help" target so these > various topics can be more easily discoverd. > > v2: > - split .fragment from .config to hide "internal" fragments Please do not do this churn. Like Randy, I did not get "why" part quiet well, but if you are eager about this, you can show help message only when the following ("# Help:" prefix for example) is found in the first line. # Help: blah blah # other comment > - fix various typos > - avoid duplicate entries > v1: https://lore.kernel.org/all/20230824223606.never.762-kees@kernel.org > > Thanks! > > -Kees > > Kees Cook (2): > kbuild: Show Kconfig fragments in "help" > kbuild: Split internal config targets from .config into .fragment > > Makefile | 1 - > arch/arm/configs/dram_0x00000000.config | 1 + > arch/arm/configs/dram_0xc0000000.config | 1 + > arch/arm/configs/dram_0xd0000000.config | 1 + > arch/arm/configs/lpae.config | 1 + > arch/arm64/configs/virt.config | 1 + > arch/powerpc/Makefile | 26 +++++++++---------- > .../{32-bit.config => 32-bit.fragment} | 1 + > arch/powerpc/configs/64-bit.config | 1 - > arch/powerpc/configs/64-bit.fragment | 2 ++ > ...{85xx-32bit.config => 85xx-32bit.fragment} | 1 + > ...{85xx-64bit.config => 85xx-64bit.fragment} | 1 + > .../{85xx-hw.config => 85xx-hw.fragment} | 1 + > .../{85xx-smp.config => 85xx-smp.fragment} | 1 + > .../{86xx-hw.config => 86xx-hw.fragment} | 1 + > .../{86xx-smp.config => 86xx-smp.fragment} | 1 + > arch/powerpc/configs/altivec.config | 1 - > arch/powerpc/configs/altivec.fragment | 2 ++ > arch/powerpc/configs/be.config | 1 - > arch/powerpc/configs/be.fragment | 2 ++ > .../{book3s_32.config => book3s_32.fragment} | 1 + > ...enet_base.config => corenet_base.fragment} | 1 + > arch/powerpc/configs/debug.config | 1 + > arch/powerpc/configs/disable-werror.config | 1 + > .../configs/{dpaa.config => dpaa.fragment} | 1 + > ...mb-nonhw.config => fsl-emb-nonhw.fragment} | 1 + > .../configs/{guest.config => guest.fragment} | 1 + > arch/powerpc/configs/le.config | 1 - > arch/powerpc/configs/le.fragment | 2 ++ > ...85xx_base.config => mpc85xx_base.fragment} | 1 + > ...86xx_base.config => mpc86xx_base.fragment} | 1 + > .../{ppc64le.config => ppc64le.fragment} | 1 + > arch/powerpc/configs/security.config | 4 ++- > arch/riscv/configs/32-bit.config | 1 + > arch/riscv/configs/64-bit.config | 1 + > arch/s390/configs/btf.config | 1 + > arch/s390/configs/kasan.config | 1 + > arch/x86/Makefile | 4 --- > arch/x86/configs/tiny.config | 2 ++ > {kernel => arch/x86}/configs/x86_debug.config | 1 + > arch/x86/configs/xen.config | 2 ++ > kernel/configs/debug.config | 2 ++ > kernel/configs/kvm_guest.config | 1 + > kernel/configs/nopm.config | 2 ++ > kernel/configs/rust.config | 1 + > kernel/configs/tiny-base.config | 1 - > kernel/configs/tiny-base.fragment | 2 ++ > kernel/configs/tiny.config | 2 ++ > kernel/configs/xen.config | 2 ++ > scripts/Makefile.defconf | 12 ++++++--- > scripts/kconfig/Makefile | 16 +++++++++--- > 51 files changed, 87 insertions(+), 32 deletions(-) > rename arch/powerpc/configs/{32-bit.config => 32-bit.fragment} (53%) > delete mode 100644 arch/powerpc/configs/64-bit.config > create mode 100644 arch/powerpc/configs/64-bit.fragment > rename arch/powerpc/configs/{85xx-32bit.config => 85xx-32bit.fragment} (76%) > rename arch/powerpc/configs/{85xx-64bit.config => 85xx-64bit.fragment} (78%) > rename arch/powerpc/configs/{85xx-hw.config => 85xx-hw.fragment} (98%) > rename arch/powerpc/configs/{85xx-smp.config => 85xx-smp.fragment} (59%) > rename arch/powerpc/configs/{86xx-hw.config => 86xx-hw.fragment} (98%) > rename arch/powerpc/configs/{86xx-smp.config => 86xx-smp.fragment} (58%) > delete mode 100644 arch/powerpc/configs/altivec.config > create mode 100644 arch/powerpc/configs/altivec.fragment > delete mode 100644 arch/powerpc/configs/be.config > create mode 100644 arch/powerpc/configs/be.fragment > rename arch/powerpc/configs/{book3s_32.config => book3s_32.fragment} (52%) > rename arch/powerpc/configs/{corenet_base.config => corenet_base.fragment} (64%) > rename arch/powerpc/configs/{dpaa.config => dpaa.fragment} (80%) > rename arch/powerpc/configs/{fsl-emb-nonhw.config => fsl-emb-nonhw.fragment} (98%) > rename arch/powerpc/configs/{guest.config => guest.fragment} (85%) > delete mode 100644 arch/powerpc/configs/le.config > create mode 100644 arch/powerpc/configs/le.fragment > rename arch/powerpc/configs/{mpc85xx_base.config => mpc85xx_base.fragment} (94%) > rename arch/powerpc/configs/{mpc86xx_base.config => mpc86xx_base.fragment} (86%) > rename arch/powerpc/configs/{ppc64le.config => ppc64le.fragment} (65%) > rename {kernel => arch/x86}/configs/x86_debug.config (90%) > delete mode 100644 kernel/configs/tiny-base.config > create mode 100644 kernel/configs/tiny-base.fragment > > -- > 2.34.1 >
Masahiro Yamada <masahiroy@kernel.org> writes: > On Sat, Aug 26, 2023 at 4:55 AM Kees Cook <keescook@chromium.org> wrote: >> >> Hi, >> >> This is my series to show *.config targets in the "help" target so these >> various topics can be more easily discoverd. >> >> v2: >> - split .fragment from .config to hide "internal" fragments > > Please do not do this churn. That was my idea :} > Like Randy, I did not get "why" part quiet well, > but if you are eager about this, > you can show help message only when the following > ("# Help:" prefix for example) is found in the first line. > > # Help: blah blah > # other comment I did think of that, but wasn't sure how to do it in make. cheers
On Mon 28 Aug 2023 16:17:07 GMT, Michael Ellerman wrote: > Masahiro Yamada <masahiroy@kernel.org> writes: > > On Sat, Aug 26, 2023 at 4:55 AM Kees Cook <keescook@chromium.org> wrote: > >> > >> Hi, > >> > >> This is my series to show *.config targets in the "help" target so these > >> various topics can be more easily discoverd. > >> > >> v2: > >> - split .fragment from .config to hide "internal" fragments > > > > Please do not do this churn. > > That was my idea :} > > > Like Randy, I did not get "why" part quiet well, > > but if you are eager about this, > > you can show help message only when the following > > ("# Help:" prefix for example) is found in the first line. > > > > # Help: blah blah > > # other comment > > I did think of that, but wasn't sure how to do it in make. Something like this should do it: @grep -Hnm1 -e '^# Help:' $(foreach f, $(sort $(notdir $(call configfiles,*.config))), $(firstword $(call configfiles,$(f)))) | \ while read loc dummy helptext; do \ tmp="$${loc%:#}"; file="$${tmp%:*}"; line="$${tmp##*:}"; \ [ "$${line}" = "1" ] && \ printf " %-25s - %s\\n" "$${file##*/}" "$${helptext}"; \ done but this neither beautiful nor elegant it likes to be improved. Kind regards, Nicolas
On Tue, Aug 29, 2023 at 3:55 PM Nicolas Schier <nicolas@fjasle.eu> wrote: > > On Mon 28 Aug 2023 16:17:07 GMT, Michael Ellerman wrote: > > Masahiro Yamada <masahiroy@kernel.org> writes: > > > On Sat, Aug 26, 2023 at 4:55 AM Kees Cook <keescook@chromium.org> wrote: > > >> > > >> Hi, > > >> > > >> This is my series to show *.config targets in the "help" target so these > > >> various topics can be more easily discoverd. > > >> > > >> v2: > > >> - split .fragment from .config to hide "internal" fragments > > > > > > Please do not do this churn. > > > > That was my idea :} > > > > > Like Randy, I did not get "why" part quiet well, > > > but if you are eager about this, > > > you can show help message only when the following > > > ("# Help:" prefix for example) is found in the first line. > > > > > > # Help: blah blah > > > # other comment > > > > I did think of that, but wasn't sure how to do it in make. > > Something like this should do it: > > @grep -Hnm1 -e '^# Help:' $(foreach f, $(sort $(notdir $(call configfiles,*.config))), $(firstword $(call configfiles,$(f)))) | \ > while read loc dummy helptext; do \ > tmp="$${loc%:#}"; file="$${tmp%:*}"; line="$${tmp##*:}"; \ > [ "$${line}" = "1" ] && \ > printf " %-25s - %s\\n" "$${file##*/}" "$${helptext}"; \ > done > > but this neither beautiful nor elegant it likes to be improved. > > Kind regards, > Nicolas The attached patch will work too. I dropped the "in the first line" restriction because SPDX might be placed in the first line of config fragments.
On Tue, Aug 29, 2023 at 11:57:19PM +0900 Masahiro Yamada wrote: > On Tue, Aug 29, 2023 at 3:55 PM Nicolas Schier <nicolas@fjasle.eu> wrote: > > > > On Mon 28 Aug 2023 16:17:07 GMT, Michael Ellerman wrote: > > > Masahiro Yamada <masahiroy@kernel.org> writes: > > > > On Sat, Aug 26, 2023 at 4:55 AM Kees Cook <keescook@chromium.org> wrote: > > > >> > > > >> Hi, > > > >> > > > >> This is my series to show *.config targets in the "help" target so these > > > >> various topics can be more easily discoverd. > > > >> > > > >> v2: > > > >> - split .fragment from .config to hide "internal" fragments > > > > > > > > Please do not do this churn. > > > > > > That was my idea :} > > > > > > > Like Randy, I did not get "why" part quiet well, > > > > but if you are eager about this, > > > > you can show help message only when the following > > > > ("# Help:" prefix for example) is found in the first line. > > > > > > > > # Help: blah blah > > > > # other comment > > > > > > I did think of that, but wasn't sure how to do it in make. > > > > Something like this should do it: > > > > @grep -Hnm1 -e '^# Help:' $(foreach f, $(sort $(notdir $(call configfiles,*.config))), $(firstword $(call configfiles,$(f)))) | \ > > while read loc dummy helptext; do \ > > tmp="$${loc%:#}"; file="$${tmp%:*}"; line="$${tmp##*:}"; \ > > [ "$${line}" = "1" ] && \ > > printf " %-25s - %s\\n" "$${file##*/}" "$${helptext}"; \ > > done > > > > but this neither beautiful nor elegant it likes to be improved. > > > > Kind regards, > > Nicolas > > > > > The attached patch will work too. > > I dropped the "in the first line" restriction > because SPDX might be placed in the first line > of config fragments. > > > > -- > Best Regards > Masahiro Yamada > diff --git a/Makefile b/Makefile > index e21bf66af6fd..23cd62a5ff05 100644 > --- 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:' > diff --git a/arch/x86/Makefile b/arch/x86/Makefile > index fdc2e3abd615..c4b2a8a19fc8 100644 > --- a/arch/x86/Makefile > +++ b/arch/x86/Makefile > @@ -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 > diff --git a/kernel/configs/kvm_guest.config b/kernel/configs/kvm_guest.config > index 208481d91090..d0877063d925 100644 > --- a/kernel/configs/kvm_guest.config > +++ b/kernel/configs/kvm_guest.config > @@ -1,3 +1,4 @@ > +# Help: Bootable as a KVM guest > CONFIG_NET=y > CONFIG_NET_CORE=y > CONFIG_NETDEVICES=y > diff --git a/kernel/configs/x86_debug.config b/kernel/configs/x86_debug.config > index 6fac5b405334..35f48671b8d5 100644 > --- a/kernel/configs/x86_debug.config > +++ b/kernel/configs/x86_debug.config > @@ -1,3 +1,4 @@ > +# Help: Debugging options for tip tree testing > CONFIG_X86_DEBUG_FPU=y > CONFIG_LOCK_STAT=y > CONFIG_DEBUG_VM=y > diff --git a/kernel/configs/xen.config b/kernel/configs/xen.config > index 436f806aa1ed..6878b9a49be8 100644 > --- a/kernel/configs/xen.config > +++ b/kernel/configs/xen.config > @@ -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 > diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile > index af1c96198f49..e72c5ee659a9 100644 > --- a/scripts/kconfig/Makefile > +++ b/scripts/kconfig/Makefile > @@ -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-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;) thanks, this looks much better, and SPDX is a good point. Kind regards, Nicolas
On Tue, Aug 29, 2023 at 11:57:19PM +0900, Masahiro Yamada wrote: > The attached patch will work too. > > I dropped the "in the first line" restriction > because SPDX might be placed in the first line > of config fragments. Good call. Yes, this looks excellent; thank you! Do you want to send a formal patch? Please consider it: Reviewed-by: Kees Cook <keescook@chromium.org>
On Thu, Aug 31, 2023 at 9:03 AM Kees Cook <keescook@chromium.org> wrote: > > On Tue, Aug 29, 2023 at 11:57:19PM +0900, Masahiro Yamada wrote: > > The attached patch will work too. > > > > I dropped the "in the first line" restriction > > because SPDX might be placed in the first line > > of config fragments. > > Good call. Yes, this looks excellent; thank you! Do you want to send a > formal patch? Please consider it: > > Reviewed-by: Kees Cook <keescook@chromium.org> > > -- > Kees Cook You can send it with Co-developed-by: Masahiro Yamada <masahiroy@kernel.org> You can add help messages to more *.config files if you like, and add SPDX tags while you are here. -- Best Regards Masahiro Yamada