X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;ds=sidebyside;f=vm.sh;h=41f024dae052cdbfd702b031fe4ce3b828ce893f;hb=04a4179aec03d0d93391870953c4b9d39163922e;hp=d3f535dbb6eb03ec316d4eddae9a5b38cfd051c8;hpb=52b051d78ead51fe4ab0513543dbfc619fd6a337;p=rrq%2Ftiniest.git diff --git a/vm.sh b/vm.sh index d3f535d..41f024d 100755 --- a/vm.sh +++ b/vm.sh @@ -2,19 +2,43 @@ # # QEMU setup for trial VM -BOOT="-boot menu=on" -[ -z "$EFI" ] || 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 + 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 - +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 + -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 + $NET ) exec qemu-system-x86_64 ${ARGS[@]}