--- a +++ b/trunk/wharfie/qemu/files/qemu_autorun.sh @@ -0,0 +1,59 @@ +#!/bin/bash +# +# We are running inside of Qemu and use the block devices to +# exchange large amounts of files. Our build jobs are long-term +# jobs, so we just copy the whole data forth and back. While we +# are keeping timestamps and we keep old files inside of a cache +# partition. +# +# We expect the following layout of our block devices, as they +# are passed to Qemu at the command line: +# +# - sda: This is the root partition of the system (read-only for us) +# - sdb: This is also a real partition, which is used for caching +# - sdc: This is our input tar archive (no real partition, so it can't be mounted) +# - sdd: This is our output tar archive. Itself it might contain multiple archives. +# +# Note the drawback of this solution is, that we have maximum limits +# for input and output packets. But those limits can be fully influenced +# by the caller, why it seems acceptable anyway. +# + +echo "#########################################################" +echo "# Wharfie started" +echo "#########################################################" + +sleep 10; + +echo "#########################################################" + +# setup network +dhclient eth0 + +echo "#########################################################" + + +# enable binfmt for all supported architectures +update-binfmts --enable qemu-arm +update-binfmts --enable qemu-armeb +update-binfmts --enable qemu-ppc +echo "#########################################################" + +# mount the cache folder to /build and change into it +[ ! -d /build ] && mkdir /build +mount /dev/sdb1 /build && + cd /build && + + # untar the input into the build folder + tar -xpf /dev/sdc && + + # run make in the build folder + make WHARFIE_MK=wharfie.mk && + + # pack everything, except some fix excludes to output + tar --exclude='*.piling.tar' --exclude='debian_version.mk' --exclude='debian_toolchain.tar' --exclude='debian_toolchain_env.sh' -cf /dev/sdd . + +# shut the VM down +sync +shutdown -P now +