Thursday, 3 December 2020

agFM v1.66Beta12 available (and how to MBR-boot the grubfm.iso from grub2)

agFM Beta12

agFM Beta10 adds a new F10 hotkey function (new hidden feature).

If you press F10 in a grubfm menu, then it will completely reload grub2.

You may find this useful if you run an ISO or some other payload file and grubfm loses the gfxmenu system and just displays a black-and-white text menu. If you then press F10 then the whole agFM boot file will be reloaded thus saving you having to reboot. Since some servers can take 5 minutes to reboot, you might find this useful.

The actual code is compiled within agFM (in global.sh), but if you are interested, you can add a menuentry to your own menu system as shown below:

# Set F10 to reload startup menu - use 'menuentry' keyword if you want the entry to be seen in the menu system
hiddenentry "[F10] Reload Menu System..." --hotkey f10 --class=go-previous {
if [ "${EFI64}" = "true" ]; then 
chainloader (${user})/grubfmx64.efi
fi
if [ "${EFI32}" = "true" ]; then 
chainloader (${user})/EFI/BOOT/BOOTIA32.EFI
fi
if [ "${MBR}" = "true" ]; then
set cmd="map --mem (hd0,1)/e2b/grubfm.iso (0xff);map --hook;rootnoverify (0xff);chainloader (0xff);"
linux16 ${prefix}/grub.exe --config-file=$cmd
fi
grubfm "${grubfm_current_path}"
}

Note: Ctrl+F10 cannot be used because the hex key code is different between MBR and UEFI - so I have used F10 instead.

Beta12 also adds an improved SAMPLE_startup_menu.txt file. You can now have many more than 10 entries and specify an icon and hotkey for each menu entry. The sample_slack theme now has a timeout counter added so that if you use the fm.txt file for your startup menu, you will see the F1-F6 icons at the bottom and a timeout counter (if you specify a timeout).

SAMPLE_startup_menu.txt example using internal 'slack' theme.

Example for a 64-bit ISO with icon and hotkey w

if $CPU64 ; then
    set gmenu="(${bootdev},1)/_ISO/WINDOWS/WIN10/Windows10_2020_04_20_UK_Both.iso"
    set gmenu_title="[W] Windows 10 Dual x64 UK (ISO)"
    set gmenu_type="wininst"
    make_entry nt6 w
fi

The first make_entry parameter 'nt6' is the name of the icon to use for the menu entry. The second parameter 'w' is the hotkey. Both are optional.

Load the agFM grubfm.iso from grub2

A few people have asked me how to boot to the grubfm.iso from a different version of grub2.

The grubfm.iso file does not boot nicely from a normal grub2 menu, but this can be done by using the grub4dos .exe file which is within the ISO and then using it to boot itself!

loopback loop (hd0,2)/e2b/grubfm.iso
loopback loop1 (loop)/fm.loop
set root=loop1
set cmd="map --mem (hd0,1)/e2b/grubfm.iso (0xff);map --hook;rootnoverify (0xff);chainloader (0xff);"
linux16 /boot/grubfm/grub.exe --config-file=$cmd

This does not seem to work under Ventoy's grub2 however (the fm.loop fails to load).

You could try:
linux (hd0,2)/e2b/loadfm  
initrd (hd0,2)/e2b/grubfm.iso

this requires the file /e2b/loadfm to be present (which it is in Beta10).

Grub2 menu for Ventoy



Here is a sample /ventoy/ventoy_grub.cfg file which will load agFM or Easy2Boot when you press F6 for the Extended grub2 menu.

This requires the file loadfm to be present in the e2b folder on the 2nd partition.
You will only see the Easy2Boot menu entry if Ventoy was booted in Legacy mode.



menuentry "Load agFM Menu" --class=custom {
if [ "${grub_platform}_${grub_cpu}" = "pc_i386" ]; then
linux ${vtoy_efi_part}/e2b/loadfm
initrd ${vtoy_efi_part}/e2b/grubfm.iso
else
chainloader ${vtoy_efi_part}/grubfmx64.efi
fi
}

if [ "${grub_platform}_${grub_cpu}" = "pc_i386" ]; then
menuentry "Load Easy2Boot Menu" --class=custom {
insmod ntldr
set root=${vtoydev},1
ntldr ${vtoy_iso_part}/grldr
}
fi


submenu 'My Custom SubMenu -->' --class=customsub {        
    menuentry "My Custom Menu2" --class=custom2 {
        echo 'This is custom menu2 ... '
        sleep 1    
    }
    
    menuentry '<-- Return to previous menu [Esc]' --class=vtoyret VTOY_RET {
        echo 'Return ...'
    }
}

menuentry '<-- Return to previous menu [Esc]' --class=vtoyret VTOY_RET {
    echo 'Return ...'
}

sample files are in the \ventoy folder on partition 2 (agFM partition).

You can run grub4dos commands using grub.exe from the Ventoy F6 menu. See 'Getting started with Ventoy' eBook for details (including workaround for paths which contain spaces).

2 comments:

  1. Can we not just use following commands within from grub2 to boot grubfm.iso in MBR mode ?

    GRUB 2
    linux /loadfm
    initrd /grubfm.iso

    ReplyDelete
  2. Hello Steve Master.
    It is not related to the subject. Sorry for that, I am writing here because I do not know where to write, but I will be glad if you help on this subject. When loading the first loader in Multiboot, I adjust the resolution as follows.
    set gfxmode=1024x768
    gfxmode=auto
    terminal_output gfxterm
    I set the resolution in this way, while the loader is loaded, it is set according to the resolution of the video card (1440x900), then I use a config file for grubfm, accordingly, although the resolution is 1024x768, this resolution is not activated. It starts with the resolution (1440x900) selected with the loder. How can you suggest a combination or code sample to load the resolution as 1024x768 when loading grubfm. Thank you.

    ReplyDelete