🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.debian.kernel
Article #582

Re: [PATCH v1 04/10] kconfig: Introduce checkconfig target

#582
From: Ahmed S. Darwish
Date: Thu, 12 Nov 2026 11:50
91 lines
5957 bytes
Hi Nicolas,

On Wed, 11 Nov 2026, Nicolas Schier wrote:
>
> On Mon, Nov 09, 2026 at 02:18:49PM +0100, Ahmed S. Darwish wrote:
> >
> > This is why one of the development rules at the top of the Python script,
> > at patch 03/10, is:
> >
> >   The tool must not depend on being run inside the kernel source tree.
> >   This simplifies invocation, testing and possible future packaging.
>
> Then, please move the argument checking from Makefile to the script
> itself.  Handling wrong arguments is good native feature for the script.
>

The script does its own argument checking, all through Python's native
argparse mechanism:

    $ ./tools/kconfig-checker/check.py check -h
    usage: check.py check [-h] -c KCONFIG_FILE -r RULES [-o OVERLAY_FILE]

    options:
      -h, --help            show this help message and exit
      -c, --config KCONFIG_FILE
                            .config file to be checked
      -r, --rules RULES     rules file to check against
      -o, --overlay OVERLAY_FILE
                            file overlay over picked rules

    $ ./tools/kconfig-checker/check.py check -r safety

    usage: check.py check [-h] -c KCONFIG_FILE -r RULES [-o OVERLAY_FILE]

    check.py check: error: argument -r/--rules: invalid choice: 'safety'
    (choose from 'preempt_rt')

And that's by design, as an independent tool that can be later packaged.

Regarding the Makefile's own error handling, I'll touch upon that below.

> As far as I have seen when skimming through the kconfig policy checker
> code, it does not use any Kbuild variables.  So, if it is being placed
> below tools/ and does not use Kbuild at all, and is expected to be run
> w/o Linux tree context at all: why do we need an additional top-level
> Makefile target for it at all (alongside of
> 'make tools/kconfig-policy-checker')?

The reason is the expected kernel configuration workflow, e.g.:

    $ make defconfig			# Generate a default .config
    $ make debug.config			# Add debug options to it
    $ make menuconfig			# Manually customize it

    $ make RULES=preempt_rt checkconfig	# Validate it
    $ make menuconfig			# Follow checkconfig advice
    $ make RULES=preempt_rt checkconfig	# Try again..

and so on.

So the "checkconfig" target fits that workflow, even when the checker
itself does not depend on any Kbuild internals.

The Makefile-side validation is also there to improve error handling for
that workflow:

    $ make checkconfig

    Usage: make RULES=<profile> [OVERLAY=<overlay>] checkconfig
    Available RULES: preempt_rt

    make[2]: *** [scripts/kconfig/Makefile:138: checkconfig] Error 2

Without it, the user just sees the lower-level script errors:

    $ make checkconfig

    usage: check.py check [-h] -c KCONFIG_FILE -r RULES [-o OVERLAY_FILE]
    check.py check: error: argument -r/--rules: invalid choice: '' (choose from 'preempt_rt')

Both error messages are correct, but the former informs the user, exactly,
on how to call the Makefile target.  This matches the aforementioned kernel
configuration workflow as well.

I hope this clarifies things a bit.

Thank you!

--
Ahmed S. Darwish
Linutronix GmbH
Technical Details
Message-ID: <NYBtv-bq6Q-7@gated-at.bofh.it>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news-ams.pugleaf.net!news-fra.pugleaf.net!news.tcpreset.net!newsfeed.bofh.team!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod
References: <NWoK5-aaez-7@gated-at.bofh.it> <NWoK5-aaez-5@gated-at.bofh.it> <NXm3v-aILv-5@gated-at.bofh.it> <NXm3v-aILv-3@gated-at.bofh.it> <NXxLj-aP1f-3@gated-at.bofh.it> <NYaD0-bb7t-7@gated-at.bofh.it>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news-ams.pugleaf.net!news-fra.pugleaf.net!news.tcpreset.net!newsfeed.bofh.team!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod
From: "Ahmed S. Darwish" <darwi@linutronix.de>
Newsgroups: linux.debian.kernel,linux.kernel
Subject: Re: [PATCH v1 04/10] kconfig: Introduce checkconfig target
Date: Thu, 12 Nov 2026 12:50:01 +0100
Message-ID: <NYBtv-bq6Q-7@gated-at.bofh.it>
References: <NWoK5-aaez-7@gated-at.bofh.it> <NWoK5-aaez-5@gated-at.bofh.it> <NXm3v-aILv-5@gated-at.bofh.it> <NXm3v-aILv-3@gated-at.bofh.it> <NXxLj-aP1f-3@gated-at.bofh.it> <NYaD0-bb7t-7@gated-at.bofh.it>
X-Mailbox-Line: From debian-kernel-request@lists.debian.org  Thu Nov 12 11:48:39 2026
Old-Return-Path: <darwi@linutronix.de>
X-Amavis-Spam-Status: No, score=-4.4 tagged_above=-10000 required=5.3
 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
 DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3] autolearn=ham autolearn_force=no
X-Policyd-Weight: using cached result; rate: -4.6
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
X-Mailing-List: <debian-kernel@lists.debian.org> archive/latest/158242
List-ID: <debian-kernel.lists.debian.org>
List-URL: <https://lists.debian.org/debian-kernel/>
List-Archive: https://lists.debian.org/msgid-search/avWj0PDoPWu2IkgD@lx-t490
Approved: robomod@news.nic.it
Lines: 91
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Cc: Nathan Chancellor <nathan@kernel.org>,
	Julian Braha <julianbraha@gmail.com>,
	Clark Williams <clrkwllms@kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ingo Molnar <mingo@redhat.com>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Frederic Weisbecker <frederic@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jonathan Corbet <corbet@lwn.net>,
	John Ogness <john.ogness@linutronix.de>,
	Derek Barbosa <debarbos@redhat.com>,
	Zbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>,
	Daan De Meyer <daan.j.demeyer@gmail.com>,
	Luca Boccassi <luca.boccassi@gmail.com>,
	linux-rt-devel@lists.linux.dev, debian-kernel@lists.debian.org,
	linux-kbuild@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org
X-Original-Date: Thu, 12 Nov 2026 12:32:32 +0100
X-Original-Message-ID: <avWj0PDoPWu2IkgD@lx-t490>
X-Original-References: <20261106091922.7560-1-darwi@linutronix.de>
 <20261106091922.7560-5-darwi@linutronix.de>
 <3dd2bb0d-8486-4630-b496-e92e4ac37c29@gmail.com>
 <20261109003909.GB3429615@ax162>
 <avHIOS9NHwCCMITd@lx-t490>
 <avQNfFbeoMImmtre@derry.ads.avm.de>