2 # SPDX-License-Identifier: GPL-2.0+
4 # Usage: configinit.sh config-spec-file results-dir
6 # Create a .config file from the spec file. Run from the kernel source tree.
7 # Exits with 0 if all went well, with 1 if all went well but the config
8 # did not match, and some other number for other failures.
10 # The first argument is the .config specification file, which contains
11 # desired settings, for example, "CONFIG_NO_HZ=y". For best results,
12 # this should be a full pathname.
14 # Copyright (C) IBM Corporation, 2013
16 # Authors: Paul E. McKenney <paulmck@linux.ibm.com>
18 T
=${TMPDIR-/tmp}/configinit.sh.$$
22 # Capture config spec file.
27 sed -e 's/^\(CONFIG[0-9A-Z_]*\)=.*$/grep -v "^# \1" |/' < $c > $T/u.sh
28 sed -e 's/^\(CONFIG[0-9A-Z_]*=\).*$/grep -v \1 |/' < $c >> $T/u.sh
29 grep '^grep' < $T/u.sh
> $T/upd.sh
30 echo "cat - $c" >> $T/upd.sh
31 if test -z "$TORTURE_TRUST_MAKE"
33 make clean
> $resdir/Make.clean
2>&1
35 make $TORTURE_DEFCONFIG > $resdir/Make.defconfig.out
2>&1
36 mv .config .config.sav
37 sh
$T/upd.sh
< .config.sav
> .config
38 cp .config .config.new
39 yes '' |
make oldconfig
> $resdir/Make.oldconfig.out
2> $resdir/Make.oldconfig.err
41 # verify new config matches specification.
42 configcheck.sh .config
$c