Jump to content











Photo
- - - - -

GRUB4DOS for UEFI


  • Please log in to reply
421 replies to this topic

#301 alacran

alacran

    Platinum Member

  • .script developer
  • 2710 posts
  •  
    Mexico

Posted 19 June 2021 - 10:41 PM

A Virtual Machine adds an unnecessary new layer of complexity to the usual procedure, but to try to fix your issue, please try the following:

  • Revert back all changes
  • Boot your 10 OS in UEFI
  • Make sure your (UEFI) menu.lst is located here: \EFI\grub\menu.lst
  • Run BootIce and open UEFI Tab, there you will be able to see the actual predefined boot file used by the UEFI firmware of the virtual machine (this info is stored on its NVRAM).
  • Now make the renaming and addition of files in  accordance with the info you got from BootIce UEFI Tab.
  • Edit your menu.lst as required see following quote of my menu.lst as a guide,  NOTE: It has to be UTF-8 without BOM (use Notepad++ for this).
  • Reboot and all should work fine now.

JFYI: On same UEFI BootIce Tab you can edit the actual values, or add additional boot options but this may require to use the respective F key (usually available on real PCs), doing this is very usefull for our USB devices.

 

menu.lst

 

title Windows EFI BootManager - chainloader /EFI/Microsoft/Boot/bootmgfw.efi
find --set-root /EFI/Microsoft/Boot/bootmgfw.efi
chainloader /EFI/Microsoft/Boot/bootmgfw.efi

title Windows EFI BootManager - chainloader /EFI/Boot/bootx64_win.efi
find --set-root /EFI/Boot/bootx64_win.efi
chainloader /EFI/Boot/bootx64_win.efi
 

 

Hope this can help you to solve the issue.

 

EDIT: I'm using so far G4E Build 2021-02-10, haven't updated yet to the last version.

 

alacran


  • Tokener likes this

#302 alacran

alacran

    Platinum Member

  • .script developer
  • 2710 posts
  •  
    Mexico

Posted 19 June 2021 - 11:01 PM

Also it seems your 10 ISO is still attached to the Virtual Machine, better detach it after install the OS, to avoid potential issues with the devices order during boot.

 

alacran



#303 Tokener

Tokener

    Frequent Member

  • Developer
  • 378 posts

Posted 20 June 2021 - 07:40 AM

Hola alacran

thank you very much for providing this useful information. :worship:

 

The menu.lst is loaded at boot.

vboxx grub menu.jpg

 

Windows can be called from the list but booting PE.ISO fails.

Grub seems to expect a disk-image (not disc-image)

 

vboxx Failed to load 1.jpg

 

 

Also it seems your 10 ISO is still attached to the Virtual Machine, (...)

In fact it is not, but what makes you think so?

 

Best regards   T.

 

EDIT: The menu.lst seems to switch, after a failed boot, to ANSI encoding.

 

 

 



#304 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 20 June 2021 - 09:37 AM

Why not trying:

map *whatever* (0xff)

map --hook

root (0xff)

ls

 

(from the commands you issued it is not clear if the issue is the .iso filesystem or the actual loader that is chainloaded, the fact that you have no errors when mapping should mean the latter).

 

:duff:

Wonko


  • Tokener likes this

#305 Tokener

Tokener

    Frequent Member

  • Developer
  • 378 posts

Posted 20 June 2021 - 12:22 PM

Thank you wonko

for spending your time on this subject.

I ran the commands you suggested with no luck.

 

vboxx iso map failed 1.jpg

 

T.

 

EDIT: The menu.lst is still UTF-8. my previous assumption was wrong.



#306 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 20 June 2021 - 01:31 PM

The filesystem is found (UDF) and recognized correctly.

 

Try:

 

map *whatever* (0xff)

map --hook

root (0xff)

 

chainloader /[TAB]

 

do you see the files listed, can you type a few characters and continue [TAB] autocompletion until you can find the loaader?

 

Is it not - by any chance - that you have a iso-hybrid image?

 

i.e. if you cat --hex (0xff)0+1 do you get all 00's?

 

:duff:

Wonko


  • Tokener likes this

#307 Tokener

Tokener

    Frequent Member

  • Developer
  • 378 posts

Posted 20 June 2021 - 04:11 PM

@Wonko

Thank you

 

map *whatever* (0xff)
map --hook
root (0xff)

chainloader /[TAB]

Return:

vboxx iso map failed 2.jpg

 

 

if you cat --hex (0xff)0+1 do you get all 00's?

Yes, 4 or 5 pages:

vboxx iso map failed cat 1.jpg

 

Is it not - by any chance - that you have a iso-hybrid image?

How do you determine this from Windows?

 

Best Regards   T.

 

 



#308 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 20 June 2021 - 06:06 PM

How do you determine this from Windows?

 

A cd/dvd has the first 16 sectors (2048 bytes each) empty or all 00's.

A iso-hybrid image has a MBR (boot code and a partition table) in the first 512 bytes.

So basically you do the same thing as you just did in grub4dos, look at the first few bytes and check that they are all 00's. 

 

It seems like the issue is in your case that the grub4dos (for *whatever* reason) cannot access the filesystem. :dubbio:

Maybe it is a "bad image"? :unsure:

 

Can you try with another .iso?

 

:duff:

Wonko


  • Tokener likes this

#309 alacran

alacran

    Platinum Member

  • .script developer
  • 2710 posts
  •  
    Mexico

Posted 20 June 2021 - 06:14 PM

Examples from my UEFI menu.lst

 

Spoiler

 

JFYI: The hook command is not required on G4E, as it do not exists on this version.

 

alacran


  • Tokener likes this

#310 Tokener

Tokener

    Frequent Member

  • Developer
  • 378 posts

Posted 20 June 2021 - 07:47 PM

Thank you Sirs for time you invested on this subject.

 

wonko:

 

Maybe it is a "bad image"? Can you try with another .iso?

The Win7PE.iso has no UEFI bootcode and so Grub refused to load the image I guess. My mistake, I did not take that into account.

 

Win10PE.iso loaded flawlessly with entry from alacran (#309).

 

Thanks again   T.



#311 alacran

alacran

    Platinum Member

  • .script developer
  • 2710 posts
  •  
    Mexico

Posted 20 June 2021 - 10:34 PM

Thank you Sirs for time you invested on this subject.

 

wonko:

The Win7PE.iso has no UEFI bootcode and so Grub refused to load the image I guess. My mistake, I did not take that into account.

 

Win10PE.iso loaded flawlessly with entry from alacran (#309).

 

Thanks again   T.

 

Yes, G4E only chainload to the ISO, HD or VHD and all required code to boot (on UEFI environment) from it has to be into the ISO file, drive or virtual drive.

 

And even if you can add to that Win7PE.iso the UEFI boot files/folders required, it will not boot fine on PCs having UEFI v2.3.1C (released on second half of 2013) or newer, so it is better to do not use Win7PE(s) on UEFI environment.

 

alacran


  • Tokener likes this

#312 Tokener

Tokener

    Frequent Member

  • Developer
  • 378 posts

Posted 21 June 2021 - 01:03 PM

Thanks a lot

For people who have similiar problems in VirtualBox(6) here is a simple installer script (Archive) for "UEFI Grub4dos" (G4E in the following).
It uses terms and files mentioned in previous posts by alacran and wonko. G4E file used is 2021-01-12 (amd64 only).
To mount hidden UEFI partition Erwan's mighty vMount is doing a great job. (extracted if not found in folder)
Just run the script as Admin and select the UEFI-device of your system - by default it is the first or second partition of the first harddisk (0). Maybe you can detect by size. In case you don't know, ask your Administrator.

G4D gets installed by copying files from the Installer-folder (extracted 7z-Archive). Use editmode.cmd to modify menu.lst after installation.

As mentioned: This installation is especially for VirtualBox UEFI situation.

Tested on Win10_x64 21H1 in VirtualBox6.

 

Password = G4E  Download here

Hope it's useful. 


Best regards   T.
 

Attached Files



#313 alacran

alacran

    Platinum Member

  • .script developer
  • 2710 posts
  •  
    Mexico

Posted 24 June 2021 - 09:28 AM

Just to let you know this is the new released version grub4dos-for_UEFI-2021-06-19.7z 968K

 

For your convenience I translated to English the ChangeLog_UEFI.txt file using Google translate.

 

I'm going to quote here the changes made from the Build 2021-02-10 up to this new version:

Spoiler

 

Also this is the sample menu.lst translated to English by Google Translate:

Spoiler

 

Full ChangeLog, and Sample-menu.lst files are included in attached Translations.7z file

 

Into the grub4dos-for_UEFI-2021-06-19.7z we can find 3 folders: ext containing all external commands, i386-efi and x86_64-efi that contain the x86 and x64 versions of kernel.img files related to the embeded menu mentioned in the ChangeLog file.

 

So far I'm not able to open the kernel.img files to take a look to the content, so it is not yet clear to me if we are allowed to moddify them to include our own entries, or what kind of editions we can do (if any).

 

alacran

Attached Files



#314 alacran

alacran

    Platinum Member

  • .script developer
  • 2710 posts
  •  
    Mexico

Posted 24 June 2021 - 10:14 AM

@ yaya or A1ive or liuzhaoyzz

 

If some of our good friends from China could give a few more info it will be very appreciated, sorry to bother you but you are our only source of info.

 

Do the kernel.img files allow user modifications?

Where should we put/locate the ext folder?

How to call/run the commands into ext folder to make use of them?  Some examples could be good.

 

This commands mentioned on the Sample menu.lst as external commands are not present into ext folder:

 

 

#Use external commands ntloader and initrd.lz1

 

Are they embeded into the BOOTIA32.EFI and BOOTX64.EFI files?

 

If not, Where we can download them?  and Where we should put them?

 

Thanks in advance for your answer.

 

alacran



#315 Tokener

Tokener

    Frequent Member

  • Developer
  • 378 posts

Posted 30 June 2021 - 11:57 AM

@alacran

Hola my friend :hi:

 

#Use external commands ntloader and initrd.lz1

 

Are they embeded into the BOOTIA32.EFI and BOOTX64.EFI files?

 

If not, Where we can download them?  and Where we should put them?

 

you can download them here:

 

https://github.com/g...loader/releases

 

Both files in the archive.

 

I had success booting PE-wim when placing them (ntloader and initrd.lz1) to the root of the drive where the WIM is stored.

#Use external commands ntloader and initrd.lz1
#Assuming WIM or VHD is located at (hdx,y)/path/to/winpe.wim
title Start Windows WIM and use kernel 1
find --set-root /wim/boot.wim
uuid %@root%
kernel /ntloader uuid=%?_UUID% file=/wim/boot.wim
initrd /initrd.lz1

 

The syntax suggests that starting a VHD works the same way, unfortunately I can't confirm that yet.
This could be because my VHD was not properly prepared.

Applied the boot.wim to the vhd (2GB fixed/expandable), tried to boot on a 4GB VirtualBox.

I see it starts booting but crashes - maybe missing RAMdisk driver? Do I need SVBus or similiar?

 

Best regards   T.

 
 

 

 



#316 alacran

alacran

    Platinum Member

  • .script developer
  • 2710 posts
  •  
    Mexico

Posted 30 June 2021 - 10:13 PM

Hi my friend, thanks for your post and link, I will run some test and report back my findings.

 

 

The syntax suggests that starting a VHD works the same way, unfortunately I can't confirm that yet.

This could be because my VHD was not properly prepared.

Applied the boot.wim to the vhd (2GB fixed/expandable), tried to boot on a 4GB VirtualBox.

I see it starts booting but crashes - maybe missing RAMdisk driver? Do I need SVBus or similiar?

 

 

In case of a Win10XPE.ISO just extracted by 7-zip (boot.wim exists in sources folder) to a FAT-32 VHD you don't need to use SvBus driver. EDIT-1: This do not work when using ntloader. See this post

 

When tested booting Win10XPE_x64.vhd a single FAT-32 active primary partition, made just by 7-zip extracting the content of Win10XPE_x64.ISO, (where the \sources\boot.wim was present) it didn't boot, the message was it didn't found \Windows\system32\winload.exe, logical as it is located into boot.wim in this case.

 

In any other case of a 8.x or 10 OS installed on a (NTFS) VHD, SVBus driver is only required for Ramboot.

 

EDIT-2: According with my tests on following posts with those commands the WIM file is loaded to Ram, but a VHD is booted as filedisk, (in both cases same behaviour as when booting it from Windows boot files/folders), so you do not require SVBus driver for filedisk booting a VHD.

 

EDIT-3: If you want to install your Win10XPE on a VHD, see: Install Win10XPE_x64 Flat or Compact Mode on VHD 

 

alacran



#317 alacran

alacran

    Platinum Member

  • .script developer
  • 2710 posts
  •  
    Mexico

Posted 01 July 2021 - 02:20 AM

For now I'm testing ntloader on a MBR PC and using grub4dos-0.4.6a-2021-06-02 (MBR version).

 

This is a valid test as in this case commands for grub4dos are the same on MBR version or on UEFI version.

 

This is the forum page related to ntloader (google translate): https://translate.go...&extra=page%3D1

 

For readers convenience I will attach here the English translation of the first post:

Spoiler

 

So far I didn't have sucess to boot a Win10XPE boot.wim using ntloader, just read it do not work on logical partitions, next I will try from a primary partition and comment back.

 

alacran



#318 alacran

alacran

    Platinum Member

  • .script developer
  • 2710 posts
  •  
    Mexico

Posted 01 July 2021 - 03:54 AM

If the WIM and VHD files are located on a primary partition they boot very fine by means of ntloader using following menu entries in menu.lst:

 

 

title Boot Windows NT6+ PE - /Win10XPE_x64.wim
uuid (hd0,1)
kernel /ntloader uuid=%?_UUID% file=/Win10XPE_x64.wim
initrd /initrd.lz1

title Start Windows WIM and use kernel 1 - /Win10XPE_x64.wim
find --set-root /Win10XPE_x64.wim
uuid %@root%
kernel /ntloader uuid=%?_UUID% file=/Win10XPE_x64.wim
initrd /initrd.lz1

title Boot Windows NT6+ VHD - /Mini-10x64.vhd
uuid (hd0,1)
kernel /ntloader uuid=%?_UUID% file=/Mini-10x64.vhd
initrd /initrd.lz1

title Start Windows VHD and use kernel 1 - /Mini-10x64.vhd
find --set-root /Mini-10x64.vhd
uuid %@root%
kernel /ntloader uuid=%?_UUID% file=/Mini-10x64.vhd
initrd /initrd.lz1

 

WIM file is loaded and booted from Ram as a ususual for WinPE, but the VHD is booted as filedisk, (in both cases same behaviour as when booting it from Windows boot files/folders).

 

But this entry didn't work:

 

 

title Boot Windows NT6+ PE - /Win10XPE_x64.wim
uuid (hd0,1)
chainloader /ntloader initrd=/initrd.lz1 uuid=%?_UUID% file=/Win10XPE_x64.wim

 

When tested booting Win10XPE_x64.vhd a single FAT-32 active primary partition, made just by 7-zip extracting the content of Win10XPE_x64.ISO, (where the \sources\boot.wim was present) it didn't boot, the message was it didn't found \Windows\system32\winload.exe, logical as it is located into boot.wim in this case.

 

Mini-10x64.vhd is a single NTFS active primary partition, it contents also all MBR/UEFI boot files/folders, but from my comment on previous paragraph, it seems this files/folders are not used for ntloader and it loads/runs directly \Windows\system32\winload.exe (needs to be tested).

 

I want you to know that my Mini-10x64.vhd already has installed SVBus driver and there wasn't required to use Test Mode (testsigning) or No Integrity Checks options to filedisk boot successfully, in fact it booted without any issue.

 

NOTE: WIM, VHD, ntloader and initrd.lz1 files are located on root of same primary partition, if ntloader and initrd.lz1 files are not there the WIM and VHD files do not boot as I confirmed.

 

alacran



#319 alacran

alacran

    Platinum Member

  • .script developer
  • 2710 posts
  •  
    Mexico

Posted 01 July 2021 - 05:18 AM

From my previous post:

 

Mini-10x64.vhd is a single NTFS active primary partition, it contents also all MBR/UEFI boot files/folders, but from my comment on previous paragraph, it seems this files/folders are not used for ntloader and it loads/runs directly \Windows\system32\winload.exe (needs to be tested).

 

Yes, my guess was right, just tested using ntloader the boot/files folders into the VHD are not required, it boots fine as filedisk without them.

 

I don't know the right commands to Ramboot a VHD using ntloader yet.

 

I haven't finished reading the topic of ntloader, but so far I read several posts from liuzhaoyzz, and he has found some troubles to Ramboot VHDs with ntloader, also read ntloader does not work for Filedisk or Ramboot VHDs installed on Wimboot mode.

 

And as we already have other ways to Filedisk and Ramdisk directly from grub2 from A1ve, grub4dos for MBR and grub4dos for UEFI, and they work very fine, IMHO for now I will use ntloader on my config files for the mentioned loaders, only to boot WIM files on MBR and/or UEFI environments.

 

Nevertheless there are some very interesting and useful advanced options we can use on ntloader, to mention some that seem very relevant to me:

Spoiler

 

More info on the Readme.MD on github page: https://github.com/grub4dos/ntloader

 

alacran


  • Tokener likes this

#320 Tokener

Tokener

    Frequent Member

  • Developer
  • 378 posts

Posted 01 July 2021 - 11:27 AM

Thank you for sharing your findings.

You mentioned NTFS_X64.EFI in this post:

http://reboot.pro/in...=11#entry217568

did you have success using it to boot vhd with latest G4E (2021-06-..)?

All my efforts to boot PE-VHD failed, neither with NTFS_X64.EFI nor ntloader, although Windows can.

 

Regards   T.



#321 alacran

alacran

    Platinum Member

  • .script developer
  • 2710 posts
  •  
    Mexico

Posted 01 July 2021 - 11:58 AM

Thank you for sharing your findings.

You mentioned NTFS_X64.EFI in this post:

http://reboot.pro/in...=11#entry217568

did you have success using it to boot vhd with latest G4E (2021-06-..)?

All my efforts to boot PE-VHD failed, neither with NTFS_X64.EFI nor ntloader, although Windows can.

 

Regards   T.

I haven't tested that version yet.  But I can do it and let you know.

 

alacran



#322 alacran

alacran

    Platinum Member

  • .script developer
  • 2710 posts
  •  
    Mexico

Posted 01 July 2021 - 02:10 PM

All my VHDs (even those installed on wimboot mode and lz4 compressed) Rambooted very fine using grub4dos-for_UEFI-2021-06-19.

 

At least one of them was Rambooted using also ntfs_x64.efi as it has only a single NTFS active primary partition.

 

But I forgot to test booting the VHDs using ntloader. In fact this is not my favorite option as it do not work on Wimboot mode installations.

 

There has to be something wrong in your PE-VHD, your menu.lst or the internal BCDs into the VHD.

 

IMHO it is better to work on a real machine (with Secure Boot dissabled if possible) and use a fast USB 3.0 device prepared with USB Format Tool by wimb and make a full OS installation on Wimboot mode, or a Compact LZX installation, and do not use a PE-VHD, you can use VHD_WIMBOOT  by wimb to make it easier and faster, (the download includes a *.pdf file with very clear instuctions), it will also make for you grub2, grub4dos and BCD entries for MBR and UEFI, and if you want latter update to the grub4dos-0.4.6a-2021-06-02 and grub4dos-for_UEFI-2021-06-19 files, just rename and/or copy new files as I have just done.  After this you will be able to study in detail all the right entries on the 4 BCDs and on all config files.

 

alacran


  • Tokener likes this

#323 Tokener

Tokener

    Frequent Member

  • Developer
  • 378 posts

Posted 01 July 2021 - 02:47 PM

@alacran

Thank you very much for this fast reply.

 

IMHO it is better to work on a real machine (...)

Sorry, but this option is not available.

 

 

(...) and do not use a PE-VHD

Is there a certain reason for this recommendation?

 

Thanks in advance   T.



#324 alacran

alacran

    Platinum Member

  • .script developer
  • 2710 posts
  •  
    Mexico

Posted 01 July 2021 - 10:36 PM

Well then you may try this: How to Boot a USB Flash Drive from VirtualBox

 

About PE.vhd, I deleted my old Win10XPE_x64.vhd flat installed in Compact mode LZX, some time ago, and just made a new one and it is not capable to boot making the procedure manually or even using the mentioned tools made by wimb to create the respective entries on BCDs, and still don't find where is the problem, if I found a solution I will let you know.

 

So better make a real OS installation (Wimboot or Compact mode) on a VHD, MBR initialized, single active primary NTFS partition, you can make it with VHD_WIMBOOT  by wimb, boot from it and install SVBus driver (require enabling "Test Mode" and "No integrity checks" before installing the driver), you could do this in a partition of your internal HD.

And latter capture it in Wimboot  mode with VHD_WIMBOOT  by wimb and then with same tool install it to a VHD preferable fixed size, on your USB device (Wimboot or Compact mode as you prefer, just remember ntloader can't boot Wimboot VHDs), previously prepared with USB Format Tool by wimb.  Now boot from the USB device on Virtual Box and all should be fine.

 

NOTES:

  • After testing all is working fine you could also use Win_Reduce_Trusted by wimb if you want.
  • A fixed size VHD can be latter lz4 compressed to save space and also load it to Ram faster.

 

alacran



#325 alacran

alacran

    Platinum Member

  • .script developer
  • 2710 posts
  •  
    Mexico

Posted 02 July 2021 - 06:22 AM

@ Tokener

 

I'm still unable to boot my new Win10XPE_x64.vhd flat installed, there are many variables involved since I made the older version that worked so fine, just to start a new 10 version source, new Win10XPE project version, updated scrips and different applications compared with old build.

 

But nevertheless if the new ISO content is extracted with 7-zip to a MBR inicialized single FAT-32 active primary partition VHD it boots fine using grub4dos-0.4.6a-2021-06-02 and grub4dos-for_UEFI-2021-06-19, but as mentioned before on post No. 316 it is a fact will not boot using ntloader, as boot.wim file is present (not deployed).

 

If your only intention is to test how to boot a VHD in UEFI environment this easy manual approach may work for you.

 

Procedure:

  1. Create a fixed size (mine is 1 GB for a 790 MB ISO) MBR inicialized single FAT-32 active primary partition VHD.
  2. Extract to the VHD all content of your ISO, excluding CDUsb.y, XPEStartup.cmd and XPEStartup.ini files.
  3. Open \boot\bcd with BootIce and edit as in attached picture No. 1
  4. Open \efi\microsoft\boot\bcd with BootIce and edit as in attached picture No. 2
  5. NOTE: This settings in BootIce are only valid in this expecifical case of an extracted PE.iso to a VHD.

 

This menu entries should work fine for MBR:

 

title 10XPE_x64.vhd - FILEDISK  - 1 GB - map as (hd)
find --set-root --ignore-floppies /10XPE_x64.vhd
map /10XPE_x64.vhd (hd)
map --hook
root (hd-1,0)
chainloader /bootmgr

title 10XPE_x64.vhd - RAMDISK  - 1 GB - map as (hd)
find --set-root --ignore-floppies /10XPE_x64.vhd
map --top --mem /10XPE_x64.vhd (hd)
map --hook
root (hd-1,0)
chainloader /bootmgr
 

 

This menu entries should work fine for UEFI:

 

title VHD/10_XPE.vhd - Win10XPE - FILEDISK - 1 GB for UEFI boot
find --set-root /10_XPE.vhd
map /10_XPE.vhd (hd)
chainloader (hd-1)

title VHD/10_XPE.vhd - Win10XPE - RAMDISK - 1 GB for UEFI boot
find --set-root /10_XPE.vhd
map --mem /10_XPE.vhd (hd)
chainloader (hd-1)

 

Hope this can be usefull for you.

 

alacran

Attached Thumbnails

  • No. 1.png
  • No. 2.png

  • Tokener likes this




3 user(s) are reading this topic

0 members, 3 guests, 0 anonymous users