3 # QEMU setup for trial VM
6 if [ ${#1} = 1 ] && [ "${N#*$1}" != "$N" ] ; then
10 "use bootimage.raw as harddisk with legacy boot (and boot menu)"
11 "use bootimage.raw as harddisk with UEFI boot"
12 "use tiniest.iso as harddisk with legacy boot (and boot menu)"
13 "use tiniest.iso as harddisk with UEFI boot"
14 "use tiniest.iso as cdrom with legacy boot (and boot menu)"
15 "use tiniest.iso as cdrom with UEFI boot"
16 "use tiniest.iso as USB disk with legacy boot (and boot menu)"
17 "use tiniest.iso as USB disk with UEFI boot"
20 select V in "${VARIANT[@]}" ; do
24 [ -z "$REPLY" ] && exit 0
27 [ $REPLY -ge 3 ] && FILE=tiniest.iso
29 [ $REPLY -ge 5 ] && MEDIA=cdrom
30 [ $REPLY -ge 7 ] && MEDIA=usb
34 DISK2="-drive index=1,format=raw,media=$MEDIA,file=$FILE"
38 -device qemu-xhci,id=xhci
39 -drive if=none,id=stick,format=raw,media=disk,file=${FILE}
40 -device usb-storage,bus=xhci.0,port=1,drive=stick
44 DISK2="-drive index=1,format=raw,media=$MEDIA,file=$FILE"
48 BOOT="-boot menu=on,splash=boot.jpg,splash-time=60000"
49 [ $(( $REPLY % 2 )) -eq 0 ] && BOOT="-bios /usr/share/OVMF/OVMF_CODE.fd"
53 NET="-net nic,model=e1000 -net vde,sock=/run/vde.ctl"
60 [ -e disk.raw ] || dd if=/dev/zero of=disk.raw bs=1G count=0 seek=8
63 -m 2G -M pc,accel=kvm -cpu host -vga qxl
64 -serial mon:stdio -echr 0x1c # Using ^\ as meta character
66 -drive index=0,id=disk,media=disk,format=raw,file=disk.raw
71 echo "${ARGS[*]}" | sed "s/ -/\n -/g"
73 exec qemu-system-x86_64 ${ARGS[@]}