Create iPXE UEFI bootable image for QEMU/Libvirt with custom next-server and filename
Solution 1:
At least on Debian, the iPXE ROM images qemu uses are located at /usr/lib/ipxe
and /usr/lib/ipxe/qemu
, depending on which virtual NIC you're using in your VM.
Download the iPXE source code, make your modifications to it, build the ROM images, and replace the standard images with your customized ones.
Solution 2:
iPXE has more features than the average bootloader, in this case when booting grub, grub will try to load the configuration from the same location as it was started from, however that does not work due to previously mentioned features.
To work around this make sure to build iPXE with correct config, in this case that is CONFIG=qemu
which does #define EFI_DOWNGRADE_UX
(page with some details: https://bugs.launchpad.net/maas/+bug/1789319/comments/16 there is mailing list threads with more details)
Regarding named configs, See https://ipxe.org/appnote/named_config
You can then either build this as a ROM to replace the original, either by replacing the original file, or provide path to ROM at commandline. Other ways is to chain from the original to your new one, or as you do now build a usb device.
I think you can even have it in your target to avoid the manual image build step: make bin-x86_64-efi/ipxe.usb EMBED=chain.ipxe CONFIG=qemu