Jump to content

- - - - -

Passing parameters from grub2 to grub4dos\grub4efi

  • Please log in to reply
No replies to this topic

#1 steve6375


    Platinum Member

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

Posted 4 weeks ago

If you want to pass parameters from a grub2 environment to grub4dos, you can use grub.exe.


For instance you boot to Ventoy but then want to run a simple Linux ISO using grub4dos.


e.g. legacy grub2 -> loads legacy grub4dos and executes grub4dos commands...

menuentry "Boot mycd.iso" {
set opts='map /test/mycd.iso (0xff); map --hook; chainloader (0xff);'
linux /boot/grub/grub4dos.exe --config-file=${opts}

however, grub4efi (grub4dos for efi) has no equivalent mechanism.


We can save variables in grub2\grubfm\Ventoy using the save_env command however, e.g.

save_env -f (hd0,1)/ventoy/grubenv vt_param

This means we can then reboot or load a different bootloader such as grub4efi and parse the grubenv file when menu.lst is loaded.

# get the variable vt_param into the grub4dos variable P (and grub4dos variable vt_param)
/grubenv.g4b vt_param "(bd)/ventoy/grubenv"

We also need to convert any file path to be grub4dos compatible. 


See here for more details.


The batch files can be found in Easy2Boot2.20aBeta.zip on the E2B Alternate Downloads page.

I attach current version here too,





Attached Files

#2 a1ive



  • Developer
  • 58 posts

Posted 2 weeks ago

You can use g4e extcmd "cmdline" to get the uefi command line.
in grub2:
chainloader /g4ex64.efi foo bar
in g4e:
echo %?%


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users