grub4dos icon indicating copy to clipboard operation
grub4dos copied to clipboard

grub4efi BOOTIA32.EFI stopped working with commit ffcc2b7ba612f76bb6da380067553efeb4c2233f

Open pablocool opened this issue 2 years ago • 10 comments

I have Acer netbook with 32bit UEFI. I've been using successfully bootia32.efi from release 2021-01-12-4f0879b. However it missed parttype command so I upgraded to grub4dos-for_UEFI-2021-08-18. Then netbook refused to boot: /EndEntire file path: /ACPI(a0341d0,0)/PCI(0,14)/USB(1,0)/HD(1,800,775800,77e4ab9900000000,1,1)/File(\efi\boot)/File(GRUB4DOS_BOOTIA32.EFI)/EndEntire

I compiled and tested commit by commit from efi branch and discovered that: first not working commit is:

commit ffcc2b7ba612f76bb6da380067553efeb4c2233f
Author: yaya <[email protected]>
Date:   Wed Jun 2 09:39:52 2021 +0800

    . 支持嵌入字库、模块(.mod文件)。(a1ive)
      mkimage.exe -d 目录 -p /efi/grub -o BOOTX64.EFI -O x86_64-efi -c 嵌入菜单 -f 嵌入字库 -m 嵌入模块

last working commit is:

commit 0364b320f7d1a665990013c8fef6d487320d4552
Author: yaya <[email protected]>
Date:   Fri May 28 15:31:23 2021 +0800

    . 改进热键

I tried to find bug in diff but it is not easy. I can help with testing prototypes.

pablocool avatar Aug 30 '21 17:08 pablocool

OK I have found problem. This change is root cause of above issue:

diff --git a/stage2/disk_io.c b/stage2/disk_io.c
index 311fe8c..19d65e6 100644
--- a/stage2/disk_io.c
+++ b/stage2/disk_io.c
@@ -4277,5 +4277,5 @@ grub_efidisk_init (void)  //efidisk初始化
   run_line((char *)"configfile /efi/grub/menu.lst",1);
        run_line((char *)"errorcheck on",1);
 #endif
-       cmain ();
+  return;
 }

pablocool avatar Aug 30 '21 19:08 pablocool

You compile g4e yourself? Need to link the preset menu.

mkimage.exe -d directory -p /efi/grub -o BOOTX64.EFI -O x86_64-efi -c preset_menu.lst

yaya2007 avatar Aug 31 '21 02:08 yaya2007

Yes I compile g4e myself. This is not preset_menu.lst problem. I use ./build script from root directory, so I do not change mkimage command and preset_menu.lst is given in both cases. Somehow this change in stage2/disk_io.c:

- cmain ();
+ return;

breaks something.

I even replaced return with cmain (); in your latest commit and BOOTIA32.EFI started booting. Worth to mention is that this does not apply to BOOTX64.EFI. 64 bit file version boots on 64 bit UEFI laptop with either cmain() or return in that place in disk_io.c file.

Coming back to BOOTIA32.EFI and 32 bit UEFI in my laptop, unfortunately this is not the end of problems. Somehow chainloader command does not work. I have such configuration:

title Boot systemrescuecd-6.0.7 (via GRUB Partition 4)
set ISO=/multiboot/ISOS/systemrescuecd-6.0.7.iso
find --set-root %ISO%
parttype (hd0,3) | set check=
set check=%check:~-5,4%
if "%check%"=="0x00" partnew (hd0,3) 0 0 0
if NOT "%check%"=="0x00" echo ERROR: Fourth partion table is not empty, please delete it if you wish to use this method && pause --wait=5 && configfile /syslinux/menu.lst
partnew (hd0,3) 0x00 %ISO%
map %ISO% (0xff)
map --hook
root (0xff)
chainloader (0xff)

And it just ends up with:

Failed to load virtual partition image.(8000000e)
Failed to load virtual disk image.(0)

Press any key to continue...

This configuration successfully boots with BOOTX64.EFI on 64 bit UEFI laptop. Do you have idea why it refuses to boot on 32 bit UEFI?

pablocool avatar Aug 31 '21 05:08 pablocool

The systemrescuecd-6.0.7 I have does not contain \EFI\BOOT\BOOTIA32.EFI so it does not look like it supports UEFI32?

steve6375 avatar Aug 31 '21 09:08 steve6375

I used the qemu virtual machine to test BOOTIA32.EFI and it started normally.

yaya2007 avatar Aug 31 '21 10:08 yaya2007

The systemrescuecd-6.0.7 I have does not contain \EFI\BOOT\BOOTIA32.EFI so it does not look like it supports UEFI32?

Great point!!! I indeed missed it. I added grub version of BOOTIA32.EFI. But now even 64bit version stopped working (error like above). Should I update ISO file with some special way? I just used Ultra ISO under windows.

When I swap chainloader (0xff) with chainloader /EFI/BOOT/BOOTIA32.EFI then g4d efi boots successfully. But it fails to use grub config from ISO later on. Looks like it is case-sensitive. I mean in conf file there is linux /sysresccd/boot/x86_64/vmlinuz (...) while in fs its is rather /SYSRESCCD/BOOT/X86_64/VMLINUZ (...) When I put commands manually in CLI with proper case then linux eventually boots fine.

I used the qemu virtual machine to test BOOTIA32.EFI and it started normally. May you share example commands you use?

pablocool avatar Aug 31 '21 12:08 pablocool

I also reported issues with UEFI32. It just crashes when chainloading from grub2 now. Also seems to have issues using QEMU and VBOX (worked once in QEMU but then crashed every time after that).

steve6375 avatar Aug 31 '21 17:08 steve6375

Weird, I downloaded debian multiarch iso (bootia32.efi and bootx64.efi in /efi/boot) https://saimei.ftp.acc.umu.se/debian-cd/current/multi-arch/iso-cd/debian-11.0.0-amd64-i386-netinst.iso and chainloaded (chainload (0xff) from grub4dos UEFI just fine. I have no idea what is wrong with systemrescuecd-6.0.7 that I fed with bootia32.efi.

One question. What is difference between bootia32.efi and grubia32.efi? I compiled grub for UEFI and got bootia32.efi.

Edit: This debian iso chainloads even I delete everything from /efi/boot. It must have bootloader somewhere else..

Edit2:

isoinfo.exe -d -i debian-11.0.0-amd64-i386-netinst.iso | grep Bootoff
        Bootoff D05 3333

dd if=debian-11.0.0-amd64-i386-netinst.iso of=debian-11.0.0-amd64-i386-netinst.img count=3333 bs=2048
strings debian-11.0.0-amd64-i386-netinst.img | grep -i grub
(...)
grub,1,Free Software Foundation,grub,2.04,https://www.gnu.org/software/grub/
grub.debian,1,Debian,grub2,2.04-20,https://tracker.debian.org/pkg/grub2
&Debian Secure Boot Signer 2021 - grub20
GRUB    CFG
set prefix=($root)/boot/grub
source $prefix/i386-efi/grub.cfg

that shows there is grub in el torito ISO header in debian ISO, while systemrescuecd is missing it. So I booted grub from that header not from /efi/boot

pablocool avatar Aug 31 '21 21:08 pablocool

chainloader /EFI/BOOT/BOOTIA32.EFI

Chainloading from grub4dos for UEFI to grub4efi also stopped working for me (it hungs infinitely). Looks like something has changed in laptop's EFI NVRAM or something?

pablocool avatar Sep 01 '21 11:09 pablocool

With latest g4d UEFI build all above issues seem to be resolved. I can successfully boot 32bit UEFI laptop with 64bit cpu with systemresucecd with such configs:

title Boot systemrescuecd-6.0.7 (via GRUB Partition 4 and bootia32.efi)
set ISO=/multiboot/ISOS/systemrescuecd-6.0.7.iso
find --set-root %ISO%
parttype (hd0,3) | set check=
set check=%check:~-5,4%
if "%check%"=="0x00" partnew (hd0,3) 0 0 0
if NOT "%check%"=="0x00" echo ERROR: Fourth partion table is not empty, please delete it if you wish to use this method && pause --wait=5 && configfile /syslinux/menu.lst
partnew (hd0,3) 0x00 %ISO%
map %ISO% (0xff)
map --hook
root (0xff)
chainloader /EFI/boot/bootia32.efi
boot
title Boot systemrescue-9.00-i686 (via GRUB Partition 4 and bootia32.efi)
set ISO=/multiboot/ISOS/systemrescue-9.00-i686.iso
find --set-root %ISO%
parttype (hd0,3) | set check=
set check=%check:~-5,4%
if "%check%"=="0x00" partnew (hd0,3) 0 0 0
if NOT "%check%"=="0x00" echo ERROR: Fourth partion table is not empty, please delete it if you wish to use this method && pause --wait=5 && configfile /syslinux/menu.lst
partnew (hd0,3) 0x00 %ISO%
map %ISO% (0xff)
map --hook
root (0xff)
chainloader /EFI/boot/bootia32.efi
boot

I still need other configs for bootx64.efi because chainloader (0xff) still not working with 32 bit uefi. But this is not a big deal. Thank you for fixing this. Issue may be closed.

pablocool avatar Jan 23 '22 15:01 pablocool