From: Nicolas Schier <nicolas@fjasle.eu>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>,
Kees Cook <keescook@chromium.org>,
Christophe Leroy <christophe.leroy@csgroup.eu>,
Randy Dunlap <rdunlap@infradead.org>,
linux-kernel@vger.kernel.org, x86@kernel.org,
linux-arm-kernel@lists.infradead.org,
linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org,
linux-s390@vger.kernel.org, linux-kbuild@vger.kernel.org,
linux-hardening@vger.kernel.org
Subject: Re: [PATCH v2 0/2] kbuild: Show Kconfig fragments in "help"
Date: Tue, 29 Aug 2023 22:07:19 +0200 [thread overview]
Message-ID: <ZO5P9597qqm3P+li@fjasle.eu> (raw)
In-Reply-To: <CAK7LNARjsB+LTBGRfWX68Ld7oehhuBv9SY8scoC=Xk8EJc-OHw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 6145 bytes --]
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Nicolas Schier <nicolas@fjasle.eu>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>,
Kees Cook <keescook@chromium.org>,
Christophe Leroy <christophe.leroy@csgroup.eu>,
Randy Dunlap <rdunlap@infradead.org>,
linux-kernel@vger.kernel.org, x86@kernel.org,
linux-arm-kernel@lists.infradead.org,
linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org,
linux-s390@vger.kernel.org, linux-kbuild@vger.kernel.org,
linux-hardening@vger.kernel.org
Subject: Re: [PATCH v2 0/2] kbuild: Show Kconfig fragments in "help"
Date: Tue, 29 Aug 2023 22:07:19 +0200 [thread overview]
Message-ID: <ZO5P9597qqm3P+li@fjasle.eu> (raw)
In-Reply-To: <CAK7LNARjsB+LTBGRfWX68Ld7oehhuBv9SY8scoC=Xk8EJc-OHw@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 6145 bytes --]
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
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 161 bytes --]
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
WARNING: multiple messages have this Message-ID (diff)
From: Nicolas Schier <nicolas@fjasle.eu>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: linux-s390@vger.kernel.org, Randy Dunlap <rdunlap@infradead.org>,
Kees Cook <keescook@chromium.org>,
linux-kbuild@vger.kernel.org, x86@kernel.org,
linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org,
linux-riscv@lists.infradead.org, linuxppc-dev@lists.ozlabs.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 0/2] kbuild: Show Kconfig fragments in "help"
Date: Tue, 29 Aug 2023 22:07:19 +0200 [thread overview]
Message-ID: <ZO5P9597qqm3P+li@fjasle.eu> (raw)
In-Reply-To: <CAK7LNARjsB+LTBGRfWX68Ld7oehhuBv9SY8scoC=Xk8EJc-OHw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 6145 bytes --]
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Nicolas Schier <nicolas@fjasle.eu>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>,
Kees Cook <keescook@chromium.org>,
Christophe Leroy <christophe.leroy@csgroup.eu>,
Randy Dunlap <rdunlap@infradead.org>,
linux-kernel@vger.kernel.org, x86@kernel.org,
linux-arm-kernel@lists.infradead.org,
linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org,
linux-s390@vger.kernel.org, linux-kbuild@vger.kernel.org,
linux-hardening@vger.kernel.org
Subject: Re: [PATCH v2 0/2] kbuild: Show Kconfig fragments in "help"
Date: Tue, 29 Aug 2023 22:07:19 +0200 [thread overview]
Message-ID: <ZO5P9597qqm3P+li@fjasle.eu> (raw)
In-Reply-To: <CAK7LNARjsB+LTBGRfWX68Ld7oehhuBv9SY8scoC=Xk8EJc-OHw@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 6145 bytes --]
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
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-08-29 20:15 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-25 19:47 [PATCH v2 0/2] kbuild: Show Kconfig fragments in "help" Kees Cook
2023-08-25 19:47 ` Kees Cook
2023-08-25 19:47 ` Kees Cook
2023-08-25 19:47 ` Kees Cook
2023-08-25 19:47 ` [PATCH v2 1/2] " Kees Cook
2023-08-25 19:47 ` Kees Cook
2023-08-25 19:47 ` Kees Cook
2023-08-25 19:47 ` Kees Cook
2023-08-25 19:47 ` [PATCH v2 2/2] kbuild: Split internal config targets from .config into .fragment Kees Cook
2023-08-25 19:47 ` Kees Cook
2023-08-25 19:47 ` Kees Cook
2023-08-25 19:47 ` Kees Cook
2023-08-28 1:03 ` [PATCH v2 0/2] kbuild: Show Kconfig fragments in "help" Masahiro Yamada
2023-08-28 1:03 ` Masahiro Yamada
2023-08-28 1:03 ` Masahiro Yamada
2023-08-28 1:03 ` Masahiro Yamada
2023-08-28 6:17 ` Michael Ellerman
2023-08-28 6:17 ` Michael Ellerman
2023-08-28 6:17 ` Michael Ellerman
2023-08-28 6:17 ` Michael Ellerman
2023-08-29 6:16 ` Nicolas Schier
2023-08-29 6:16 ` Nicolas Schier
2023-08-29 6:16 ` Nicolas Schier
2023-08-29 6:16 ` Nicolas Schier
2023-08-29 14:57 ` Masahiro Yamada
2023-08-29 14:57 ` Masahiro Yamada
2023-08-29 14:57 ` Masahiro Yamada
2023-08-29 14:57 ` Masahiro Yamada
2023-08-29 20:07 ` Nicolas Schier [this message]
2023-08-29 20:07 ` Nicolas Schier
2023-08-29 20:07 ` Nicolas Schier
2023-08-29 20:07 ` Nicolas Schier
2023-08-31 0:03 ` Kees Cook
2023-08-31 0:03 ` Kees Cook
2023-08-31 0:03 ` Kees Cook
2023-08-31 0:03 ` Kees Cook
2023-08-31 15:45 ` Masahiro Yamada
2023-08-31 15:45 ` Masahiro Yamada
2023-08-31 15:45 ` Masahiro Yamada
2023-08-31 15:45 ` 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=ZO5P9597qqm3P+li@fjasle.eu \
--to=nicolas@fjasle.eu \
--cc=christophe.leroy@csgroup.eu \
--cc=keescook@chromium.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-s390@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=masahiroy@kernel.org \
--cc=mpe@ellerman.id.au \
--cc=rdunlap@infradead.org \
--cc=x86@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.