162306a36Sopenharmony_ci#!/bin/bash 262306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0+ 362306a36Sopenharmony_ci# 462306a36Sopenharmony_ci# Usage: configinit.sh config-spec-file results-dir 562306a36Sopenharmony_ci# 662306a36Sopenharmony_ci# Create a .config file from the spec file. Run from the kernel source tree. 762306a36Sopenharmony_ci# Exits with 0 if all went well, with 1 if all went well but the config 862306a36Sopenharmony_ci# did not match, and some other number for other failures. 962306a36Sopenharmony_ci# 1062306a36Sopenharmony_ci# The first argument is the .config specification file, which contains 1162306a36Sopenharmony_ci# desired settings, for example, "CONFIG_NO_HZ=y". For best results, 1262306a36Sopenharmony_ci# this should be a full pathname. 1362306a36Sopenharmony_ci# 1462306a36Sopenharmony_ci# Copyright (C) IBM Corporation, 2013 1562306a36Sopenharmony_ci# 1662306a36Sopenharmony_ci# Authors: Paul E. McKenney <paulmck@linux.ibm.com> 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ciT="`mktemp -d ${TMPDIR-/tmp}/configinit.sh.XXXXXX`" 1962306a36Sopenharmony_citrap 'rm -rf $T' 0 2062306a36Sopenharmony_ci 2162306a36Sopenharmony_ci# Capture config spec file. 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_cic=$1 2462306a36Sopenharmony_ciresdir=$2 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_cised -e 's/^\(CONFIG[0-9A-Z_]*\)=.*$/grep -v "^# \1" |/' < $c > $T/u.sh 2762306a36Sopenharmony_cised -e 's/^\(CONFIG[0-9A-Z_]*=\).*$/grep -v \1 |/' < $c >> $T/u.sh 2862306a36Sopenharmony_cigrep '^grep' < $T/u.sh > $T/upd.sh 2962306a36Sopenharmony_ciecho "cat - $c" >> $T/upd.sh 3062306a36Sopenharmony_ciif test -z "$TORTURE_TRUST_MAKE" 3162306a36Sopenharmony_cithen 3262306a36Sopenharmony_ci make clean > $resdir/Make.clean 2>&1 3362306a36Sopenharmony_cifi 3462306a36Sopenharmony_cimake $TORTURE_KMAKE_ARG $TORTURE_DEFCONFIG > $resdir/Make.defconfig.out 2>&1 3562306a36Sopenharmony_cimv .config .config.sav 3662306a36Sopenharmony_cish $T/upd.sh < .config.sav > .config 3762306a36Sopenharmony_cicp .config .config.new 3862306a36Sopenharmony_ciyes '' | make $TORTURE_KMAKE_ARG oldconfig > $resdir/Make.oldconfig.out 2> $resdir/Make.oldconfig.err 3962306a36Sopenharmony_ci 4062306a36Sopenharmony_ci# verify new config matches specification. 4162306a36Sopenharmony_ciconfigcheck.sh .config $c 4262306a36Sopenharmony_ci 4362306a36Sopenharmony_ciexit 0 44