Jump to content











Photo
- - - - -

Integrate grub4dos UEFI and MBR in Ventoy devices

grub4dos uefi grub4dos mbr ventoy

  • Please log in to reply
34 replies to this topic

#1 alacran

alacran

    Platinum Member

  • .script developer
  • 2710 posts
  •  
    Mexico

Posted 20 September 2022 - 03:03 AM

Posted Image

File Name: Integrate grub4dos UEFI and MBR in Ventoy devices
File Submitter: alacran
File Submitted: 19 Sep 2022
File Updated: 10 Oct 2022
File Category: Tools

Integrate grub4dos UEFI and MBR in Ventoy devices:

Ventoy is an excellent tool for booting Windows and Linux ISO files, and Filedisk boot Windows and Linux VHDs.

But when dealing with Windows VHDs there are certain features Ventoy lacks:

Boot VHDs in RAM.
Boot and Ramboot VHDs installed in Wimboot mode (especially from a USB device).
Boot and Ramboot WinPEs flat installed VHDs, in Compact LZX or Wimboot mode.


This project was made with the idea to add to our Ventoy USB device all features Ventoy lacks, and improve the versatility of our multiboot USB device, by means of chainloading to grub4dos for MBR/CSM or UEFI respectively, that works fantastic when dealing with Windows OS installed VHDs.

Just extract the content of each 7.z file in the respective partition, a complete Layout with some empty folders will be avilable in your Ventoy partition, each folder has instructions to use.

To also integrate alive's grub2 File Manager see instructions in agFM folder.

alive's grub2 File Manager can be loaded directly from Ventoy Menu, or from grub4dos in MBR and UEFI environments.

NOTE-1:

When extracting the Ventoy_partition.7z, in case you are adding it to your current alredy made Ventoy USB device with all your ISOs and VHDs, allready there, there will be no problem, to preserve your personal settings in your ventoy.json, file, it is not present in this package.

But the Ventoy_partition\ventoy\ventoy_grub.cfg file needs to be overwritten, (or at least manually edited adding the content of the new version), as the new ventoy_grub.cfg file is where are located the commands to chainload to grub4dos for MBR and UEFI respectively.

Grub4dos MBR and UEFI versions and their respective menu.lst config files will be available when booting from Ventoy, just by pressing F6 and selecting to run.

Also the Ventoy plugins for booting WinPEs and Win10 VHDs were included for users convenience.

Additionally my FD-VHD-Loader-USB_x64 and Load_Ramdisk_x64 programs are available to be run on demand, from Ventoy partition root, instructions into VHD_from_USB and RamDisk folders respectively.

NOTE-2: Load_Ramdisk_x64 program requires to have previously installed ImDisk v2.1.1 by Olof Lagerkvist, or as a bare minimum v2.0.10 into your WinPE or VHD to make use of it.

NOTE-3: Users can update anytime the Verntoy version, all the content of VTOYEFI_partition, will be deleted and replaced by the new version, so it will be necessary to extract again the content of VTOYEFI_partition.7z, to that partition, in new v1.2 all secondary UEFI grub4dos menus have being moved to Ventoy_partition, to preserve them from deletion, making easier keep user changes/editions to them.

Integrate grub4dos to Ventoy USB v1.2.7z >>> Pasword = alacran

Hope you enjoy it as I do.

alacran

Click here to download this file

#2 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 20 September 2022 - 08:35 AM

Why do you add files to the Ventoy partition 2?

 

Why not modify the boot*.efi files so they load a menu.lst from Ptn1:\ventoy folder?

 

Then you would not need to modify partition 2 at all.

 

Here is the Windows cmd file I use to change the internal  menu.lst in the EFI files

@echo off
@color 1f
set ERR=
REM %1 contains folder with source file
if "%~1"=="" echo ERROR: Drag-and-drop grub4efi source folder onto this file & pause & goto :EOF
if not exist "%~1\mkimage.exe" echo ERROR: No mkimage.exe found in source folder & set ERR=1
if not exist "%~1\x86_64-efi\kernel.img" echo ERROR: No x86_64-efi\kernel.img found in source folder & set ERR=1
if not exist "%~1\i386-efi\kernel.img" echo ERROR: No i386-efi\kernel.img found in source folder & set ERR=1
if not exist "%~dp0e2b.lst" echo ERROR: No e2b.lst found in %~dp0 folder & set ERR=1
if "%ERR%"=="1" color 4f & pause & goto :EOF
pushd "%~1"
if exist BOOTX64.EFI del BOOTX64.EFI
if exist BOOTIA32.EFI del BOOTIA32.EFI
mkimage.exe -c "%~dp0e2b.lst" -O x86_64-efi -o BOOTX64.EFI   -p /ventoy
mkimage.exe -c "%~dp0e2b.lst" -O i386-efi   -o BOOTIA32.EFI -p /ventoy
echo.
if not exist BOOTX64.EFI  echo ERROR: No BOOTX64.EFI created! & set ERR=1
if not exist BOOTIA32.EFI echo ERROR: No BOOTIA32.EFI created! & set ERR=1
dir *.efi
echo.
echo INTERNAL MENU.LST
echo =================
echo.
type "%~dp0e2b.lst"
echo =================
if "%ERR%"=="1" color 4f & goto :end
echo.
)
:end
popd
pause

Your replacement file (e2b.lst) can contain something simple like

find --set-root /ventoy/menug4defi.lst > nul
configfile /ventoy/menug4defi.lst > nul

You could then keep all files in a \ventoy\g4e\ folder on Ptn1 and Ventoy could be updated without any problem.


  • devdevadev likes this

#3 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 20 September 2022 - 01:08 PM

Suggestion/comment in passing by:

 

I am usually an optimist, but sometimes issues happen, this.

 

 

if exist BOOTX64.EFI del BOOTX64.EFI
if exist BOOTIA32.EFI del BOOTIA32.EFI
mkimage.exe -c "%~dp0e2b.lst" -O x86_64-efi -o BOOTX64.EFI -p /ventoy
mkimage.exe -c "%~dp0e2b.lst" -O i386-efi -o BOOTIA32.EFI -p /ventoy
echo.
if not exist BOOTX64.EFI echo ERROR: No BOOTX64.EFI created! & set ERR=1
if not exist BOOTIA32.EFI echo ERROR: No BOOTIA32.EFI created! & set ERR=1

 

maybe could be made a little less potentially destructive by making a backup of the files and then deleting the backups only if the newly created files are found, otherwise rename the backups.

 

Right now it seems to me a lot  *like*:

1) delete existing files
2) attempt to recreate the files
3) if the new files are created, good <- this will probably happen in 99.99999% of cases, but otherwise:
4) if the new files aren't created, print, "sorry, I just screwed up your setup"

 

:duff:

Wonko



#4 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 20 September 2022 - 03:01 PM

The original EFI files are from a downloaded ZIP file. They are easily recovered if required.



#5 alacran

alacran

    Platinum Member

  • .script developer
  • 2710 posts
  •  
    Mexico

Posted 20 September 2022 - 04:58 PM

I think my approach is more simple and without any potential risk, as it only adds a few files to the VTOYEFI partition, and doesn't make any change to the files that already exist in that partition, and in case the user applies a new version of Ventoy, it is just required to extract againg the VTOYEFI_partition.7z file to re-add the grub4dos UEFI (G4E) files and the generic menus.

 

But it the user has edited the G4E menus the changes will be lost if not saved before appling the Ventoy update.

 

It can be very easily solved in a new version of this project, just keeping in VTOYEFI partition only the main UEFI menu.lst, and moving all the rest of UEFI menus to the Ventoy partition, this also will avoid the need to change the internal menu.lst in the EFI files each time a new G4E version is applied.

 

@ steve6375

 

Thanks for your suggestion, I appeciate a lot your intention to be helpful, I'm aware of the commands to edit the internal menu.lst in G4E, but I don't see any real need to edit them, an easier solution is just making what I commented in previous paragraph.

 

 alacran



#6 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 20 September 2022 - 05:53 PM

OK - your choice, but by using a modified EFI file there is no need to add files to the VTOYEFI partition at all and no need to have to add files when you update to a later version of Ventoy.  All grub4efi files will be on the first partition - seems much better to me?



#7 Darkr

Darkr

    Newbie

  • Members
  • 16 posts
  •  
    India

Posted 21 September 2022 - 08:14 AM

I am adding this on my project
Also agfm but the only problem is efi partition is too tiny only 32mb
I am creating 100 mb .img
With same configarition but
Failed with checksum
Any way to bypass checksum

#8 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 21 September 2022 - 08:18 AM

The code in Ventoy checks the location and size of the 2nd FAT VTOYEFI partition.

It must be EXACTLY 32MB in size and it must start at the sector immediately following the last sector of partition 1.

Unless you modify and recompile Ventoy, you cannot change the size of the 2nd partition.

Also the code in the MBR must be special Ventoy grub2 boot code.

 

Also, any Update using the Ventoy app (or .sh) will destroy and then replace the 2nd partition, so even if you keep the same size then all files in the 2nd partition will be replaced by original Ventoy files when you do a Ventoy update.

 

P.S. To add grubfm, simply add the grubfm_mutiarch.iso file.


  • devdevadev likes this

#9 alacran

alacran

    Platinum Member

  • .script developer
  • 2710 posts
  •  
    Mexico

Posted 21 September 2022 - 09:47 AM

I am adding this on my project
Also agfm but the only problem is efi partition is too tiny only 32mb
I am creating 100 mb .img
With same configarition but
Failed with checksum
Any way to bypass checksum

 

 

The code in Ventoy checks the location and size of the 2nd FAT VTOYEFI partition.

It must be EXACTLY 32MB in size and it must start at the sector immediately following the last sector of partition 1.

Unless you modify and recompile Ventoy, you cannot change the size of the 2nd partition.

Also the code in the MBR must be special Ventoy grub2 boot code.

 

Also, any Update using the Ventoy app (or .sh) will destroy and then replace the 2nd partition, so even if you keep the same size then all files in the 2nd partition will be replaced by original Ventoy files when you do a Ventoy update.

 

P.S. To add grubfm, simply add the grubfm_mutiarch.iso file.

 

AFAIK grubfm_mutiarch.iso file is for MBR/CSM only, and grubfmx64.efi is for UEFI, so adding grubfm_mutiarch.iso file is not a full solution.

 

In fact the space is very limited in FAT VTOYEFI_partition, the grubfmx64.efi is 7.3 MB and doesn't fit in the remaining space.

 

In my opinion what agFM does is very similar to what Ventoy does, so I didn't even try to include it.

 

But this should work fine:

  1. Create a folder UEFI-agFM in Ventoy NTFS partition.
  2. Put into it grubfmx64.efi
  3. Add following entries to G4E menu.lst:

 

 

This should work if Bios/firmware HAS NTFS drivers:

iftitle [if exist (hd0,0)/UEFI-agFM/grubfmx64.efi] Load UEFI File Manager of a1ive - If UEFI NTFS drivers are available.
find --set-root /UEFI-agFM/grubfmx64.efi
chainloader /UEFI-agFM/grubfmx64.efi

This should work if Bios/firmware LACKS NTFS drivers:

iftitle [if exist (hd0,0)/UEFI-agFM/grubfmx64.efi] Load UEFI File Manager of a1ive - If UEFI NTFS drivers are NOT available.
load /EFI/grub/ntfs_x64.efi
find --set-root /UEFI-agFM/grubfmx64.efi
chainloader /UEFI-agFM/grubfmx64.efi

 

alacran



#10 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 21 September 2022 - 10:19 AM

No - grubfm_multiarch.iso can be booted by Ventoy as Legacy or UEFI64 or UEFI32.

You can even add a \boot\grubfm folder and add extra files to modify the behaviour of grubfm when it boots (it will auto-detect a \boot\grubfm\config file and you can have your own startup menu and add extra rules and types files, change theme, etc.  without even needing to change the grubfm_multiarch.iso file).


  • alacran and devdevadev like this

#11 alacran

alacran

    Platinum Member

  • .script developer
  • 2710 posts
  •  
    Mexico

Posted 21 September 2022 - 10:30 AM

Thanks for the useful info steve, I didn't know that.

 

Where the hell you got that info?, please share a link.

 

alacran



#12 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 21 September 2022 - 10:42 AM

Just see my Easy2Boot project. It makes a USB drive with  grub4dos, grubfm and Ventoy (recompiled to work with larger partition 2).

 

In partition 2 it has a \boot\grubfm folder with a config file and some menu files.

If you boot to grubfm_multiarch.iso it will also pick up those files.

 

There are also my eBooks...


  • devdevadev likes this

#13 Darkr

Darkr

    Newbie

  • Members
  • 16 posts
  •  
    India

Posted 21 September 2022 - 11:07 AM

index.php?app=downloads&module=display&s

File Name: Integrate grub4dos UEFI and MBR in Ventoy devicesFile Submitter: alacranFile Submitted: 19 Sep 2022File Updated: 20 Sep 2022File Category: ToolsIntegrate grub4dos UEFI and MBR in Ventoy devices:Ventoy is a exelent tool for booting Windows and Linux ISO files, and Filedisk boot Windows and Linux VHDs.But when dealing with Windows VHDs there are certain features Ventoy lacks:Boot VHDs in RAM.Boot and Ramboot VHDs installed in Wimboot mode (especially from a USB device).Boot and Ramboot WinPE Compact LZX or Wimboot installed VHDs.This project was made with the idea to add to our Ventoy v1.79 USB device all features Ventoy lacks, and improve the versatility of our multiboot USB device, by means of chainloading to grub4dos for MBR/CSM or UEFI respectively, that works fantastic when dealing with Windows OS installed VHDs.Just extract the content of each 7.z file in the respective partition, a complete Layout with some empty folders will be avilable in your Ventoy partition, each folder has instructions to use.NOTE-1:When extracting the Ventoy_partition.7z, in case you are adding it to your current alredy made Ventoy USB device with all your ISOs and VHDs, allready there, there will be no problem, but if you want to keep your personal settings in ventoy.json, then when extracting, just don't allow it to overwrite the Ventoy_partition\ventoy\ventoy.json file.But the Ventoy_partition\ventoy\ventoy_grub.cfg file needs to be overwritten, (or at least manually edited adding the content of the new version), as the new ventoy_grub.cfg file is where are located the commands to chainload to grub4dos for MBR and UEFI respectively.Grub4dos MBR and UEFI versions and their respective menu.lst config files will be available when booting from Ventoy, just by pressing F6 and selecting to run.Also the Ventoy plugins for booting WinPEs and Win10 VHDs were included for users convenience.Additionally my FD-VHD-Loader-USB_x64 and Load_Ramdisk_x64 programs are available to be run on demand, from Ventoy partition root, instructions into VHD_from_USB and RamDisk folders respectively.NOTE-2: Load_Ramdisk_x64 program requires to have previously installed ImDisk v2.1.1 by Olof Lagerkvist, or as a bare minimum v2.0.10 into your WinPE or VHD to make use of it.Integrate grub4dos to Ventoy USB v1.0.7z >>> Pasword = alacranHope you enjoy it as I do.alacranClick here to download this file

Can you also intrigate neogrub
With ventoy ??
Neo grub boots linux vhds without
Any troble...
Exm. Easybcd

#14 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 21 September 2022 - 11:32 AM

AFAIK neogrub does not really exist, it is a grub4dos ripoff (a grub4dos renamed to neogrub,possibly with some minor changes).

 

:duff:

Wonko



#15 Darkr

Darkr

    Newbie

  • Members
  • 16 posts
  •  
    India

Posted 21 September 2022 - 12:00 PM

Everything working good...

But problem is I want my ventoy menu with this

 

 

QOJJo9.png
QOJHad.png


Edited by Darkr, 21 September 2022 - 12:26 PM.


#16 alacran

alacran

    Platinum Member

  • .script developer
  • 2710 posts
  •  
    Mexico

Posted 21 September 2022 - 10:34 PM

As Wonko said neogrub is no more than grub4dos where its name and the internal menu.lst has being changed to simulate it was developed by them, and this is in no way a right way to make things, trying to take the credit of other people hard work.

 

My version of ventoy_grub.cfg is a grub2 config file, only available after press F6, that runs under grub2 (MBR or UEFI) in Ventoy, and has some entries to chainload to grub4dos (MBR or UEFI respectively), that in turn loads menu.lst (the config file for grub4dos) for MBR or UEFI respectively, so the grub4dos menus can't be seen directly in the screen presented by ventoy_grub.cfg, and are available after grub4dos is loaded.

 

There is not a single problem in this, It is the way it works.

 

alacran



#17 Darkr

Darkr

    Newbie

  • Members
  • 16 posts
  •  
    India

Posted 22 September 2022 - 05:21 AM

As Wonko said neogrub is no more than grub4dos where its name and the internal menu.lst has being changed to simulate it was developed by them, and this is in no way a right way to make things, trying to take the credit of other people hard work.
 
My version of ventoy_grub.cfg is a grub2 config file, that runs under grub2 (MBR or UEFI) in Ventoy, and has some entries to chainload to grub4dos (MBR or UEFI respecively), that in turn loads menu.lst (the config file for grub4dos) for MBR or UEFI respecively, so the grub4dos menus can't be seen directly in the screen presented by ventoy_grub.cfg
 
There is not a single problem in this, It is the way it works.
 
alacran

Batter then this using easy2boot
1st boot is agfm and also
Intrigate ventoy,refind,grub4dos
The only problem is bootloader is grub2dos 1st boot agfm...

#18 alacran

alacran

    Platinum Member

  • .script developer
  • 2710 posts
  •  
    Mexico

Posted 22 September 2022 - 05:36 AM

You are free to use whatever you like better.

 

alacran


  • Darkr likes this

#19 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 22 September 2022 - 11:20 AM

JFYI, the Alternative Download site also has a version of E2B which includes grub4efi as well as Ventoy and agFM.

See Latest Betas - current latest is Easy2Boot_v2.16f_EFIBeta.zip


  • devdevadev and Darkr like this

#20 Darkr

Darkr

    Newbie

  • Members
  • 16 posts
  •  
    India

Posted 22 September 2022 - 11:53 AM

JFYI, the Alternative Download site also has a version of E2B which includes grub4efi as well as Ventoy and agFM.
See Latest Betas - current latest is Easy2Boot_v2.16f_EFIBeta.zip


Bro you forget refind and clover also included....
Refind haves gr8..
I am install in efi shell
  • steve6375 likes this

#21 alacran

alacran

    Platinum Member

  • .script developer
  • 2710 posts
  •  
    Mexico

Posted 23 September 2022 - 04:41 AM

New Ventoy version available:

 

Ventoy 1.0.80 release.

 

alacran



#22 alacran

alacran

    Platinum Member

  • .script developer
  • 2710 posts
  •  
    Mexico

Posted 24 September 2022 - 11:17 AM

New version just released:

 

Integrate grub4dos UEFI and MBR in Ventoy devices v1.1

 

Changes:

  • UEFI grub4dos secondary menus moved to Ventoy partition, to avoid deletion when updating Ventoy version.
  • Improved info in all secondary menus for UEFI and MBR.
  • Improved info into VHD folder, to make easier for the user to use 2 partitions VHDs, or single partition VHDs.
  • Optionally integrate "alive's grub2 File Manager"

alacran


  • Darkr likes this

#23 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 24 September 2022 - 11:44 AM

@alacran

I see some of your menus (e.g. UEFI-vhds.lst) assume that the USB boot drive is hd0.

 

With UEFI this cannot be assumed. Unlike MBR\Legacy grub4dos/grub2 etc.  the boot drive is often not hd0 - it can be hd4 or hd1 or anything.

hd0 under UEFI could be the users main system hard disk!

 

You can use  %@BOOT%  to find the boot device and partition under grub4dos and grub4efi

echo %@BOOT%

(hd3,0)

 

_BOOT can also be used (same as @BOOT)

# get BOOT DISK - e.g. hd0 or hd13
set BOOTDEV=%_BOOT:~1,4%
if "%BOOTDEV:~3,1%"=="," set BOOTDEV=%BOOTDEV:~0,3%

P.S. download 1.1 still seems to have files for Ptn2 VTOYEFI_partition.7z  - so is it still necessary to modify the Ptn2?


Edited by steve6375, 24 September 2022 - 11:53 AM.

  • alacran and Darkr like this

#24 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 24 September 2022 - 12:04 PM

P.S. Just in case you didn't know. Another internal variable is @uefi

 

so under grub4dos, @uefi is not set, but under grub4efi64 it is set to 64 and under grub4efi32 it is set to 32

 

So you can use the same menu.lst file for all boot environments by checking this variable

 

either using

iftitle [ if not exist @uefi ] Legacy menu

or in menu body

map (hd0,0)/VHD/10XPE_x64-LZX.vhd (hd)
root (hd-1,0)
if not exist @uefi chainloader /bootmgr || chainloader (hd-1)

hth


  • alacran and devdevadev like this

#25 alacran

alacran

    Platinum Member

  • .script developer
  • 2710 posts
  •  
    Mexico

Posted 24 September 2022 - 01:22 PM

P.S. download 1.1 still seems to have files for Ptn2 VTOYEFI_partition.7z  - so is it still necessary to modify the Ptn2?

 

Yes, a just installed or updated Ventoy, lacks in VTOYEFI partition all files required to launch G4E, so it is required to add them.

 

EDIT: Thanks for the tips in your two previous posts.

 

alacran







Also tagged with one or more of these keywords: grub4dos uefi, grub4dos mbr, ventoy

3 user(s) are reading this topic

0 members, 3 guests, 0 anonymous users