Re: [PATCH rdma-next] kbuild: Respect request to silent output when merging configs
From: Masahiro Yamada
Date: Wed Dec 04 2024 - 03:26:33 EST
On Tue, Dec 3, 2024 at 10:55 PM Leon Romanovsky <leon@xxxxxxxxxx> wrote:
>
> 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.
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
--
Best Regards
Masahiro Yamada