polishing
authorRalph Ronnquist <ralph.ronnquist@gmail.com>
Fri, 9 Jun 2023 14:24:12 +0000 (00:24 +1000)
committerRalph Ronnquist <ralph.ronnquist@gmail.com>
Fri, 9 Jun 2023 14:24:12 +0000 (00:24 +1000)
vm.sh

diff --git a/vm.sh b/vm.sh
index 74274e606fbc6839c9a64d08fae61fbc332e806d..d3f535dbb6eb03ec316d4eddae9a5b38cfd051c8 100755 (executable)
--- a/vm.sh
+++ b/vm.sh
@@ -1,19 +1,20 @@
 #!/bin/bash
 #
-# QEMU setup for trial3 VM
+# 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 [ -n "$EFI" ] ; then
-   BOOT="-bios /usr/share/OVMF/OVMF_CODE.fd"
-else
-    BOOT="-boot menu=on"
-fi
 ARGS=(
     -m 2G -M pc,accel=kvm -cpu host
-    -serial mon:stdio -echr 0x1c
+    -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
 )
 
-qemu-system-x86_64 ${ARGS[@]}
+exec qemu-system-x86_64 ${ARGS[@]}