On Sun, Nov 08, 2026 at 06:59:45PM +0000, Julian Braha wrote: > On 11/6/26 09:19, Ahmed S. Darwish wrote: > > Add a checkconfig target to validate the current kernel .config against a > > set of rules. Select the rules using a mandatory RULES= make variable. > > > > Example usage: > > > > make RULES=preempt_rt checkconfig > > > > Use the kconfig-checker to perform all sanity checks. > > > > Document the new target at the 'make help' text. > > > > Signed-off-by: Ahmed S. Darwish <[email protected]> > > --- > > scripts/kconfig/Makefile | 23 +++++++++++++++++++++++ > > 1 file changed, 23 insertions(+) > > > > diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile > > index 5baf1c44ffa2..d67a23730259 100644 > > --- a/scripts/kconfig/Makefile > > +++ b/scripts/kconfig/Makefile > > @@ -125,6 +125,26 @@ testconfig: $(obj)/conf > > $(if $(findstring 1,$(KBUILD_VERBOSE)),--capture=no) > > clean-files += tests/.cache > > > > +checkconfig := $(PYTHON3) -B $(srctree)/tools/kconfig-checker/check.py > > +list_checkconfig_rules = \ > > + echo -n >&2 "Available RULES: "; \ > > + $(checkconfig) list-rules >&2; \ > > + echo >&2 > > + > > +PHONY += checkconfig > > +checkconfig: > > + $(Q)if [ -z "$(RULES)" ]; then \ > > + echo >&2 "Usage: make RULES=<profile> checkconfig"; \ > > + $(list_checkconfig_rules); \ > > + exit 2; \ > > + fi > > + $(Q)if ! $(checkconfig) list-rules | grep -qw "$(RULES)"; then \ > > + echo >&2 "Unknown RULES profile = $(RULES)"; \ > > + $(list_checkconfig_rules); \ > > + exit 2; \ > > + fi > > + $(Q)$(checkconfig) check -r "$(RULES)" -c "$(KCONFIG_CONFIG)" > > + > > # Help text used by make help > > help: > > @echo 'Configuration targets:' > > @@ -154,6 +174,9 @@ help: > > @echo ' default value without prompting' > > @echo ' tinyconfig - Configure the tiniest possible kernel' > > @echo ' testconfig - Run Kconfig unit tests (requires python3 > > and pytest)' > > + @echo ' checkconfig - Check current config against sanity rules > > specified by RULES' > > + @echo ' Example usage: "make RULES=preempt_rt > > checkconfig"' > > + @echo ' (requires python3, PyYAML, and jsonschema)' > > @echo '' > > @echo 'Configuration topic targets:' > > @$(foreach f, $(all-config-fragments), \ > > -- 2.56.0 > > > > I think this tool may belong in scripts/ due to the kbuild integration, > as was mentioned in the past on another tool review: > > https://lore.kernel.org/linux-kbuild/20260428183101.GA3304253@ax162/
Yeah, while I would prefer for the script to live in scripts/ due to being called from Kbuild, I am not sure if the rules/schemas belong there? It might be better to keep everything in tools/ for that reason, especially if this may be called externally, but I am open to other thoughts. -- Cheers, Nathan

