X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=vm.sh;h=41f024dae052cdbfd702b031fe4ce3b828ce893f;hb=04a4179aec03d0d93391870953c4b9d39163922e;hp=74274e606fbc6839c9a64d08fae61fbc332e806d;hpb=4cacdc777c1fa8f8ddae16f3f100de6a3829cab7;p=rrq%2Ftiniest.git diff --git a/vm.sh b/vm.sh index 74274e6..41f024d 100755 --- a/vm.sh +++ b/vm.sh @@ -1,19 +1,44 @@ #!/bin/bash # -# QEMU setup for trial3 VM +# QEMU setup for trial VM -if [ -n "$EFI" ] ; then - BOOT="-bios /usr/share/OVMF/OVMF_CODE.fd" +if [ -z "$ISO" ] ; then + if [ -z "$EFI" ] ; then + BOOT="-boot menu=on" + DISK2="-drive index=1,id=boot,media=disk,format=raw,file=bootimage.raw" + else + BOOT="-bios /usr/share/OVMF/OVMF_CODE.fd" + DISK2="-drive index=1,id=boot,media=disk,format=raw,file=bootimage.raw" + fi else - BOOT="-boot menu=on" -fi + if [ -z "$EFI" ] ; then + BOOT="-boot menu=on" + DISK2="-drive index=1,id=boot,media=cdrom,format=raw,file=tiniest.iso" + else + BOOT="-bios /usr/share/OVMF/OVMF_CODE.fd" + DISK2="-drive index=1,id=boot,media=disk,format=raw,file=tiniest.iso" + fi +fi + +case "$NET" in + vde) + #NET="-net nic,macaddr=06:7f:57:5e:c8:92 -net vde,sock=/run/vde.ctl" + NET="-net nic,model=e1000 -net vde,sock=/run/vde.ctl" + ;; + *) + NET= + ;; +esac + +[ -e disk.raw ] || dd if=/dev/zero of=disk.raw bs=1G count=0 seek=8 + ARGS=( - -m 2G -M pc,accel=kvm -cpu host - -serial mon:stdio -echr 0x1c - -vga qxl + -m 2G -M pc,accel=kvm -cpu host -vga qxl + -serial mon:stdio -echr 0x1c # Using ^\ as meta character $BOOT -drive index=0,id=disk,media=disk,format=raw,file=disk.raw - -drive index=1,id=boot,media=disk,format=raw,file=bootimage.raw + $DISK2 + $NET ) -qemu-system-x86_64 ${ARGS[@]} +exec qemu-system-x86_64 ${ARGS[@]}