Tested combinations.
[rrq/tiniest.git] / vm.sh
diff --git a/vm.sh b/vm.sh
index d3f535dbb6eb03ec316d4eddae9a5b38cfd051c8..f6304aa4dcaa4e9d59460c2a5aa4dc0063bbf395 100755 (executable)
--- a/vm.sh
+++ b/vm.sh
@@ -2,19 +2,32 @@
 #
 # QEMU setup for trial VM
 
-BOOT="-boot menu=on"
-[ -z "$EFI" ] || BOOT="-bios /usr/share/OVMF/OVMF_CODE.fd"
-
-[ -d disk.raw ] || dd if=/dev/zero of=disk.raw bs=1G count=0 seek=8
+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
+    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 
     
+[ -d disk.raw ] || dd if=/dev/zero of=disk.raw bs=1G count=0 seek=8
 
 ARGS=(
-    -m 2G -M pc,accel=kvm -cpu host
+    -m 2G -M pc,accel=kvm -cpu host -vga qxl
     -serial mon:stdio -echr 0x1c # Using ^\ as meta character
-    -vga qxl
     $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
 )
 
 exec qemu-system-x86_64 ${ARGS[@]}