qemu-amd64.sh (1005B)
1 #!/bin/sh 2 3 # NOTE: replace this with the path to a downloaded OVMF image 4 FIRMWARE="/usr/share/qemu/edk2-x86_64-code.fd" 5 6 EFI_CODE="$(dirname $1)/uefi-amd64-code.fd" 7 EFI_VARS="$(dirname $1)/uefi-amd64-vars.fd" 8 9 set -e 10 11 if [ ! -f $EFI_CODE ]; then 12 dd if=$FIRMWARE of=$EFI_CODE conv=notrunc status=none 13 fi 14 15 if [ ! -f $EFI_VARS ]; then 16 dd if=/dev/zero of=$EFI_VARS bs=1M count=4 status=none 17 fi 18 19 qemu-system-x86_64 \ 20 -machine q35 \ 21 -cpu max \ 22 -m 128M \ 23 -smp sockets=1,cpus=2 \ 24 -drive if=pflash,format=raw,unit=0,file=$EFI_CODE,readonly=on \ 25 -drive if=pflash,format=raw,unit=1,file=$EFI_VARS \ 26 -drive if=none,format=raw,id=disk0,file="$1" \ 27 -device nvme,serial=12345678,drive=disk0 \ 28 -net none \ 29 -nographic 30 31 #-chardev stdio,id=char0,logfile="serial.log",signal=off \ 32 #-serial chardev:char0 \ 33 34 ## alternative disk controllers: 35 36 ## ahci 37 # -device ahci,id=ahci \ 38 # -device ide-hd,drive=disk0,bus=ahci.0 \ 39 40 ## ide 41 # -device ide-hd,drive=disk0,bus=ide.0 \ 42 43 ## virtio 44 # -device virtio-blk,drive=disk0 \