For the kconfig checkconfig target, allow passing a rules overlay file
through an OVERLAY= parameter.  This is mostly intended for distribution
kernel packaging scripts, CI systems, and board support packages.

Document this parameter at the kernel's administration guide.

Note, the detailed overlay semantics are already explained at
Documentation/tools/kconfig_checker.rst

Signed-off-by: Ahmed S. Darwish <[email protected]>
---
 Documentation/admin-guide/README.rst | 7 ++++++-
 scripts/kconfig/Makefile             | 6 ++++--
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/Documentation/admin-guide/README.rst 
b/Documentation/admin-guide/README.rst
index 77ffe4dcb85b..b62689bcda6b 100644
--- a/Documentation/admin-guide/README.rst
+++ b/Documentation/admin-guide/README.rst
@@ -263,7 +263,7 @@ 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
+  Usage: make RULES=<profile> [OVERLAY=<overlay>] checkconfig
   Available RULES: preempt_rt
 
 For example, to validate the current configuration against the PREEMPT_RT
@@ -278,6 +278,11 @@ selected rules profile. Each diagnostic includes a 
severity, such as
 Apply the reported changes as needed and run ``make checkconfig`` again,
 against the same rules, until no relevant diagnostics remain.
 
+The ``OVERLAY=`` parameter specifies an overlay file whose rules overrides
+the built-in mainline profile selected by ``RULES=``. It is intended for
+distributions kernel packaging scripts, CI systems, and board support
+packages.
+
 For more information, see Documentation/tools/kconfig_checker.rst
 
 Compiling the kernel
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index d67a23730259..faaa8c16ab03 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -126,6 +126,8 @@ testconfig: $(obj)/conf
 clean-files += tests/.cache
 
 checkconfig := $(PYTHON3) -B $(srctree)/tools/kconfig-checker/check.py
+checkconfig_overlay = $(if $(OVERLAY),-o "$(OVERLAY)")
+
 list_checkconfig_rules =                                               \
        echo -n >&2 "Available RULES: ";                                \
        $(checkconfig) list-rules >&2;                                  \
@@ -134,7 +136,7 @@ list_checkconfig_rules =                                    
        \
 PHONY += checkconfig
 checkconfig:
        $(Q)if [ -z "$(RULES)" ]; then                                  \
-               echo >&2 "Usage: make RULES=<profile> checkconfig";     \
+               echo >&2 "Usage: make RULES=<profile> [OVERLAY=<overlay>] 
checkconfig"; \
                $(list_checkconfig_rules);                              \
                exit 2;                                                 \
        fi
@@ -143,7 +145,7 @@ checkconfig:
                $(list_checkconfig_rules);                              \
                exit 2;                                                 \
        fi
-       $(Q)$(checkconfig) check -r "$(RULES)" -c "$(KCONFIG_CONFIG)"
+       $(Q)$(checkconfig) check -r "$(RULES)" -c "$(KCONFIG_CONFIG)" 
$(checkconfig_overlay)
 
 # Help text used by make help
 help:
-- 
2.56.0

Reply via email to