diff options
Diffstat (limited to 'test-netboot')
-rwxr-xr-x | test-netboot | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test-netboot b/test-netboot new file mode 100755 index 000000000000..95784be935cf --- /dev/null +++ b/test-netboot @@ -0,0 +1,36 @@ +#!/bin/bash +set -euo pipefail + +OVMFDIR=/usr/share/ovmf +OVMF_CODE=${OVMFDIR}/ovmf_code_x64.bin +OVMF_VARS=${OVMFDIR}/ovmf_vars_x64.bin +IPXE_IMAGE=/usr/share/ipxe-netboot/ipxe.efi + +if [[ ! -f ${OVMF_CODE} ]]; then + echo "ERROR: ${OVMF_CODE} is missing, install the ovmf package." >&2 + exit 1 +fi +if [[ ! -f ${OVMF_VARS} ]]; then + echo "ERROR: ${OVMF_VARS} is missing, install the ovmf package." >&2 + exit 1 +fi +if [[ ! -f ${IPXE_IMAGE} ]]; then + echo "ERROR: ${IPXE_IMAGE} is missing." >&2 + exit 1 +fi + +WORKDIR=$(mktemp -d --tmpdir netboot.XXXXXX) +cd "${WORKDIR}" + +cp "${OVMF_VARS}" efivars +mkdir -p ./fat/EFI/Boot/ +cp "${IPXE_IMAGE}" ./fat/EFI/Boot/bootx64.efi + +exec qemu-system-x86_64 \ + -enable-kvm \ + -device virtio-net-pci,netdev=n -netdev user,ipv4,id=n \ + -m 2G \ + -drive if=pflash,format=raw,readonly,file="${OVMF_CODE}" \ + -drive if=pflash,format=raw,file=efivars \ + -usb -usbdevice disk:format=raw:fat:./fat \ + "$@" |