scripts/kconfig/Makefile | 3 ++- scripts/kconfig/merge_config.sh | 18 +++++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-)
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(-)
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
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
--
Best Regards
Masahiro Yamada
On Wed, Dec 04, 2024 at 05:25:50PM +0900, Masahiro Yamada wrote:
> 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.
This is exactly what I'm doing. I'm using -s option and added -q to very
specific merge_config script, because "-s" is already in use in that
script.
Before my change on 40384c840ea1 ("Linux 6.13-rc1"):
[leonro@e534d5fa4327 kernel]$ make -s defconfig debug.config
Using .config as base
Merging ./kernel/configs/debug.config
Value of CONFIG_DYNAMIC_DEBUG is redefined by fragment ./kernel/configs/debug.config:
Previous value: # CONFIG_DYNAMIC_DEBUG is not set
New value: CONFIG_DYNAMIC_DEBUG=y
Value of CONFIG_PRINTK_CALLER is redefined by fragment ./kernel/configs/debug.config:
Previous value: # CONFIG_PRINTK_CALLER is not set
New value: CONFIG_PRINTK_CALLER=y
...
After my change:
[leonro@4dd2c2078dff kernel]$ make -s defconfig debug.config <--- silent
Thanks
>
>
>
> 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
On Wed, Dec 4, 2024 at 5:49 PM Leon Romanovsky <leon@kernel.org> wrote:
>
> On Wed, Dec 04, 2024 at 05:25:50PM +0900, Masahiro Yamada wrote:
> > 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.
>
> This is exactly what I'm doing. I'm using -s option and added -q to very
> specific merge_config script, because "-s" is already in use in that
> script.
>
> Before my change on 40384c840ea1 ("Linux 6.13-rc1"):
> [leonro@e534d5fa4327 kernel]$ make -s defconfig debug.config
> Using .config as base
> Merging ./kernel/configs/debug.config
> Value of CONFIG_DYNAMIC_DEBUG is redefined by fragment ./kernel/configs/debug.config:
> Previous value: # CONFIG_DYNAMIC_DEBUG is not set
> New value: CONFIG_DYNAMIC_DEBUG=y
>
> Value of CONFIG_PRINTK_CALLER is redefined by fragment ./kernel/configs/debug.config:
> Previous value: # CONFIG_PRINTK_CALLER is not set
> New value: CONFIG_PRINTK_CALLER=y
> ...
>
> After my change:
> [leonro@4dd2c2078dff kernel]$ make -s defconfig debug.config <--- silent
Not sure if you checked the attached code diff in my previous reply.
To make my question clearer, does this suffice your needs?
https://lore.kernel.org/all/20241208144622.605523-1-masahiroy@kernel.org/T/#u
--
Best Regards
Masahiro Yamada
On Sun, Dec 08, 2024 at 11:49:12PM +0900, Masahiro Yamada wrote:
> On Wed, Dec 4, 2024 at 5:49 PM Leon Romanovsky <leon@kernel.org> wrote:
> >
> > On Wed, Dec 04, 2024 at 05:25:50PM +0900, Masahiro Yamada wrote:
> > > 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.
> >
> > This is exactly what I'm doing. I'm using -s option and added -q to very
> > specific merge_config script, because "-s" is already in use in that
> > script.
> >
> > Before my change on 40384c840ea1 ("Linux 6.13-rc1"):
> > [leonro@e534d5fa4327 kernel]$ make -s defconfig debug.config
> > Using .config as base
> > Merging ./kernel/configs/debug.config
> > Value of CONFIG_DYNAMIC_DEBUG is redefined by fragment ./kernel/configs/debug.config:
> > Previous value: # CONFIG_DYNAMIC_DEBUG is not set
> > New value: CONFIG_DYNAMIC_DEBUG=y
> >
> > Value of CONFIG_PRINTK_CALLER is redefined by fragment ./kernel/configs/debug.config:
> > Previous value: # CONFIG_PRINTK_CALLER is not set
> > New value: CONFIG_PRINTK_CALLER=y
> > ...
> >
> > After my change:
> > [leonro@4dd2c2078dff kernel]$ make -s defconfig debug.config <--- silent
>
>
> Not sure if you checked the attached code diff in my previous reply.
>
> To make my question clearer, does this suffice your needs?
> https://lore.kernel.org/all/20241208144622.605523-1-masahiroy@kernel.org/T/#u
Unfortunately no, as both my development suite and our CI rely on
merge_config script to create right config.
In CI, they run add very specific config options to already
well-established .config.
In my development suite, I'm removing extra options with merge_config
script.
subprocess.call(cmd + ['defconfig', 'kvm_guest.config', 'nopm.config', 'debug.config'])
subprocess.call(['scripts/kconfig/merge_config.sh', '-y', '-m', '-q',
'.config', '/plugins/kernel.config'])
subprocess.call(cmd + ['olddefconfig'])
https://github.com/Mellanox/mkt/blob/master/plugins/do-build.py#L19
https://github.com/Mellanox/mkt/commit/26d7cbd776f508ab506f6d33cfe0e9b0bf44d557
I need both chunks, silence make ... and silence merge_config script.
Thanks
>
>
> --
> Best Regards
> Masahiro Yamada
On Mon, Dec 9, 2024 at 1:36 AM Leon Romanovsky <leon@kernel.org> wrote:
>
> On Sun, Dec 08, 2024 at 11:49:12PM +0900, Masahiro Yamada wrote:
> > On Wed, Dec 4, 2024 at 5:49 PM Leon Romanovsky <leon@kernel.org> wrote:
> > >
> > > On Wed, Dec 04, 2024 at 05:25:50PM +0900, Masahiro Yamada wrote:
> > > > 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.
> > >
> > > This is exactly what I'm doing. I'm using -s option and added -q to very
> > > specific merge_config script, because "-s" is already in use in that
> > > script.
> > >
> > > Before my change on 40384c840ea1 ("Linux 6.13-rc1"):
> > > [leonro@e534d5fa4327 kernel]$ make -s defconfig debug.config
> > > Using .config as base
> > > Merging ./kernel/configs/debug.config
> > > Value of CONFIG_DYNAMIC_DEBUG is redefined by fragment ./kernel/configs/debug.config:
> > > Previous value: # CONFIG_DYNAMIC_DEBUG is not set
> > > New value: CONFIG_DYNAMIC_DEBUG=y
> > >
> > > Value of CONFIG_PRINTK_CALLER is redefined by fragment ./kernel/configs/debug.config:
> > > Previous value: # CONFIG_PRINTK_CALLER is not set
> > > New value: CONFIG_PRINTK_CALLER=y
> > > ...
> > >
> > > After my change:
> > > [leonro@4dd2c2078dff kernel]$ make -s defconfig debug.config <--- silent
> >
> >
> > Not sure if you checked the attached code diff in my previous reply.
> >
> > To make my question clearer, does this suffice your needs?
> > https://lore.kernel.org/all/20241208144622.605523-1-masahiroy@kernel.org/T/#u
>
> Unfortunately no, as both my development suite and our CI rely on
> merge_config script to create right config.
>
> In CI, they run add very specific config options to already
> well-established .config.
> In my development suite, I'm removing extra options with merge_config
> script.
>
> subprocess.call(cmd + ['defconfig', 'kvm_guest.config', 'nopm.config', 'debug.config'])
> subprocess.call(['scripts/kconfig/merge_config.sh', '-y', '-m', '-q',
> '.config', '/plugins/kernel.config'])
> subprocess.call(cmd + ['olddefconfig'])
>
> https://github.com/Mellanox/mkt/blob/master/plugins/do-build.py#L19
> https://github.com/Mellanox/mkt/commit/26d7cbd776f508ab506f6d33cfe0e9b0bf44d557
>
> I need both chunks, silence make ... and silence merge_config script.
You are no longer talking about 'make -s'.
"> /dev/null" is the standard way to suppress stdout, but you do not use it.
Similarly, subprocess.call() supports stdout=subprocess.DEVNULL
https://docs.python.org/3.13/library/subprocess.html#subprocess.call
> Thanks
>
> >
> >
> > --
> > Best Regards
> > Masahiro Yamada
--
Best Regards
Masahiro Yamada
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
© 2016 - 2025 Red Hat, Inc.