🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.debian.kernel
Article #438

[PATCH v1 05/10] Documentation: Describe kconfig-checker usage and design

#438
From: Ahmed S. Darwish
Date: Fri, 06 Nov 2026 09:50
155 lines
8027 bytes
Describe the kconfig-checker design, invocation, and external dependencies.

For PREEMPT_RT users, mention that the checker can now be used for
validating a kernel's .config against PREEMPT_RT requirements.

For the kconfig-checker external dependencies error handling code,
reference the newly added documentation as well.

Signed-off-by: Ahmed S. Darwish <darwi@linutronix.de>
---
 Documentation/admin-guide/README.rst          | 24 +++++++++
 .../real-time/kernel-configuration.rst        |  3 ++
 Documentation/tools/index.rst                 |  1 +
 Documentation/tools/kconfig_checker.rst       | 50 +++++++++++++++++++
 tools/kconfig-checker/check.py                |  7 ++-
 5 files changed, 84 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/tools/kconfig_checker.rst

diff --git a/Documentation/admin-guide/README.rst b/Documentation/admin-guide/README.rst
index 77fec1de6dc8..77ffe4dcb85b 100644
--- a/Documentation/admin-guide/README.rst
+++ b/Documentation/admin-guide/README.rst
@@ -256,6 +256,30 @@ Configuring the kernel
       should probably answer 'n' to the questions for "development",
       "experimental", or "debugging" features.
 
+Checking the kernel configuration
+---------------------------------
+
+The kconfig build system can validate the generated kernel ``.config``
+against a selected rules profile. Running ``make checkconfig`` prints
+usage information and the available profiles::
+
+  Usage: make RULES=<profile> checkconfig
+  Available RULES: preempt_rt
+
+For example, to validate the current configuration against the PREEMPT_RT
+profile, run::
+
+  make RULES=preempt_rt checkconfig
+
+``checkconfig`` reports kconfig options whose values do not match the
+selected rules profile. Each diagnostic includes a severity, such as
+``FATAL`` or ``INFO``, plus the suggested configuration change.
+
+Apply the reported changes as needed and run ``make checkconfig`` again,
+against the same rules, until no relevant diagnostics remain.
+
+For more information, see Documentation/tools/kconfig_checker.rst
+
 Compiling the kernel
 --------------------
 
diff --git a/Documentation/core-api/real-time/kernel-configuration.rst b/Documentation/core-api/real-time/kernel-configuration.rst
index d7f08e7b8760..15245c34a053 100644
--- a/Documentation/core-api/real-time/kernel-configuration.rst
+++ b/Documentation/core-api/real-time/kernel-configuration.rst
@@ -14,6 +14,9 @@ Introduction
 This document lists the kernel configuration options that might affect a
 real-time kernel's worst-case latency.  It is intended for system integrators.
 
+You can validate your kernel's ``.config`` against the guidelines below using
+the ``kconfig-checker`` tool.  See Documentation/tools/kconfig_checker.rst
+
 Configuration options
 =====================
 
diff --git a/Documentation/tools/index.rst b/Documentation/tools/index.rst
index 1adf4a6f909b..8912a627a7ac 100644
--- a/Documentation/tools/index.rst
+++ b/Documentation/tools/index.rst
@@ -10,6 +10,7 @@ more additions are needed here:
 .. toctree::
    :maxdepth: 1
 
+   kconfig_checker
    rtla/index
    rv/index
    python
diff --git a/Documentation/tools/kconfig_checker.rst b/Documentation/tools/kconfig_checker.rst
new file mode 100644
index 000000000000..73717ac56ea9
--- /dev/null
+++ b/Documentation/tools/kconfig_checker.rst
@@ -0,0 +1,50 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+============================
+Kernel configuration checker
+============================
+
+``kconfig-checker`` is a Python tool for checking a kernel ``.config`` file
+against a set of rules; e.g., PREEMPT_RT configuration requirements.  It
+gives users and system integrators a sanity report showing whether the
+passed kernel configuration satisfies a known profile.
+
+Invocation
+==========
+
+The checker can be invoked from anywhere in the file system::
+
+   check.py list-rules
+
+   check.py check -c path/to/.config -r preempt_rt
+
+As described in Documentation/admin-guide/README.rst, it is also used by
+``make checkconfig``.
+
+External dependencies
+=====================
+
+The checker requires the ``PyYAML`` and ``jsonschema`` python packages.
+Install them using your distribution's package manager, for example:
+
+.. table::
+   :align: left
+
+   ============ ================== ======================
+   Distribution       PyYAML             jsonschema
+   ============ ================== ======================
+   Debian       ``python3-yaml``   ``python3-jsonschema``
+   Red Hat      ``python3-pyyaml`` ``python3-jsonschema``
+   Arch Linux   ``python-yaml``    ``python-jsonschema``
+   ============ ================== ======================
+
+Rule files
+==========
+
+The checker's rule files are written in YAML, and are stored in::
+
+   tools/kconfig-checker/rules/
+
+The schema for these files is fully documented in::
+
+   tools/kconfig-checker/schema.yml
diff --git a/tools/kconfig-checker/check.py b/tools/kconfig-checker/check.py
index 476cd13e59eb..ef49c28b9dab 100755
--- a/tools/kconfig-checker/check.py
+++ b/tools/kconfig-checker/check.py
@@ -69,7 +69,12 @@ try:
     import jsonschema               # type: ignore
     import yaml as yaml_m           # type: ignore
 except ModuleNotFoundError as e:
-    error(f'Missing Python module: {e.name}', os.EX_UNAVAILABLE)
+    docs = 'Documentation/tools/kconfig_checker.rst'
+    error(
+        f'Missing Python module: {e.name}\n'
+        f'Check {docs} for how to install required dependencies',
+        os.EX_UNAVAILABLE
+    )
 
 #
 # Actual script:
-- 
2.56.0
Technical Details
Message-ID: <NWoK5-aaez-9@gated-at.bofh.it>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.corradoroberto.it!bofh.it!news.nic.it!robomod
References: <NWoK5-aaez-7@gated-at.bofh.it>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.corradoroberto.it!bofh.it!news.nic.it!robomod
From: "Ahmed S. Darwish" <darwi@linutronix.de>
Newsgroups: linux.debian.kernel,linux.kernel
Subject: [PATCH v1 05/10] Documentation: Describe kconfig-checker usage and design
Date: Fri, 06 Nov 2026 10:50:01 +0100
Message-ID: <NWoK5-aaez-9@gated-at.bofh.it>
References: <NWoK5-aaez-7@gated-at.bofh.it>
X-Mailbox-Line: From debian-kernel-request@lists.debian.org  Fri Nov  6 09:42:20 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
X-Greylist: delayed 390 seconds by postgrey-1.37 at bendel; Fri, 06 Nov 2026 09:26:33 UTC
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Mailing-List: <debian-kernel@lists.debian.org> archive/latest/158070
List-ID: <debian-kernel.lists.debian.org>
List-URL: <https://lists.debian.org/debian-kernel/>
List-Archive: https://lists.debian.org/msgid-search/20261106091922.7560-6-darwi@linutronix.de
Approved: robomod@news.nic.it
Lines: 155
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Cc: 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,
	"Ahmed S. Darwish" <darwi@linutronix.de>
X-Original-Date: Fri,  6 Nov 2026 10:19:17 +0100
X-Original-Message-ID: <20261106091922.7560-6-darwi@linutronix.de>
X-Original-References: <20261106091922.7560-1-darwi@linutronix.de>