44 lines · bash
1#!/bin/bash2# SPDX-License-Identifier: GPL-2.0+3#4# Usage: configinit.sh config-spec-file results-dir5#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 config8# did not match, and some other number for other failures.9#10# The first argument is the .config specification file, which contains11# desired settings, for example, "CONFIG_NO_HZ=y". For best results,12# this should be a full pathname.13#14# Copyright (C) IBM Corporation, 201315#16# Authors: Paul E. McKenney <paulmck@linux.ibm.com>17 18T="`mktemp -d ${TMPDIR-/tmp}/configinit.sh.XXXXXX`"19trap 'rm -rf $T' 020 21# Capture config spec file.22 23c=$124resdir=$225 26sed -e 's/^\(CONFIG[0-9A-Z_]*\)=.*$/grep -v "^# \1" |/' < $c > $T/u.sh27sed -e 's/^\(CONFIG[0-9A-Z_]*=\).*$/grep -v \1 |/' < $c >> $T/u.sh28grep '^grep' < $T/u.sh > $T/upd.sh29echo "cat - $c" >> $T/upd.sh30if test -z "$TORTURE_TRUST_MAKE"31then32 make clean > $resdir/Make.clean 2>&133fi34make $TORTURE_KMAKE_ARG $TORTURE_DEFCONFIG > $resdir/Make.defconfig.out 2>&135mv .config .config.sav36sh $T/upd.sh < .config.sav > .config37cp .config .config.new38yes '' | make $TORTURE_KMAKE_ARG oldconfig > $resdir/Make.oldconfig.out 2> $resdir/Make.oldconfig.err39 40# verify new config matches specification.41configcheck.sh .config $c42 43exit 044