[PATCH] scripts/config: honor $KBUILD_OUTPUT by default

From: Dmitry Voytik

Date: Sun Sep 20 2026 - 02:48:52 EST


If $KBUILD_OUTPUT is set, use it by default if --file is not passed.

Fix the issue when the script silently updates a stale .config in
the root directory, while the user expects ${KBUILD_OUTPUT}/.config
to be updated.
The problem can be worked around with --file, but this is easy to miss,
and is inconsistent with how the Makefile and other tools work
(e.g., scripts/diffconfig).

Signed-off-by: Dmitry Voytik <voytikd@xxxxxxxxx>
---
scripts/config | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/scripts/config b/scripts/config
index 32428ea909c2..f52ba5e6e27e 100755
--- a/scripts/config
+++ b/scripts/config
@@ -130,6 +130,11 @@ on_exit() {
trap on_exit EXIT

FN=.config
+if [ -n "${KBUILD_OUTPUT}" ]; then
+ FN=${KBUILD_OUTPUT}/${FN}
+ echo "Using ${FN}"
+fi
+
CMDS=()
while [[ $# -gt 0 ]]; do
if [ "$1" = "--file" ]; then
--
2.55.0