Skip to content
Snippets Groups Projects
Commit 91993945 authored by Sébastien Marie's avatar Sébastien Marie
Browse files

extend QEMU image management

- allow QEMU name to have subdirectory inside (replace `/` by `__` in
  the filename)
- add a new code path for plain qcow2 image (for efficient bandwidth
  usage, the qcow2 is expected to use compressed qcow2 format)
- move freebsd image to explicitly download the gzipped QEMU
parent 958a3d02
No related branches found
No related tags found
No related merge requests found
...@@ -8,6 +8,6 @@ RUN apt-get install -y --no-install-recommends \ ...@@ -8,6 +8,6 @@ RUN apt-get install -y --no-install-recommends \
ENTRYPOINT ["sh"] ENTRYPOINT ["sh"]
ENV PATH=$PATH:/rust/bin \ ENV PATH=$PATH:/rust/bin \
QEMU=freebsd.qcow2 \ QEMU=freebsd.qcow2.gz \
CAN_CROSS=1 \ CAN_CROSS=1 \
CARGO_TARGET_X86_64_UNKNOWN_FREEBSD_LINKER=x86_64-unknown-freebsd10-gcc CARGO_TARGET_X86_64_UNKNOWN_FREEBSD_LINKER=x86_64-unknown-freebsd10-gcc
...@@ -16,9 +16,21 @@ TARGET=$1 ...@@ -16,9 +16,21 @@ TARGET=$1
if [ "$QEMU" != "" ]; then if [ "$QEMU" != "" ]; then
tmpdir=/tmp/qemu-img-creation tmpdir=/tmp/qemu-img-creation
mkdir -p $tmpdir mkdir -p $tmpdir
if [ ! -f $tmpdir/$QEMU ]; then
curl https://people.mozilla.org/~acrichton/libc-test/qemu/$QEMU.gz | \ if [ -z "${QEMU#*.gz}" ]; then
gunzip -d > $tmpdir/$QEMU # image is .gz : download and uncompress it
qemufile=$(echo ${QEMU%.gz} | sed 's/\//__/g')
if [ ! -f $tmpdir/$qemufile ]; then
curl https://people.mozilla.org/~acrichton/libc-test/qemu/$QEMU | \
gunzip -d > $tmpdir/$qemufile
fi
else
# plain qcow2 image: just download it
qemufile=$(echo ${QEMU} | sed 's/\//__/g')
if [ ! -f $tmpdir/$qemufile ]; then
curl https://people.mozilla.org/~acrichton/libc-test/qemu/$QEMU \
> $tmpdir/$qemufile
fi
fi fi
# Create a mount a fresh new filesystem image that we'll later pass to QEMU. # Create a mount a fresh new filesystem image that we'll later pass to QEMU.
...@@ -80,7 +92,7 @@ if [ "$QEMU" != "" ]; then ...@@ -80,7 +92,7 @@ if [ "$QEMU" != "" ]; then
$program \ $program \
-m 1024 \ -m 1024 \
-snapshot \ -snapshot \
-drive if=virtio,file=$tmpdir/$QEMU \ -drive if=virtio,file=$tmpdir/$qemufile \
-drive if=virtio,file=$tmpdir/libc-test.img \ -drive if=virtio,file=$tmpdir/libc-test.img \
-net nic,model=virtio \ -net nic,model=virtio \
-net user \ -net user \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment