[PATCH rdma-next] kbuild: Respect request to silent output when merging configs
From: Leon Romanovsky
Date: Tue Dec 03 2024 - 08:55:38 EST
From: Leon Romanovsky <leonro@xxxxxxxxxx>
Builds with -s option (silent) are supposed to silence all output
which is not an error. It is the case for target builds but not
for configs. These builds generate prints like this:
➜ kernel git:(rdma-next) make -s defconfig debug.config
Using .config as base
Merging ./kernel/configs/debug.config
#
# merged configuration written to .config (needs make)
#
...
Value of CONFIG_FUNCTION_TRACER is redefined by fragment ./kernel/configs/debug.config:
Previous value: # CONFIG_FUNCTION_TRACER is not set
New value: CONFIG_FUNCTION_TRACER=y
----
Let's honor -s option and hide all non-error output.
Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxx>
---
scripts/kconfig/Makefile | 3 ++-
scripts/kconfig/merge_config.sh | 18 +++++++++++++-----
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index a0a0be38cbdc..130c3c74b828 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -15,6 +15,7 @@ endif
ifeq ($(quiet),silent_)
silent := -s
+silent_merge := -q
endif
export KCONFIG_DEFCONFIG_LIST :=
@@ -107,7 +108,7 @@ config-fragments = $(call configfiles,$@)
%.config: $(obj)/conf
$(if $(config-fragments),, $(error $@ fragment does not exists on this architecture))
- $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m $(KCONFIG_CONFIG) $(config-fragments)
+ $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh $(silent_merge) -m $(KCONFIG_CONFIG) $(config-fragments)
$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
PHONY += tinyconfig
diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh
index 0b7952471c18..29060fba84b6 100755
--- a/scripts/kconfig/merge_config.sh
+++ b/scripts/kconfig/merge_config.sh
@@ -30,6 +30,7 @@ usage() {
echo " -O dir to put generated output files. Consider setting \$KCONFIG_CONFIG instead."
echo " -s strict mode. Fail if the fragment redefines any value."
echo " -Q disable warning messages for overridden options."
+ echo " -q be quiet."
echo
echo "Used prefix: '$CONFIG_PREFIX'. You can redefine it with \$CONFIG_ environment variable."
}
@@ -42,6 +43,7 @@ OUTPUT=.
STRICT=false
CONFIG_PREFIX=${CONFIG_-CONFIG_}
WARNOVERRIDE=echo
+QUIET=echo
while true; do
case $1 in
@@ -89,6 +91,12 @@ while true; do
shift
continue
;;
+ "-q")
+ WARNOVERRIDE=true
+ QUIET=true
+ shift
+ continue
+ ;;
*)
break
;;
@@ -123,7 +131,7 @@ SED_CONFIG_EXP2="s/^# \(${CONFIG_PREFIX}[a-zA-Z0-9_]*\) is not set$/\1/p"
TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX)
MERGE_FILE=$(mktemp ./.merge_tmp.config.XXXXXXXXXX)
-echo "Using $INITFILE as base"
+${QUIET} "Using $INITFILE as base"
trap clean_up EXIT
@@ -131,7 +139,7 @@ cat $INITFILE > $TMP_FILE
# Merge files, printing warnings on overridden values
for ORIG_MERGE_FILE in $MERGE_LIST ; do
- echo "Merging $ORIG_MERGE_FILE"
+ ${QUIET} "Merging $ORIG_MERGE_FILE"
if [ ! -r "$ORIG_MERGE_FILE" ]; then
echo "The merge file '$ORIG_MERGE_FILE' does not exist. Exit." >&2
exit 1
@@ -179,9 +187,9 @@ fi
if [ "$RUNMAKE" = "false" ]; then
cp -T -- "$TMP_FILE" "$KCONFIG_CONFIG"
- echo "#"
- echo "# merged configuration written to $KCONFIG_CONFIG (needs make)"
- echo "#"
+ ${QUIET} "#"
+ ${QUIET} "# merged configuration written to $KCONFIG_CONFIG (needs make)"
+ ${QUIET} "#"
exit
fi
--
2.47.0