chenall/grub4dos

grub4efi: wimboot does not load

steve6375 opened this issue · 10 comments

Until grub4efi can use wimboot, I cannot really use grub4efi for easy2boot because wimboot is the only way that works well when booting WinPE and Windows Install ISOs and wim files.
image

Is it possible to either make wimboot compatible with grub4efi, or make grub4efi compatible with wimboot?

I am reluctant to spend any time on testing and reporting grub4efi issues until it can use wimboot.

a1ive commented

See ipxe/wimboot#28

With the syslinux-6.03 prebuilt binaries I am able to get as far as attempting to load the modified wimboot. It fails to execute with syslinux.efi reporting the error Cannot relocate kernel, bailing out. This error arises because wimboot cannot be loaded at its preferred address (around 0x20000 in base memory), presumably because something else is already occupying that memory.
I have verified that the same failure arises with a version of wimboot patched exactly as per https://lists.ipxe.org/pipermail/ipxe-devel/2018-November/006338.html
It would potentially be possible to add support for self-relocation, which would allow syslinux.efi to load wimboot at an alternative address. However, there is no way to mark the image as relocatable for UEFI without also marking it as relocatable for BIOS: we would therefore have to also support relocation as a BIOS bzImage.
This seems like a reasonably high effort simply in order to maintain compatibility with the effectively unsupported EFI version of syslinux. Unless there's a compelling reason to do otherwise, I would therefore suggest that you replace your syslinux boot flow with iPXE.

syslinux? sorry , I don't understand?

Basically, WimBoot needs patching, but the patches already in place in the community don't seem to work for the new version of WimBoot, I remember that the solution provided by a1ive seems to be to provide a module for Grub2 to implement WimBoot's functionality, but Grub4DOS is not designed for modularity.

a1ive commented

Basically, WimBoot needs patching, but the patches already in place in the community don't seem to work for the new version of WimBoot

These patches don't work...
If the firmware supports CSM, then the wimboot image needs to be relocated.
@sTeeLM submitted a patch (ipxe/wimboot#34), but I tested it and it doesn't seem to be working properly.

It looks terrible.

a1ive commented

@steve6375
I have added experimental support for wimboot, you can test it as follows:

title Wimboot
find --set-root /EFI/grub/wimboot | set x=
kernel /EFI/grub/wimboot
find --set-root /winpe.wim
initrd @bootmgfw.efi=%x%/EFI/grub/bootmgfw.efi
initrd @bcd=%x%/EFI/grub/bcd
initrd @boot.sdi=%x%/EFI/grub/boot.sdi
initrd @wgl4_boot.ttf=%x%/EFI/grub/wgl4_boot.ttf
initrd @aaaa.bat=%x%/EFI/grub/start.bat
initrd @boot.wim=/winpe.wim

This is the BCD file I used for testing:
BCD.zip
start.bat:

@echo off
echo hello world
pause

1

@a1ive Sorry for delay. I haven't tested wimboot yet, as I have found an issue with the map command

map --unmap=0:4 seems to cause a hang
also some other drive numbers such as 0xff - this has prevented E2B menu from displaying

Is this a bug in grub4efi?

a1ive commented

@a1ive Sorry for delay. I haven't tested wimboot yet, as I have found an issue with the map command

map --unmap=0:4 seems to cause a hang also some other drive numbers such as 0xff - this has prevented E2B menu from displaying

Is this a bug in grub4efi?

I am not very familiar with the usage of map. Please open a new issue and ask @yaya2007 .
AAs far as I know, --unmap can only unmount virtual devices created by GRUB.

@a1ive
A quick test result show that.
wimboot work fine from USB and CD but it doesn't work fine from virtual cd drive
map command can't list directories if memory more thane 2GB
so it doesn't work from ISO if memory more thane 2GB
I open a new issue here
#405

Test using the grub4efi version you suggested and standard MS Win10 ISO.
The grub4efi map command fails on first attempt but then works if run the menu entry for 2nd time.

title WINDOWS 10 grub4efi and wimboot test from ISO (WORKS)
graphicsmode -1 1024
clear
map /_ISO/WINDOWS/WIN10/Win10_20H2_v2_EnglishInternational_x64.iso (0xff)
kernel /wimboot_g4efi
root (0xff)
#minimum for MS Windows Install ISO - specify BCD and boot.wim
initrd @bcd=/EFI/MICROSOFT/BOOT/BCD
initrd @boot.wim=/sources/boot.wim

This boots and runs setup (though of course install.wim is not found),

The latest beta of grub4efi crashes as soon as wimboot tries to load wim file though,,, :-(