| .. | .. |
|---|
| 1 | 1 | #!/bin/bash |
|---|
| 2 | +# SPDX-License-Identifier: GPL-2.0+ |
|---|
| 2 | 3 | # |
|---|
| 3 | | -# Usage: configinit.sh config-spec-file build-output-dir results-dir |
|---|
| 4 | +# Usage: configinit.sh config-spec-file results-dir |
|---|
| 4 | 5 | # |
|---|
| 5 | 6 | # Create a .config file from the spec file. Run from the kernel source tree. |
|---|
| 6 | 7 | # Exits with 0 if all went well, with 1 if all went well but the config |
|---|
| .. | .. |
|---|
| 10 | 11 | # desired settings, for example, "CONFIG_NO_HZ=y". For best results, |
|---|
| 11 | 12 | # this should be a full pathname. |
|---|
| 12 | 13 | # |
|---|
| 13 | | -# The second argument is a optional path to a build output directory, |
|---|
| 14 | | -# for example, "O=/tmp/foo". If this argument is omitted, the .config |
|---|
| 15 | | -# file will be generated directly in the current directory. |
|---|
| 16 | | -# |
|---|
| 17 | | -# This program is free software; you can redistribute it and/or modify |
|---|
| 18 | | -# it under the terms of the GNU General Public License as published by |
|---|
| 19 | | -# the Free Software Foundation; either version 2 of the License, or |
|---|
| 20 | | -# (at your option) any later version. |
|---|
| 21 | | -# |
|---|
| 22 | | -# This program is distributed in the hope that it will be useful, |
|---|
| 23 | | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 24 | | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 25 | | -# GNU General Public License for more details. |
|---|
| 26 | | -# |
|---|
| 27 | | -# You should have received a copy of the GNU General Public License |
|---|
| 28 | | -# along with this program; if not, you can access it online at |
|---|
| 29 | | -# http://www.gnu.org/licenses/gpl-2.0.html. |
|---|
| 30 | | -# |
|---|
| 31 | 14 | # Copyright (C) IBM Corporation, 2013 |
|---|
| 32 | 15 | # |
|---|
| 33 | | -# Authors: Paul E. McKenney <paulmck@linux.vnet.ibm.com> |
|---|
| 16 | +# Authors: Paul E. McKenney <paulmck@linux.ibm.com> |
|---|
| 34 | 17 | |
|---|
| 35 | 18 | T=${TMPDIR-/tmp}/configinit.sh.$$ |
|---|
| 36 | 19 | trap 'rm -rf $T' 0 |
|---|
| .. | .. |
|---|
| 39 | 22 | # Capture config spec file. |
|---|
| 40 | 23 | |
|---|
| 41 | 24 | c=$1 |
|---|
| 42 | | -buildloc=$2 |
|---|
| 43 | | -resdir=$3 |
|---|
| 44 | | -builddir= |
|---|
| 45 | | -if echo $buildloc | grep -q '^O=' |
|---|
| 46 | | -then |
|---|
| 47 | | - builddir=`echo $buildloc | sed -e 's/^O=//'` |
|---|
| 48 | | - if test ! -d $builddir |
|---|
| 49 | | - then |
|---|
| 50 | | - mkdir $builddir |
|---|
| 51 | | - fi |
|---|
| 52 | | -else |
|---|
| 53 | | - echo Bad build directory: \"$buildloc\" |
|---|
| 54 | | - exit 2 |
|---|
| 55 | | -fi |
|---|
| 25 | +resdir=$2 |
|---|
| 56 | 26 | |
|---|
| 57 | 27 | sed -e 's/^\(CONFIG[0-9A-Z_]*\)=.*$/grep -v "^# \1" |/' < $c > $T/u.sh |
|---|
| 58 | 28 | sed -e 's/^\(CONFIG[0-9A-Z_]*=\).*$/grep -v \1 |/' < $c >> $T/u.sh |
|---|
| 59 | 29 | grep '^grep' < $T/u.sh > $T/upd.sh |
|---|
| 60 | 30 | echo "cat - $c" >> $T/upd.sh |
|---|
| 61 | | -make mrproper |
|---|
| 62 | | -make $buildloc distclean > $resdir/Make.distclean 2>&1 |
|---|
| 63 | | -make $buildloc $TORTURE_DEFCONFIG > $resdir/Make.defconfig.out 2>&1 |
|---|
| 64 | | -mv $builddir/.config $builddir/.config.sav |
|---|
| 65 | | -sh $T/upd.sh < $builddir/.config.sav > $builddir/.config |
|---|
| 66 | | -cp $builddir/.config $builddir/.config.new |
|---|
| 67 | | -yes '' | make $buildloc oldconfig > $resdir/Make.oldconfig.out 2> $resdir/Make.oldconfig.err |
|---|
| 31 | +if test -z "$TORTURE_TRUST_MAKE" |
|---|
| 32 | +then |
|---|
| 33 | + make clean > $resdir/Make.clean 2>&1 |
|---|
| 34 | +fi |
|---|
| 35 | +make $TORTURE_KMAKE_ARG $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 $TORTURE_KMAKE_ARG oldconfig > $resdir/Make.oldconfig.out 2> $resdir/Make.oldconfig.err |
|---|
| 68 | 40 | |
|---|
| 69 | 41 | # verify new config matches specification. |
|---|
| 70 | | -configcheck.sh $builddir/.config $c |
|---|
| 42 | +configcheck.sh .config $c |
|---|
| 71 | 43 | |
|---|
| 72 | 44 | exit 0 |
|---|