I managed to UEFI-boot from grub2 using wimboot by using iPXE as follows:
1. Use a FAT32 partitioned disk (cannot be NTFS??) - I used a USB stick under VBox+VMUB (which will appear as a hard disk)
\ipxe.efi
\boot.ipxe
\wimboot
\win\bcd
\win\boot.sdi
\win\boot.wim
2. Boot to grub2 via UEFI
3. run chainloader /ipxe.efi and then type boot - iPXE will run - press Ctrl-B
IMPORTANT: Wait for the SECOND Ctrl+B prompt before pressing Ctrl+B - if you press Ctrl+B on the first prompt the boot.ipxe script will give a 'Could not boot: No such device' error. This was driving me crazy because a few times wimboot would work but most times it wouldn't because I was using the first Ctrl+B break point! It took me hours to figure out why it was only occasionally working!
[Edit: adding ifopen to the boot.ipxe file fixes the issue of having to wait for the 2nd ctrl+B prompt! Apparently this process will only work if a NIC is present in the system]
4. type chain file:boot.ipxe
boot.ipxe contains:
#!ipxe
ifopen
cpuid --ext 29 && set arch amd64 || set arch x86
kernel file:/wimboot
initrd file:/win/bcd BCD
initrd file:/win/boot.sdi boot.sdi
initrd file:/win/boot.wim boot.wim
boot
I confirmed that WinPE was running in UEFI-mode.
I am not sure it needs arch to be set, it seems to work without it.
I haven't investigated if it is possible to automate it further yet. Just thought I would share as I was so pleased to finally work out why it was so temperamental!
Edited by steve6375, 18 March 2019 - 12:55 PM.