5 ovmf_code
=/usr
/share
/edk2-ovmf
/x64
/OVMF_CODE.fd
6 ovmf_vars
=/usr
/share
/edk2-ovmf
/x64
/OVMF_VARS.fd
9 if [[ ! -f "${ovmf_code}" ]]; then
10 printf "ERROR: %s is missing, install the edk2-ovmf package." "${ovmf_code}" >&2
13 if [[ ! -f "${ovmf_vars}" ]]; then
14 printf "ERROR: %s is missing, install the edk2-ovmf package." "${ovmf_vars}" >&2
17 if [[ ! -f "${ipxe_image}" ]]; then
18 echo "ERROR: No IPXE image to run provided as first argument." >&2
22 workdir
=$
(mktemp
-d --tmpdir run_ipxe.XXXXXX
)
23 trap 'rm -rf $workdir' EXIT INT TERM QUIT
26 cp "${ovmf_vars}" efivars
27 mkdir
-p .
/fat
/EFI
/Boot
/
28 cp "${ipxe_image}" .
/fat
/EFI
/Boot
/bootx64.efi
30 exec qemu-system-x86_64 \
31 -boot order
=d
,menu
=on
,reboot-timeout
=5000 \
32 -m "size=3072,slots=0,maxmem=$((3072*1024*1024))" \
34 -name ipxe
,process
=ipxe_0 \
35 -device virtio-net-pci
,romfile
=,netdev
=net0 \
36 -netdev user
,ipv4
=on
,id
=net0 \
37 -drive if=pflash
,format
=raw
,unit
=0,readonly=on
,file="${ovmf_code}" \
38 -drive if=pflash
,format
=raw
,unit
=1,file=efivars \
42 -drive if=none
,id
=usb-fat
,format
=raw
,file=fat
:rw
:.
/fat \
43 -device usb-storage
,drive
=usb-fat \