1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 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 |