3 # QEMU setup for trial VM
5 ISO=${ISO:-tiniest.iso}
8 if [ ${#1} = 1 ] && [ "${N#*$1}" != "$N" ] ; then
12 "use bootimage.raw as harddisk with legacy boot (and boot menu)"
13 "use bootimage.raw as harddisk with UEFI boot"
14 "use ${ISO} as harddisk with legacy boot (and boot menu)"
15 "use ${ISO} as harddisk with UEFI boot"
16 "use ${ISO} as cdrom with legacy boot (and boot menu)"
17 "use ${ISO} as cdrom with UEFI boot"
18 "use ${ISO} as USB disk with legacy boot (and boot menu)"
19 "use ${ISO} as USB disk with UEFI boot"
22 select V in "${VARIANT[@]}" ; do
26 [ -z "$REPLY" ] && exit 0
29 [ $REPLY -ge 3 ] && FILE=${ISO}
31 [ $REPLY -ge 5 ] && MEDIA=cdrom
32 [ $REPLY -ge 7 ] && MEDIA=usb
36 DISK2="-drive index=1,format=raw,media=$MEDIA,file=$FILE"
40 -device qemu-xhci,id=xhci
41 -drive if=none,id=stick,format=raw,media=disk,file=${FILE}
42 -device usb-storage,bus=xhci.0,port=1,drive=stick
46 DISK2="-drive index=1,format=raw,media=$MEDIA,file=$FILE"
50 BOOT="-boot menu=on,splash=boot.jpg,splash-time=60000"
51 [ $(( $REPLY % 2 )) -eq 0 ] && BOOT="-bios /usr/share/OVMF/OVMF_CODE.fd"
55 NET="-net nic,model=e1000 -net vde,sock=/run/vde.ctl"
62 [ -e disk.raw ] || dd if=/dev/zero of=disk.raw bs=1G count=0 seek=8
65 -m 2G -M pc,accel=kvm -cpu host -vga qxl
66 -serial mon:stdio -echr 0x1c # Using ^\ as meta character
68 -drive index=0,id=disk,media=disk,format=raw,file=disk.raw
73 echo "${ARGS[*]}" | sed "s/ -/\n -/g"
75 qemu-system-x86_64 ${ARGS[@]}
76 tput reset # EFI boot messes up the terminal