On Fri, Aug 25, 2023 at 07:44:06AM +0200, Nicolas Schier wrote: > On Thu, Aug 24, 2023 at 03:36:10PM -0700, Kees Cook wrote: > > Doing a "make help" would show only hard-coded Kconfig targets and > > depended on the archhelp target to include ".config" targets. There was > > nothing showing global kernel/configs/ targets. Solve this by walking > > the wildcard list and include them in the output, using the first comment > > line as the help text. > > [...] > > Thanks for that patch! Several times I found myself searching the tree > to find a specific kconfig fragment; I think you found a nice solution. > Two minor things below. > > [...] > > diff --git a/kernel/configs/tiny-base.config b/kernel/configs/tiny-base.config > > index 2f0e6bf6db2c..ac4d254abc3f 100644 > > --- a/kernel/configs/tiny-base.config > > +++ b/kernel/configs/tiny-base.config > > @@ -1 +1,2 @@ > > +# Minimal options for tiny systems > > CONFIG_EMBEDDED=y > > (just a note: Randy prepared a patch for removing CONFIG_EMBEDDED: > https://lore.kernel.org/linux-kbuild/20230816055010.31534-1-rdunlap@xxxxxxxxxxxxx/) Ah yeah, I'll rebase this after the merge window, I guess... > > diff --git a/kernel/configs/tiny.config b/kernel/configs/tiny.config > > index 00009f7d0835..ea643e8f7f14 100644 > > --- a/kernel/configs/tiny.config > > +++ b/kernel/configs/tiny.config > > @@ -1,3 +1,5 @@ > > +# Smallest possible kernel image > > For this fragment alone (not within 'tinyconfig'), "Size-optimize kernel > image" possibly fits better? Sounds good to me! > > diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile > > index af1c96198f49..c523f24b504a 100644 > > --- a/scripts/kconfig/Makefile > > +++ b/scripts/kconfig/Makefile > > @@ -93,11 +93,11 @@ 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)) > > > > %.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 $(call configfiles,$@),, $(error No configuration exists for this target on this architecture)) > > + $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m .config $(call configfiles,$@) > > $(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig > > > > PHONY += tinyconfig > > @@ -115,6 +115,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 +142,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 fragment targets (for enabling various Kconfig items):' > > + @$(foreach c, $(call configfiles,*.config), \ > > + printf " %-20s - %s\\n" \ > > + $(shell basename $(c)) \ > > + "$(subst # ,,$(shell grep -m1 '^# ' $(c)))";) > > Better use '$(notdir $(c))` instead of forking a shell with > '$(shell basename $(c))'. Ah! Thank you. I *knew* there was a function for this but couldn't find it for some reason. :) -- Kees Cook