The merge_config.sh script verifies that all the config options have
their expected value in the resulting file and prints any issues as
warnings. These checks aren't intended to be treated as errors given
the current implementation. However, since "set -e" was added, if the
grep command to look for a config option does not find it the script
will then abort prematurely.
Handle the case where the grep exit status is non-zero by setting
ACTUAL_VAL to an empty string to restore previous functionality.
Fixes: cdfca82157 ("merge_config.sh: Check error codes from make")
Signed-off-by: Guillaume Tucker <[email protected]>
Acked-by: Jon Hunter <[email protected]>
Tested-by: Jon Hunter <[email protected]>
Signed-off-by: Masahiro Yamada <[email protected]>
When we execute make after merging the configurations we ignore any
errors it produces causing whatever is running merge_config.sh to be
unaware of any failures. This issue was noticed by Guillaume Tucker
while looking at problems with testing of clang only builds in KernelCI
which caused Kbuild to be unable to find a working host compiler.
This implementation was suggested by Yamada-san.
Suggested-by: Masahiro Yamada <[email protected]>
Reported-by: Guillaume Tucker <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
Signed-off-by: Masahiro Yamada <[email protected]>
All files in lxdialog/ are licensed under GPL-2.0+, and the rest are
under GPL-2.0. I added GPL-2.0 tags to test scripts in tests/.
Documentation/process/license-rules.rst does not suggest anything
about the flex/bison files. Because flex does not accept the C++
comment style at the very top of a file, I used the C style for
zconf.l, and so for zconf.y for consistency.
Signed-off-by: Masahiro Yamada <[email protected]>
In today's merge_config.sh the order of the config fragment files dictates
the output of a config option. With this approach we will get different
.config files depending on the order of the config fragment files.
So doing something like:
$ ./merge/kconfig/merge_config.sh selftest.config drm.config
Where selftest.config defines DRM=y and drm.config defines DRM=m, the
result will be "DRM=m".
Rework to add a switch to get builtin '=y' precedence over modules '=m',
this will result in "DRM=y". If we do something like this:
$ ./merge/kconfig/merge_config.sh -y selftest.config drm.config
Suggested-by: Arnd Bergmann <[email protected]>
Signed-off-by: Anders Roxell <[email protected]>
Signed-off-by: Masahiro Yamada <[email protected]>
The current SED_CONFIG_EXP could match to comment lines in config
fragment files, especially when CONFIG_PREFIX_ is empty. For example,
Buildroot uses empty prefixing; starting symbols with BR2_ is just
convention.
Make the sed expression more robust against false positives from
comment lines. The new sed expression matches to only valid patterns.
Signed-off-by: Masahiro Yamada <[email protected]>
Reviewed-by: Petr Vorel <[email protected]>
Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <[email protected]>
with CONFIG_ environment variable.
merge_config.sh uses CONFIG_ which is used in kernel and other projects.
There are some projects which use kconfig with different prefixes (e.g.
buildroot: BR2_ prefix). CONFIG_ variable is already used for this
purpose in kconfig binary (scripts/kconfig/lkc.h), let's use the same
rule for in merge_config.sh.
Suggested-by: Masahiro Yamada <[email protected]>
Signed-off-by: Petr Vorel <[email protected]>
Signed-off-by: Masahiro Yamada <[email protected]>
merge_config.sh can usefully be applied to a single file.
It implicitly merges with the default configuration.
Signed-off-by: Gabriel de Perthuis <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
All make targets support $KCONFIG_CONFIG because they
run scripts/kconf. Make sure merge_config.sh accesses the
correct file in all cases.
Previously this script broke in two different code paths,
one for targets like kvmconfig (which use merge_config.sh -m
then call a target that respects KCONFIG_CONFIG) and one for
direct use of the script without -m, which called make rules
that edit KCONFIG_CONFIG but verified a different file.
Signed-off-by: Gabriel de Perthuis <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
Add a check for the existence of input files and exit (with failure)
if they are missing.
Without this additional check, missing files produce error messages
but still result in an output file being generated and a successful
exit code.
Signed-off-by: Sam Bobroff <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
The variable "MAKE" is used to store the command name that has
invoked the Makefile. (Actually, it is already set to "make"
if you run this script from a Makefile.)
In this script, however, it is used to determine if Make should be
run or not. It is not what we usually expect.
Signed-off-by: Masahiro Yamada <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
Reviewed-by: Darren Hart <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
It is true that we do not want to move the code too far to the
right, but something like below is not preferred:
if [ "x$PREV_VAL" != "x$NEW_VAL" ] ; then
echo Value of $CFG is redefined by fragment $MERGE_FILE:
echo Previous value: $PREV_VAL
echo New value: $NEW_VAL
echo
elif [ "$WARNREDUN" = "true" ]; then
echo Value of $CFG is redundant by fragment $MERGE_FILE:
fi
To fix this, call "continue" if the "grep" command fails to find the
given CONFIG.
Signed-off-by: Masahiro Yamada <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
Reviewed-by: Darren Hart <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
Currently, "make tinyconfig" does not work with "-j" option.
$ make mrproper
$ make -j8 tinyconfig
HOSTCC scripts/basic/fixdep
HOSTCC scripts/kconfig/conf.o
SHIPPED scripts/kconfig/zconf.tab.c
SHIPPED scripts/kconfig/zconf.lex.c
SHIPPED scripts/kconfig/zconf.hash.c
HOSTCC scripts/kconfig/zconf.tab.o
HOSTLD scripts/kconfig/conf
scripts/kconfig/conf --allnoconfig Kconfig
#
# configuration written to .config
#
scripts/kconfig/Makefile:122: *** You need an existing .config
for this target. Stop.
make: *** [tinyconfig] Error 2
As shown above, "allnoconfig" has created the .config file before
mergeconfig is called, but Make still raises a false alarm because
of some sort of race condition.
We can fix this issue by moving the error check to the shell script.
Anyway, scripts/kconfig/merge_config.sh always requires an existing
.config as a base file. It is reasonable to check its existence in
the shell script.
Signed-off-by: Masahiro Yamada <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
Reviewed-by: Darren Hart <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
Two or more arguments are always expected. Show usage and exit if
given less.
Signed-off-by: Olof Johansson <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
Viresh noticed when using merge_config.sh that a source softlink
was being created even when he didn't specify the -O option.
The problem arises due to the previous commit 409f117e2d
which added the -O option. Basically if -O is not specified,
we still pass '-O=.' to the make command, which then generates
a source softlink to ./
This patch adds an extra check so if there is no -O specified
to merge_config.sh, we don't pass one on to make.
Cc: Zhangfei Gao <[email protected]>
Cc: Bruce Ashfield <[email protected]>
Acked-by: Darren Hart <[email protected]>
Reported-and-tested-by: Viresh Kumar <[email protected]>
Signed-off-by: John Stultz <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
Provide a -O option to specify dir to put generated .config
Then merge_config.sh does not need to be copied to target dir,
for easy re-usage in other script
Signed-off-by: Zhangfei Gao <[email protected]>
Tested-by: Jon Medhurst (Tixy) <[email protected]>
Acked-by: John Stultz <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
Provide a -r option to display when fragments contain redundant
options. This is really useful when breaking apart a config into
fragments, as well as cleaning up older fragments.
Signed-off-by: John Stultz <[email protected]>
Acked-by: Darren Hart <[email protected]>
Acked-by: Bruce Ashfield <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
Somehow the merge_config.sh script didn't get its execute bit
set when it was merged. Fix this.
Signed-off-by: John Stultz <[email protected]>
Acked-by: Darren Hart <[email protected]>
Acked-by: Bruce Ashfield <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
Take the first config fragment and use it verbatim as the initial config
set. This avoids running the verification loop for the first file, as
nothing has actually been merged at this point. This significantly
increases performance for large config fragments.
Signed-off-by: Josh Boyer <[email protected]>
Acked-by: John Stultz <[email protected]>
Acked-by: Darren Hart <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
Arnaud Lacombe pointed out the final checking that the requested configs
were included in the final .config was broken.
The example was that if you had a fragment that disabled
CONFIG_DECOMPRESS_GZIP applied to a normal defconfig, there would be no
final warning that CONFIG_DECOMPRESS_GZIP was acutally set in the final
.config.
This bug was introduced by me in v3 of the original patch, and the
following patch reverts the invalid change.
Signed-off-by: John Stultz <[email protected]>
Reported-by: Arnaud Lacombe <[email protected]>
Cc: Darren Hart <[email protected]>
Cc: Michal Marek <[email protected]>
Cc: Arnaud Lacombe <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
The SIGHUP SIGINT and SIGTERM names caused failures when running
merge_config.sh with the dash shell. Dropping the "SIG" component makes
the script work in both bash and dash.
Signed-off-by: Darren Hart <[email protected]>
Acked-by: John Stultz <[email protected]>
Cc: Michal Marek <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
After noticing almost every distro has their own method of managing config
fragments, I went looking at some best practices, and wanted to try to
consolidate some of the different approaches so this fairly simple
infrastructure can be shared (and new distros/build systems don't have to
implement yet another config fragment merge script).
This script is most influenced by the Windriver tools used in the Yocto
Project, reusing some portions found there.
This script merges multiple config fragments, warning on any overridden
values. It then sets any unspecified values to their default, then
finally checks to make sure no specified value was dropped due to
unsatisfied dependencies.
I'm sure this implementation won't work for everyone, and I expect it will
need to evolve to adapt for various use cases. But I think its a
reasonable starting point.
Cc: Sam Ravnborg <[email protected]>
Cc: Greg Thelen <[email protected]>
Cc: Reinhard Tartler <[email protected]>
Cc: Dmitry Fink <[email protected]>
Cc: Darren Hart <[email protected]>
Cc: Eric B Munson <[email protected]>
Cc: Bruce Ashfield <[email protected]>
Cc: Michal Marek <[email protected]>
Signed-off-by: John Stultz <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Michal Marek <[email protected]>