From 8ed98c137321c3f92fb06b58e69aaecf4e531cdc Mon Sep 17 00:00:00 2001 From: Reto Buerki Date: Fri, 7 Dec 2012 17:54:19 +0100 Subject: Switch from raw images to qcow2 format This allows to use minimal copy-on-write clones of the base image as guest images, which in turn saves a lot of disk space. --- testing/scripts/build-umlrootfs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'testing/scripts/build-umlrootfs') diff --git a/testing/scripts/build-umlrootfs b/testing/scripts/build-umlrootfs index cf11844ce..c67e4d557 100755 --- a/testing/scripts/build-umlrootfs +++ b/testing/scripts/build-umlrootfs @@ -1,5 +1,5 @@ #!/bin/bash -# Create UML root filesystem +# Create guest root image # # Copyright (C) 2004 Eric Marchionni, Patrik Rayo # Zuercher Hochschule Winterthur @@ -22,17 +22,24 @@ echo "Building root image" [ -f "$ROOTFS" ] || die "Root image $ROOTFS not found" +load_qemu_nbd + mkdir -p $ROOTFSDIR mkdir -p $LOOPDIR mkdir -p $ROOTFSCOMPILEDIR cd $ROOTFSDIR -BASE=$BUILDDIR/base.img +BASE=$BUILDDIR/base.qcow2 log_action "Creating $BASE" execute "cp $ROOTFS $BASE" -log_action "Mounting base image $BASE" -execute "mount -o loop $BASE $LOOPDIR" +log_action "Connecting base image to NBD device $NBDEV" +execute "qemu-nbd -c $NBDEV $BASE" +sync + +log_action "Mounting $NBDPARTITION to $LOOPDIR" +execute "mount $NBDPARTITION $LOOPDIR" + log_action "Mounting proc filesystem to $LOOPDIR/proc" execute "mount -t proc none $LOOPDIR/proc" @@ -43,6 +50,7 @@ execute "mount -o bind $ROOTFSCOMPILEDIR $LOOPDIR/root/compile" do_on_exit umount $LOOPDIR/root/compile do_on_exit umount $LOOPDIR/proc do_on_exit umount $LOOPDIR +do_on_exit qemu-nbd -d $NBDEV echo "Installing software from source" RECPDIR=$TESTDIR/testing/scripts/recipes -- cgit v1.2.3