Wednesday, 18 August 2021

Latest E2B+agFM Betas now support grub4efi

You can now have the same E2B menu system in both MBR\Legacy mode and UEFI mode! 

grub4efi by chenall\yaya2007/a1ive is the UEFI version of grub4dos.

Most of the commands in grub4efi are the same as used by grub4dos.

The latest Beta of E2B now contains grub4efi.

How to update your E2B USB drive

Download latest Betas from here.

1. Your E2B USB drive must contain a 2nd FAT32 partition (approx. 100MB or larger)

2. Download the latest E2B Beta .zip file and unzip it to a new folder on your Windows drive. Then run the \UPDATE_E2B_DRIVE.cmd file to update the files on the first partition of your E2B USB drive.

E2B v2.10g with grub4efi

3. Download the latest agFM Beta .zip file and extract the contents directly onto the 2nd FAT32 partition of your E2B drive. The main difference is that the default menu contains an entry to load grub4efi.

E2B UEFI File Manager agFM v1.74aBeta

4. If you have created your own agFM menu file (\boot\grubfm\startup_menu.txt) then you must add an extra menu entry into it so that you can boot to grub4efi:

if $EFI64; then
if [ -f "(${bootdev},1)/_ISO/e2b/grub/BOOTX64.EFI" ] ; then
menuentry "Grub4EFI (UEFI64)" --class=settings {
chainloader "(${bootdev},1)/_ISO/e2b/grub/BOOTX64.EFI"
}
fi
fi

If startup_menu.txt does not exist then you do not need to change anything.


How to use grub4efi

1. First you must UEFI64-boot to the 2nd partition of the E2B USB drive. This will load the agFM start-up menu.

2. On the agFM start-up menu, you should see a menu entry for Easy2Boot (UEFI64)...

Default agFM menu now shows Easy2Boot grub4efi menu entry


Note that UEFI32 is not currently working for grub4efi (the utilities such as hotkey and fat do not work) and it does not seem to work under VBox or QEMU in UEFI32 mode.

3. After selecting the grub4efi menu entry, you should now see the familiar E2B grub4dos menu (except it is now working in UEFI64 mode!).

Note that the Kaspersky shim is used, so you can Secure Boot to agFM and then to grub4efi (or Ventoy). You can then install Windows/Ubuntu in Secure Boot mode or boot to Windows from a local disk using F7.

Using grub4efi

The \_ISO\MyE2B.cfg user configuration file determines the behaviour and appearance of both the MBR\Legacy-mode and UEFI-mode E2B menus.

You should find most grub4efi commands work in the same way as they did for grub4dos.

Note that the DOS menu will no longer be visible in the grub4efi menu and the XP menu entries in the Windows Install menu will also be suppressed as these will not work in UEFI mode.

If you are using the default Main Menu heading instead of defining your own heading in your MyE2B.cfg file, you may also see 'EFI64' in the heading and the default colour for the menu entries is now white (unless you have specified a different colour in the MyE2B.cfg file). You may also see the drive type of either 'Fixed Disk' or 'Removable Disk' listed in the heading...

Default Main menu heading has 'EFI64' and 'Fixed Disk' or 'Removable Disk'

If you have the 'Play Tunes' menu (added by running the Pimp My Drive.cmd file), then you can also play tunes on the internal mainboard speaker (if fitted) - however the playing of tunes in the background is not supported - you must wait for the tune to finish or type Ctrl-C to abort the tunes batch file.

File extensions of .isopersist, .isopersistdebian and .isopup should also work in UEFI-mode.
Booting to Linux and Windows ISOs, Windows VHD files (if they support UEFI64) and .WIM files is also supported.

The new grub4efi variable @uefi can be used to determine what mode we have booted in:

if exist @uefi              - tests for UEFI32 and UEFI64 modes
if not exist @uefi        - tests for Legacy\MBR mode
if "%@uefi%"=="64"  - tests for UEFI64 mode
if "%@uefi%"=="32"  - tests for UEFI32 mode (UEFI32 is not yet fully working however!)

New filename suffixes

File extensions with suffixes are still supported as before - e.g. .iso64, but because we can now run payload files in both Legacy mode, UEFI64 mode and (later we hope) UEFI32 mode, you can now prevent any payload file from being listed in the E2B menus (not the agFM or Ventoy menus!) by just adding a suffix to its filename:

You can add one or more of these name suffixes to ensures non-bootable ISOs are not listed in menu:

_.MBROK  - will be displayed  in E2B Legacy menu
_.EFIOK     - will be displayed  in EFI32 and EFI64 menu
_.EFI32OK -  will be displayed in EFI32 menu
_.EFI64OK - will be displayed  in EFI64 menu

e.g. Ubuntu_.MBROK.iso   will be listed in the E2B menu as 'Ubuntu' - but only in the Legacy-mode E2B menu system.

You can combine the suffixes - e.g.  Ubuntu x64_.MBROK_.EFI64OK_.isodef.iso   - the menu entry is displayed as Ubuntu x64, the override extension .isodef is added so that alternative file extensions are not suggested and it boots immediately - the override extension must always be last and just before the real file extension. Some WinPE files may require a _.isoPE01 suffix instead.

Any characters past _. will not be displayed in the menu as long as EXTOFF=1 is set in MyE2B.cfg file.

Note that a filename of kali-linux-2021.2-live-amd64.isodef64  - works with E2B and agFM - but it is not recognised by Ventoy due to the non-standard file extension. Instead we can use kali-linux-2021.2-live-amd64_.EFI64OK_.MBROK_.isodef.iso - E2B displays it in MBR and EFI64 BIOS modes only (not in UEFI32), and it also works in agFM and Ventoy

Tested payloads (UEFI grub4efi)

Windows 8/10/11 on Removable and Fixed
winbuilder iso WIN10_PESEx64.iso
HBCD v1.0.2 use .isoPE01
DLCBoot
ParrotOS
ArchLinux install 5.12.8
Debian Live
Fedora
Knoppix 8.6.1
PopOS Gorilla
SCRE - storage recovery
puppy slacko64 7
FatDog
Ubuntu21
Kali Linux + persistence
Parrot OS
WiFi Slax
System Rescue CD
ArchLinux
Debian install DVD1
Supergrubdisk iso - need to load efi.img as fd9 and then chainload /efi/boot/efi.img
PartedMagic
GParted
DrWebb
Eset SysRescue
rescatux
LinuxMint xfce 20.1
WinToGo WIn8 VHD  fixed 25GB  (fat+ntfs)
Gandalf Redtsone 5 iso
DLCBoot iso 2019 v3.6 + 2017 v3.4
Medicat v18.10 iso
Strelec iso 2019.02.04 Eng + 2021.01.05 Eng and 3017
Bob Ombs v4.8 iso
HBCD_PE v1.01 and v1.02
Acronis True Image iso + linux version
EaseUS Data Recovery Wizard ISO 13.2
R-Drive Image iso
Porteus Kiosk
Super Grub2 disk 2.0.2
Tails 4.2 (as .imgptn23)
Ubuntu + persistence (.mnu file)
XUbuntu
Gandalf Redstone 3
Gandalf Redstone 5
WinPESE 1607 ISO
WinPE All-in-one ISO
Various WinPE WIM files

.imgPTN, .imgPTN23 and .imgPTNREP3 files should also work under grub4efi.
The new batch file checkptns.g4b will check the USB partitions for you when you run it from the grub4dos command line. Note that if the partitions are not in ascending order after installing a partition image file, the UEFI filesystem will probably refuse to 'see' any of the partitions (unlike Legacy mode which doesn't care about the partition order). Files ending in .imgPTNREP3 must be on partition 3 of the E2B USB drive and you must use a special .mnu to list the files on partition 3 (copy the file  "\_ISO\docs\Sample mnu files\E2B Menus\PTN3_IMGPTNREP3_MENU.mnu" to the \_ISO\MAINMENU folder). There is also RestoreMBR.g4b which you can use after an MBR\Legacy-boot to E2B to restore the original E2B partitions.
Note: you may need to hit Ctrl+F8 to reload grub4efi when you switch in a new partition or reboot! You can boot UEFI-boot to agFM and restore the original partitions.

Some notes

1. If you want it to UEFI-boot to the E2B grub4efi menu without having to select the menu entry in agFM. Add the seven-line menu entry in blue text shown above into your \boot\grubfm\startup_menu.txt file if you made one. Just make sure it is the first 'menuentry' in the list. Do NOT change the 'set default=0' line - it must be set to 0 for the agFM menu to work correctly.
 
Then change the timeout value from -1 to something short like 2 for 2 seconds...

# Menu Timeout in seconds (-1 = disable)
set timeout=2

2. agFM will load the \_ISO\e2b\grub\bootx64.efi boot file which is the grub4efi UEFI64 file. It has an internal menu which then loads \_ISO\e2b\grub\menuefi.lst after a 5 second delay. See eBook #1 if you want to supress this delay screen.

3. The new grub4efi utilities such as 'hotkey', 'wenv' and 'fat' are in the \_ISO\e2b\grub\efi_utils folder. The legacy versions of these are now in the \_ISO\e2b\grub\mbr_utils folder.

Because the command path is set to \_ISO\e2b\grub in E2B, the files in that folder named fat, wenv and hotkey are actually now batch files containing this code:

!BAT
if exist @uefi     (bd)/_ISO/e2b/grub/efi_utils/%~n0 %*
if not exist @uefi (bd)/_ISO/e2b/grub/mbr_utils/%~n0 %*

This allows the existing menus and batch files to call hotkey, fat and wenv and they will still work as before in both Legacy and UEFI modes. However, if you use insmod to load any utility, you must use the correct full path.

Note that a new grub4efi utility 'efidiskutil' by a1ive can report various features of USB and non-USB disks such as read-only status, current USB protocol, block size, USB Removable (flash) or Fixed type.

4. grub4efi does not support 'wimboot' (which is a major problem!), so if E2B detects that the USB drive is a Removable disk then the Windows \AutoUnattend.xml feature is used to so that Windows Install ISOs are loaded as a virtual DVD before Setup is launched. However, if the USB drive is a Fixed Disk type that mechanism does not work, so instead agFM is called which uses the wimboot file injection method.

Current 'open' bugs for grub4dos\grub4efi are listed here.

There are still a few bugs in grub4efi to do with writing to the screen in graphics mode and mapping ISO files. You can use Ctrl+F8 to reload grub4efi if the menu system stops working properly.

PassPass does not work under UEFI because the uefi version of wenv is buggy.

Note: The map command in grub4efi does not require the map --hook command, but if you do too many map commands then it no longer works - see bug list for details.

Some screens are a bit 'messy' when booting and some debug messages are still displayed.

Let me know if you find any issues.

reboot.pro links


Please subscribe for more new and tips!

2 comments:

  1. Hi Steve, where can I find this agFM v1.74aBeta?
    Thanks.

    ReplyDelete
    Replies
    1. Nevermind, it was in "BOX", but not in onedrive

      Delete