Message ID | e534ce33b0e1060eb85ece8429810f087b034c88.1733234008.git.leonro@nvidia.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [rdma-next] kbuild: Respect request to silent output when merging configs | expand |
On Tue, Dec 03, 2024 at 03:55:18PM +0200, Leon Romanovsky wrote: > From: Leon Romanovsky <leonro@nvidia.com> > > 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@nvidia.com> > --- > scripts/kconfig/Makefile | 3 ++- > scripts/kconfig/merge_config.sh | 18 +++++++++++++----- > 2 files changed, 15 insertions(+), 6 deletions(-) Masahiro, I hope that you don't mind that I put "rdma-next" as a target. It wasn't intentionally, and bug in my submission scripts. Thanks
On Tue, Dec 3, 2024 at 10:55 PM Leon Romanovsky <leon@kernel.org> wrote: > > From: Leon Romanovsky <leonro@nvidia.com> > > 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. Is it necessary to add the --quiet option to every script? Kbuild already provides a generic way to suppress the stdout with 'make -s'. The following code works for me. 'make defconfig debug.config' is as verbose as before. 'make -s defconfig debug.config' is really silent. diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index a0a0be38cbdc..fb50bd4f4103 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -105,9 +105,11 @@ configfiles = $(wildcard $(srctree)/kernel/configs/$(1) $(srctree)/arch/$(SRCARC all-config-fragments = $(call configfiles,*.config) config-fragments = $(call configfiles,$@) +cmd_merge_fragments = $(srctree)/scripts/kconfig/merge_config.sh -m $(KCONFIG_CONFIG) $(config-fragments) + %.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) + $(call cmd,merge_fragments) $(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig PHONY += tinyconfig
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