brintos

brintos / linux-shallow public Read only

0
0
Text · 1.3 KiB · 11f8d23 Raw
54 lines · bash
1#!/bin/bash2# SPDX-License-Identifier: GPL-2.0+3#4# Build a kvm-ready Linux kernel from the tree in the current directory.5#6# Usage: kvm-build.sh config-template resdir7#8# Copyright (C) IBM Corporation, 20119#10# Authors: Paul E. McKenney <paulmck@linux.ibm.com>11 12if test -f "$TORTURE_STOPFILE"13then14	echo "kvm-build.sh early exit due to run STOP request"15	exit 116fi17 18config_template=${1}19if test -z "$config_template" -o ! -f "$config_template" -o ! -r "$config_template"20then21	echo "kvm-build.sh :$config_template: Not a readable file"22	exit 123fi24resdir=${2}25 26T="`mktemp -d ${TMPDIR-/tmp}/kvm-build.sh.XXXXXX`"27trap 'rm -rf $T' 028 29cp ${config_template} $T/config30cat << ___EOF___ >> $T/config31CONFIG_INITRAMFS_SOURCE="$TORTURE_INITRD"32CONFIG_VIRTIO_PCI=y33CONFIG_VIRTIO_CONSOLE=y34___EOF___35 36configinit.sh $T/config $resdir37retval=$?38if test $retval -gt 139then40	exit 241fi42 43# Tell "make" to use double the number of real CPUs on the build system.44ncpus="`getconf _NPROCESSORS_ONLN`"45make -j$((2 * ncpus)) $TORTURE_KMAKE_ARG > $resdir/Make.out 2>&146retval=$?47if test $retval -ne 0 || grep "rcu[^/]*": < $resdir/Make.out | grep -E -q "Stop|Error|error:|warning:" || grep -E -q "Stop|Error|error:" < $resdir/Make.out48then49	echo Kernel build error50	grep -E "Stop|Error|error:|warning:" < $resdir/Make.out51	echo Run aborted.52	exit 353fi54