Eric Radman : a Journal

Verify UEFI/TFTP boot with QEMU and iPXE

Configure Network Bridge

ip link add br0 type bridge
ip address add dev br0 172.16.0.1/24
ip link set dev br0 up
ip tuntap add dev tap0 mode tap
ip link set tap0 master br0

Install/configure TFTP/DHCP

apt install tftpd-hpa isc-dhcp-server

cat <<EOF >/etc/dhcp/dhcpd.conf
subnet 172.16.0.0 netmask 255.255.255.0 {
  next-server 172.16.0.1;
}

host tftptest {
  hardware ethernet 00:16:3e:34:bb:5f;
  fixed-address 172.16.0.10;
  filename "tftptest.efi";
}
EOF

echo 'INTERFACESv4="br0"' > /etc/default/isc-dhcp-server
systemctl restart isc-dhcp-server

Build/test EFI application

sudo apt install gnu-efi build-essential

git clone https://github.com/eradman/tftptest.efi.git
cd tftptest.efi/
make
sudo cp tftptest.efi /srv/tftp/

TFTP boot using QEMU and iPXE

sudo apt install qemu-system-x86

Fetch iPXE Image

cd
curl -O https://boot.ipxe.org/ipxe.iso

Start VM

sudo qemu-system-x86_64 \
    -m 1G \
    -nographic \
    -bios /usr/share/ovmf/OVMF.fd \
    -cdrom ~/ipxe.iso \
    -nic tap,ifname=tap0,model=virtio-net-pci,mac=00:16:3e:34:bb:5f

By removing -cdrom ~/ipxe.iso we can see that EDK II tools do support this operation.