Rename build-umlkernel script to build-guestkernel

This commit is contained in:
Reto Buerki 2012-12-07 11:33:27 +01:00 committed by Tobias Brunner
parent 62a277cfae
commit f9df3d06b5
5 changed files with 1873 additions and 101 deletions

File diff suppressed because it is too large Load Diff

View File

@ -14,52 +14,26 @@
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
DIR=`dirname $0`
. $PWD/scripts/function.sh
source $DIR/scripts/function.sh
[ -f $DIR/testing.conf ] || die "!! Configuration file 'testing.conf' not found."
source $DIR/testing.conf
rm -f $LOGFILE
if [ "$#" -eq 0 ]
then
HOSTS=$STRONGSWANHOSTS
else
HOSTS=$*
fi
##########################################################################
# build base image
#
if [ $ENABLE_BUILD_BASEIMAGE = "yes" ]
then
$DIR/scripts/build-baseimage
$PWD/scripts/build-baseimage
fi
##########################################################################
# build the UML kernel based on a vanilla kernel form kernel.org
# and a matching UML patch from user-mode-linux.sourceforge.net
#
if [ $ENABLE_BUILD_UMLKERNEL = "yes" ]
if [ $ENABLE_BUILD_GUESTKERNEL = "yes" ]
then
$DIR/scripts/build-umlkernel
$PWD/scripts/build-guestkernel
fi
##########################################################################
# build a generic UML root file system based on a Gentoo root file system.
# compile and install a specified strongSwan release into the file system.
#
if [ $ENABLE_BUILD_UMLROOTFS = "yes" ]
then
$DIR/scripts/build-umlrootfs
$PWD/scripts/build-umlrootfs
fi
##########################################################################
# Creating the root filesystems for the specified UML instances
#
if [ $ENABLE_BUILD_UMLHOSTFS = "yes" ]
then
$DIR/scripts/build-umlhostfs $HOSTS
$PWD/scripts/build-umlhostfs $HOSTS
fi

View File

@ -0,0 +1,46 @@
#!/bin/bash
. $PWD/scripts/function.sh
echo "Building guest kernel version $KERNELVERSION"
[ -f "$KERNELCONFIG" ] || die "Kernel config $KERNELCONFIG not found"
mkdir -p $BUILDDIR
cd $BUILDDIR
if [ ! -f "$KERNELTARBALL" ]
then
url=ftp://ftp.kernel.org/pub/linux/kernel/v3.x/$KERNELTARBALL
log_action "Downloading $url"
execute "wget -q $url"
fi
if [[ $KERNELPATCH && ! -f "$KERNELPATCH" ]]
then
url=http://download.strongswan.org/uml/$KERNELPATCH
log_action "Downloading $url"
execute "wget -q $url"
fi
log_action "Unpacking kernel"
execute "tar xjf $KERNELTARBALL"
KERNELDIR=$BUILDDIR/$KERNEL
cd $KERNELDIR
if [ $KERNELPATCH ]
then
log_action "Applying kernel patch"
bzcat ../$KERNELPATCH | patch -p1 >>$LOGFILE 2>&1
log_status $?
[ $? -eq 0 ] || exit 1
fi
execute "cp $KERNELCONFIG .config" 0
echo "Creating kernel configuration, you might get prompted for new parameters"
make oldconfig 2>&1 | tee -a $LOGFILE
log_action "Compiling the kernel"
execute "make -j5"

View File

@ -1,55 +0,0 @@
#!/bin/bash
# build an UML kernel based on a vanilla kernel and UML patch
#
# Copyright (C) 2004 Eric Marchionni, Patrik Rayo
# Zuercher Hochschule Winterthur
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
. $PWD/scripts/function.sh
echo "Building guest kernel version $KERNELVERSION"
[ -f "$KERNEL" ] || die "Kernel $KERNEL not found"
[ -f "$KERNELCONFIG" ] || die "Kernel config $KERNELCONFIG not found"
if [ $UMLPATCH ]; then
[ -f "$UMLPATCH" ] || die "Patch $UMLPATCH not found"
fi
mkdir -p $BUILDDIR
cd $BUILDDIR
log_action "Unpacking kernel"
execute "tar xjf $KERNEL"
KERNELDIR=${BUILDDIR}/linux-${KERNELVERSION}
ln -fs linux-${KERNELVERSION} linux
cd $KERNELDIR
if [ $UMLPATCH ]; then
log_action "Applying uml patch"
bzcat $UMLPATCH | patch -p1 >> $LOGFILE 2>&1
log_status $?
fi
execute "cp $KERNELCONFIG .config" 0
echo "!!"
echo "!! Creating kernel configuration, you might get prompted for new parameters!"
echo "!!"
make oldconfig ARCH=um 2>&1 | tee -a $LOGFILE
log_action "Compiling the kernel"
execute "make -j5 linux ARCH=um"
log_action "Copying kernel to '${BUILDDIR}/linux-uml-${KERNELVERSION}'"
execute "mv linux ${BUILDDIR}/linux-uml-${KERNELVERSION}"

View File

@ -1,5 +1,5 @@
#!/bin/bash
# Global configuration file for strongswan UML testing.
# Global configuration file for strongswan integration testing.
#
# Copyright (C) 2004 Eric Marchionni, Patrik Rayo
# Zuercher Hochschule Winterthur
@ -17,18 +17,12 @@
# Root directory of testing
UMLTESTDIR=~/strongswan-testing
# Bzipped kernel sources
# (file extension .tar.bz2 required)
KERNEL=$UMLTESTDIR/linux-3.5.3.tar.bz2
# Extract kernel version
KERNELVERSION=`basename $KERNEL .tar.bz2 | sed -e 's/linux-//'`
# Kernel configuration file
KERNELCONFIG=$UMLTESTDIR/.config-3.5
# Bzipped uml patch for kernel
UMLPATCH=$UMLTESTDIR/ha-3.0.patch.bz2
# Kernel configuration
KERNELVERSION=3.5.3
KERNEL=linux-$KERNELVERSION
KERNELTARBALL=$KERNEL.tar.bz2
KERNELCONFIG=$PWD/config/kernel/config-3.5
KERNELPATCH=ha-3.0.patch.bz2
# strongSwan version used in tests
SWANVERSION=5.0.2dr4
@ -75,7 +69,7 @@ TZUML="Europe/Zurich"
# start-testing scripts
#
ENABLE_BUILD_BASEIMAGE="yes"
ENABLE_BUILD_UMLKERNEL="yes"
ENABLE_BUILD_GUESTKERNEL="yes"
ENABLE_BUILD_UMLROOTFS="yes"
ENABLE_BUILD_UMLHOSTFS="yes"