[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v4 05/11] osstest: add script for building custom mfsBSD images
In order to test FreeBSD HEAD we need to build a mfsBSD installer and sets based on the version that we want to test. This patch adds support for building such mfsBSD image and sets. In order to build the images sources from two different repositories are needed. The first ones of course are the FreeBSD sources which can be fetched from the official github mirror at: https://github.com/freebsd/freebsd.git And the mfsBSD sources which can be downloaded from: https://github.com/mmatuska/mfsbsd.git We would need to have a local copy of them in order to have a push gate like we do for Linux, Qemu or SeaBIOS. The workflow of this would be: 1. Setup a FreeBSD host using a RELEASE image (10.1 right now). 2. Fetch upstream FreeBSD sources and compile a fresh FreeBSD world + kernel. 3. Generate a mfsBSD image using the output from the FreeBSD build process. 4. Stash all the resulting build files (MANIFEST, kernel.txz, base.txz and mfsbsd.img). 5. Use the newly created mfsBSD image in order to boot and the uploaded install sets with zfsinstall. Signed-off-by: Roger Pau Monnà <roger.pau@xxxxxxxxxx> Cc: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx> Cc: Ian Campbell <ian.campbell@xxxxxxxxxx> --- ts-freebsd-create-mfsbsd | 140 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100755 ts-freebsd-create-mfsbsd diff --git a/ts-freebsd-create-mfsbsd b/ts-freebsd-create-mfsbsd new file mode 100755 index 0000000..561766f --- /dev/null +++ b/ts-freebsd-create-mfsbsd @@ -0,0 +1,140 @@ +#!/usr/bin/perl -w +# This is part of "osstest", an automated testing framework for Xen. +# Copyright (C) 2009-2014 Citrix Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +use strict qw(vars); +use DBI; +use POSIX; + +use Osstest; +use Osstest::TestSupport; +use Osstest::BuildSupport; + +tsreadconfig(); +selectbuildhost(\@ARGV); +builddirsprops(); + +sub pkg_install { + + logm("Installing git"); + target_cmd_root($ho, <<END, 1000); + set -e + export ASSUME_ALWAYS_YES="YES" + pkg install -y git +END +} + +sub build_freebsd { + + # Since the build processes requires root access, we need to remove + # the folder as root also. + target_cmd_root($ho, <<END, 2400); + chflags -R noschg $builddir/freebsd + rm -rf $builddir/freebsd +END + + logm("Fetching FreeBSD sources"); + build_clone($ho, 'freebsd', $builddir, 'freebsd'); + + logm("Building FreeBSD world"); + target_cmd_root($ho, <<END, 1000); + set -e + chflags -R noschg /usr/obj + rm -rf /usr/obj/* + chmod 777 /usr/obj +END + + target_cmd_build($ho, 9000, $builddir, <<END); + rm -rf build-ok-stamp + cd freebsd + (make $makeflags buildworld 2>&1 && touch ../build-ok-stamp) |tee ../log-buildworld + test -f ../build-ok-stamp + echo ok. +END + + logm("Building FreeBSD kernel"); + target_cmd_build($ho, 9000, $builddir, <<END); + rm -rf build-ok-stamp + cd freebsd + (make $makeflags buildkernel 2>&1 && touch ../build-ok-stamp) |tee ../log-buildkernel + test -f ../build-ok-stamp + echo ok. +END + + logm("Packing release files"); + # Needs to be done as root... + target_cmd_root($ho, <<END, 2400); + cd $builddir + rm -rf build-ok-stamp + cd freebsd/release + (make ftp 2>&1 && touch ../../build-ok-stamp) |tee ../../log-release + test -f ../../build-ok-stamp + echo ok. +END +} + +sub build_mfsbsd { + + # Since the build processes requires root access, we need to remove + # the folder as root also. + target_cmd_root($ho, <<END, 1000); + chflags -R noschg $builddir/mfsbsd + rm -rf $builddir/mfsbsd +END + + logm("Fetching mfsBSD sources"); + build_clone($ho, 'mfsbsd', $builddir, 'mfsbsd'); + target_cmd_build($ho, 100, $builddir, <<END); + set -e + cd mfsbsd + printf "%s" "-Dh" > conf/boot.config + cp conf/loader.conf.sample conf/loader.conf + cp conf/ttys.sample conf/ttys + sed -i .bak 's/std.[^"]*/std.$c{Baud}/' conf/ttys + cat <<ENDB >> conf/loader.conf +mfsbsd.rootpw="root" +boot_multicons="YES" +boot_serial="YES" +comconsole_speed="$c{Baud}" +console="comconsole,vidconsole" +boot_verbose="YES" +ENDB +END + + target_cmd_root($ho, <<END, 2400); + cd $builddir + rm -rf build-ok-stamp + cd mfsbsd + (make BASE=../freebsd/release/ftp PKG_STATIC=`which pkg-static` RELEASE="HEAD" 2>&1 && touch ../build-ok-stamp) |tee ../log-mfsbsd +END +} + +sub copy_sets { + + built_stash_file($ho, $builddir, 'kernel.txz', + 'freebsd/release/ftp/kernel.txz'); + built_stash_file($ho, $builddir, 'base.txz', + 'freebsd/release/ftp/base.txz'); + built_stash_file($ho, $builddir, 'MANIFEST', + 'freebsd/release/ftp/MANIFEST'); + built_stash_file($ho, $builddir, 'mfsbsd.img', + 'mfsbsd/mfsbsd-HEAD-amd64.img'); +} + +pkg_install(); +build_freebsd(); +build_mfsbsd(); +copy_sets(); -- 1.9.3 (Apple Git-50) _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |