UEFI/MBR a1ive grub2 File Manager (agFM)

The grub2 UEFI add-on for E2B.
 
agFM is new for 2020 (and is still being developed/improved)! 
 
  • Direct UEFI-boot from Windows Install ISO files, Linux ISOs, WIM, VHD, EFI and IMG files.
  • Secure UEFI-boot from ISOs (except to Windows Install ISOs).
  • Secure UEFI-boot from Windows Install .imgPTN files + other OS's.
  • UEFI-boot to NTFS .imgPTN files (e.g. for large Windows Install ISOs >4GB).
I recommend you update to E2B v1.B8A or v1.B9 or later which has better support for the agFM. v1.B9g Beta or later will automatically download agFM when you create a new E2B USB drive.
See 'Instructions' section below for download details.
No eBook is available for agFM yet - it is still under development.
DOWNLOAD agFM: E2B UEFI Fil e Manager .zip file.
 
agFM is still in Beta status and you should check for the most recent version and follow the blog for changes, etc..
 
Version History (check date of \grubfmx64.efi file):
v1.4 Requires FAT32 partition to be type 0C for .imgPTN switching
v1.5 FAT32 partition can be type 0B or type 0C - incl. latest Feb 03 2002 grub2
v1.6 RESTORE_E2B.cfg file updated.
v1.7 Automatically recognises .imgPTN, .imgPTN23, .imgPTNauto and .imgPTN23auto files (no need for .cfg file) + few bugfixes.
v1.8 2020-02-10 Bug fixes for .imgPTN, more file extensions recognised
v1.9 2020-02-11 Improve .imgPTN handling, font size reduced, latest grub2\agFM
v1.10 2020-02-13 .imgPTN* and .cfg files now run immediately they are selected (note: if you have existing .cfg files you will need to update them for the 'Cancel' operation to work. F3 boot menu now shows drive info inc. volume label, grub2 fixes for stat -c command not crashing.
v1.11 2020-02-14 Allow user to define a startup_menu.txt file with default menu items + timeout.
v1.12 2020-02-15 agFM now only lists bootable files in the menu. Added SHOW ALL FILES (agFM).cfg and SHOW ONLY BOOT FILES (agFM).cfg.
v1.13 2020-02-17 Using extension of .isodef, .isodefault, .isodd, .iso01, .iso32, .iso64, .isoPE, .isoPE01 will now immediately boot the ISO using E2B\partnew. Add diagnostic menu entry to users startup_menu.txt, support E2B-style MBR-booting of .iso* and .wim files with spaces in filenames. Display ISO icons in menu after selecting the ISO. Clear type 0 partitions on boot.
v1.14 2020-02-18 Improve direct booting of WinPE ISOs (HBCD PE, Win10XPSE, etc.).
v1.15 2020-02-19 Add support for user-defined theme or text+wallpaper menu.
 
agFM for E2B is still under active development, please contact me if you find any issues with the latest version of agFM and the latest Beta version of E2B.
 

Update agFM

1. Download latest E2B UEFI File Manager v1.x.zip and extract all files to the 2nd FAT32 partition.
2. If you have used any .cfg files or .grubfm files, check in the 'Menu Files to copy to payload volume' folder to see if there is a later version.
Especially check for a later version of agFM_imgPTN_v1x.cfg as this may be improved\changed.
 

Introduction

The E2B UEFI File Manager .zip file contains a1ive's version of grub2 and the grub2 File Manager (Open Source on GitHub) and also boot files so we can Secure UEFI64-boot directly from the payload files on the E2B USB drive. Just copy the files to the FAT32 2nd partition.
 
Partition 1 E2B:                PRIMARY NTFS   - E2B files + added payload files
Partition 2 E2B_PTN2:     PRIMARY FAT32 - agFM files
 
UEFI-boot - browse to the file you want - boot it!
 
Secure UEFI64 should work without needing to disable Secure Boot (even for unsigned ISOs). 
Microsoft Windows Install ISOs require the Secure Boot option to be set to 'Other OS' in BIOS first or else you must select a Windows E2B .imgPTN file to Secure boot from.
 
The agFM can switch-in .imgPTN files or restore the E2B partition - you do not need to boot to WinPE or MBR-boot!
 
Windows Install ISOs also work with SDI_CHOCO XML files too for fully automated installs!
 
  • Install Windows - use to install Windows from a Windows Install ISO
  • Boot ISO (Easy2Boot/partnew) - mainly used for Linux ISOs
  • Boot ISO (map) - only works for some ISOs
  • Easy2Boot Image Partition (.imgPTN) - mainly used for Secure UEFI64-boot to Windows Installers or AIO WinPE OS's
  • User menu - runs the user-added .grubfm menu file
 

File types

Not case sensitive.
Supports Secure UEFI64, UEFI64, UEFI32 as well as MBR\Legacy booting:
 
.ISO - Linux, Windows Install, WinPE, Android (Windows Install ISO may require 2GB RAM or more)
.XML - unattend.xml files can be used with Windows Install ISOs
.IMG - disk image
.VHD - Virtual Hard Disk Image
.WIM - NT6 wim file (using wimboot or NTBOOT)
.EFI - EFI applications, boot loaders, etc. (e.g. MemTest86, KonBoot)
.LUA - lua scripts
.CFG - grub2 menus or commands
.GRUBFM - grub2 menus or commands written for the grubfm menu system - e.g. Ubuntu ISO + persistence
.LST - grub4dos menu (MBR mode only)
also .IPXE (ipxe boot file), .MOD (grub2 module), .PF2 (loads a grub2 font file - e.g. unicode-large.pf2), .JPG and  .PNG (display only).
 

E2B File extensions

.IMGPTN, .IMGPTN23, .IMGPTNAUTO, .IMGPTN23AUTO, .ISO01, .ISOdd, .ISOdefault, .ISOdef, .ISOPE, .ISOPE01, .ISO32, .ISO64.
 
Feature table:
Includes Windows Install ISOs with XML files.
 
Note: For UEFI Secure Boot + Install Windows, BIOS must be set to UEFI: 'Boot other OS' instead of UEFI: 'Microsoft Windows' or you will get 0xc000000f 'Windows failed to start' error. OR select a Windows .imgPTN file (see below).
 

Instructions

Note: E2B v1.B9g and later versions  will make a two-partition E2B USB drive and then automatically download and add the agFM files for you if you have a Windows 10 system or a USB hard disk. Download E2B v1.B9g or later - extract the .zip file to an empty folder and run .\Make_E2B.exe as Administrator and click on the button with the large red arrow. Then go to Step 5.
 
1. Prepare an E2B USB drive using the E2B download (download and run the .exe file - you may need to disable your antivirus program if it does not allow writes to the boot sector of USB drives).
 
Note: Beta versions of E2B are in .ZIP form. Download the .ZIP file - extract the contents into an empty folder - run \Make_E2B.exe as Administrator. You can update an existing E2B drive or reformat a USB drive.
 
2. Delete the second PTN2 partition and create a new FAT32 Primary partition (min. recommended size 100MB or more). It may be necessary to shrink the E2B partition slightly first using EaseUS Partition Master or a similar tool. You can use the Windows Format tool to format a FAT32 partition as Type 0C. I also recommend you always leave the last 1MB of a drive unused for best compatibility with all BIOSes - i.e. there should be 1-10MB or more of unused space after the last partition.
 
Partition 1: Type 07          PRIMARY NTFS  (recommended max. size 128GiB for best compatibility)
Partition 2: Type 0B or 0C PRIMARY FAT32 (recommended min. size 100MB, max. 32GiB for best compatibility)
Partition 3: Unused (you can add a partition 3 but it will limit some uses)
Partition 4: Unused (MUST BE FREE)
+[leave 1MiB+ of unused disk space at end of drive - *recommended for best compatibility - last sectors of disk should not be used]
 
If your E2B USB drive is larger than 128GiB, you may want to create a third NTFS partition which can be used to store applications or backup images, etc. Note that this may limit some E2B features however (e.g. Linux ISO+persistence).
 
Note: Do not use Logical partitions! If it does not UEFI-boot, check the partitions using RMPrepUSB - Drive Info - 0.
 
For UEFI-booting, the partition entries must have the START sectors in ascending order (partition 1 must start before partition 2).
 
Example RMPrepUSB - Drive Info output
Partition 1   SIZE=102398.616MiB   Type: 07 NTFS\exFAT  *ACTIVE*
START POS   = CYL:0 HD:32 SEC:33       END POS = CYL:1023 HD:254 SEC:63
START (LBA) = 2,048 (00000800) SIZE (LBA) = 209,712,366 (0C7FF4EE) [End=209,714,413]
 
Partition 2   SIZE=19489.33MiB   Type: 0C FAT32LBA (2047GB max)       
START POS   = CYL:1023 HD:254 SEC:63       END POS = CYL:1023 HD:254 SEC:63
START (LBA) = 209,714,414 (0C7FFCEE) SIZE (LBA) = 39,914,147 (02610AA3) [End=249,628,560]
 
Partition 3   SIZE=0MiB   Type: 00        
START POS   = CYL:0 HD:0 SEC:0       END POS = CYL:0 HD:0 SEC:0
START (LBA) = 0 (00000000) SIZE (LBA) = 0 (00000000)
 
Partition 4   SIZE=1039.689MiB   Type: 00        
START POS   = CYL:0 HD:0 SEC:0       END POS = CYL:0 HD:0 SEC:0
START (LBA) = 0 (00000000) SIZE (LBA) = 0 (00000000)
 
P1   Start=2,048 (1,048,576 bytes) End=209,714,413 (107,373,779,456 bytes)
P2   Start=209,714,414 (107,373,779,968 bytes) End=249,628,560 (127,809,822,720 bytes)
 
Drive 4  SanDisk Extreme Pro  F/W Rev.=0  Serial No.= [ bytes = 00 00 00 00 00 00 00 00 ]
Reported size 128,043,712,512 bytes (119.25GiB)  Last LBA 250,085,375
RMPrepUSB Max 128,034,708,480 bytes (119.2416GiB)  Last LBA 250,067,789
 
 
3. Download the latest 'E2B UEFI File Manager vx.x.zip' file. There may be more than one version or more than one language. Choose the latest version. Do not download the imgptn file.
 
The download file can be found in the Alternate Dow nload Areas - a1live grub2 file manager folder (e.g. E2B UEFI File Manager v1.5.zip includes MemTest86, Secure UEFI64 boot and .imgPTN switching).
 
 
4. Extract the files from the "E2B UEFI File Manager vx.x.zip' file directly to the FAT32 partition on the USB drive.
 
 
Note: If you are using a Win XP/7/8 system, you will not be able to access the 2nd FAT32 partition on the Removable USB drive. You can temporarily switch over partition 1 with partition 2 by running \_ISO\SWITCH_E2B.exe.
 
 
5. Move the file \grub_filemanager.mnu to the \_ISO\MAINMENU folder on the E2B partition. Edit this file to change the language\text if you wish. This will allow you to run the grub2 file manager from the E2B Main Menu (optional). I strongly suggest you use the E2B menu for MBR booting as it should be more successful for most payloads. The agFM menu system however may be able to boot non-contiguous Linux ISOs more successfully.
 
6. Copy the file \_ISO\WINDOWS\WIN8\NO KEY (choose a version to install).xml to the folder \_ISO\WINDOWS\WIN7. You can use this XML file after you select a Windows 7 ISO so that all Editions wil be available to install.
 
7. Copy your ISO files, VHD files, WIM files, .imgPTN files, EFI files, IMG files, etc, to the first E2B NTFS partition. Use the menu folders which are already provided for you (e.g. \_ISO\MAINMENU, \_ISO\ANTIVIRUS, \_ISO\WINDOWS\WIN10, etc.). Change the .imgPTN file extensions to .imgPTN23 so that the second and third partitions will remain when you switch in a .imgPTN23 file.
 
8. Run \MAKE_THIS_DRIVE_CONTIGUOUS.cmd to make all the files on the first NTFS partition contiguous. Linux .ISOs and .imgPTN files must be contiguous when using 'Easy2Boot/partnew' boot options.
 
Tip: Rename \_ISO\UTILITIES_MEMTEST\Passmark Memtest86 (MBR+UEFI).imgPTN to Passmark Memtest86 (MBR+UEFI).imgPTN23 so it can be easily used with agFM.
 
Tip: As with the E2B menu system, if the file extension is .ISO then you will be prompted with a choice of boot methods, however if you use an E2B file extension (.isodef, .isodefault, .isodd, .iso01, .iso32, .iso64, .isoPE, .isoPE01) then it will immediately boot the ISO - e.g. use .isodef for Linux ISOs.
 

Usage

You should now be able to load the grub2 File Manager from the E2B Main Menu, or directly UEFI-boot to the grub2 File Manager.
 
Use the E2B menu system for MBR booting and the grub2 File Manager for UEFI-booting.
 

Using the a1ive grub2 File Manager

 
You can browse to the \_ISO folder on the E2B drive to boot .ISO, .WIM and .VHD files. 
 
.imgPTN files must be on the first partition if you want to UEFI-boot from them. I recommend using .imgPTN23 so that the agFM partition is always available. Files MUST be contiguous.
 
Linux ISOs - Choose the Easy2Boot (partnew) option if available for Linux ISOs (ISO files must be contiguous). Use a .isodef file extension for quick booting.
 
Windows Install ISOs - Choose 'Install Windows' to boot to Windows Install ISOs.
 
Note: For Secure Boot + Install Windows, BIOS must be set to UEFI Secure Boot: 'Boot other OS' instead of 'Microsoft Windows' or will get 0xc000000f 'Windows failed to start' error. To change the Secure Boot BIOS option you may need to first set a BIOS Supervisor Password and then reboot back to the BIOS Setup menu on some computers.
If the BIOS is set to Secure Microsoft UEFI, you can install Windows from a Windows Install ISO by first Secure UEFI-booting to a WinPE ISO (e.g. Strelec, Bob Omb's, DLC, Hirens WinPE) and then running WinNTSetup. Alternatively, use a .imgPTN23 file (see below for details).
Note: If booting to a Windows 7 or Windows 8.1 Install ISO, choose 'Install Windows' and then choose the NO KEY (choose a version to install).xml file to see all Editions in the Win7 ISO and to avoid having to enter a Product Key for Win 8.1.
 
You can select an XML file if one is present in the same folder as your Windows Install ISO. This means you can use SDI_CHOCO XML files with your Windows Install ISOs in the same way that it works with MBR\Legacy booting.
 
Choose 'NT5' option to boot to XP-based payloads (does not include E2B DPMS drivers) - I suggest you use the Easy2Boot menu for XP installs.
 
Use .isoPE or .isoPE01 for WinPE ISOs (or keep as .ISO and use the 'Install Windows' menu entry).
 
You can boot directly from WindowsToGo .VHD or .VHDX files (use the 'Boot Windows NT6.x VHD\VHDx (NTBOOT)' menu entry if UEFI booting.
 
You can boot directly to WinPE .WIM files.
 
You can also make your own grub2 menus by using a file with the .cfg or .grubfm file extension. 
 
See here for an example of a Ubuntu-based ISO + persistence.
 
grub2 and linux can be 'fussy' about spaces and non-standard characters in filenames. Always use paths and filenames which do not contain spaces. Once you have it working, then you can try adding spaces and changing the filename. Always avoid using folder paths which contain spaces.
If the graohical menu is slow to scroll, press F4 and then T to switch to terminal mode.
 

Selecting a .ISO file

The agFM may provide you with a list of boot choices after you select a file with a .ISO file extension:
 
 
  • Boot ISO (Easy2Boot\partnew) - writes an entry for the ISO into partiton table entry 4 - the ISO file MUST be contiguous. Use for most Linux ISOs.
  • Install Windows - Usually runs Windows Setup or WinPE. Use if the ISO is a Windows boot ISO. Using .isoPE extension will auto-select this option.
  • Boot ISO (Loopback) - uses the grub2 loopback command - suitable only for booting simple linux kernels unless agFM recognises the ISO (the icon will show the identified Linux distro type).
  • Boot ISO (loopback.cfg) - use the loopback.cfg file within the ISO - this often contains a cheat code that specifies the name of the ISO to allow booting directly from the ISO file - use if the Easy2Boot\partnew option does not work.
  • Boot ISO (map) - uses the grub4dos map command to map the ISO as cd device (0xff) in Legacy mode, or uses the grub2 map command if UEFI.
  • User menu - runs the .grubfm grub2 file which must have the same path and filename as the ISO file.
If you use a recognised E2B file extension - e.g. .isodef, then the 'Boot ISO (Easy2Boot\partnew)' entry will be automatically used and his secondary menu will not be displayed.
 

F4 Settings Menu

 
 

BIOS bugs!

Many BIOSes have some bugs:
1. In MBR\Legacy mode, files positioned beyond 128GiB on the disk cannot be accessed. This is why the first partition should be no larger than 128GiB.
2. Some UEFI-enabled BIOSes will ALWAYS boot to the grub2 UEFI boot files - you will not be able to boot to the E2B (Legacy) menu even if you enable CSM mode and disable Secure Boot. To fix this, you can temporarily rename the \EFI folder on the 2nd FAT32 partition to something else (e.g. EFIx). This will prevent it from UEFI-booting.
 
Note: If Windows 10 UEFI boot gives a 0xc000000f unexpected error then Secure Boot (Microsoft only) is enabled in the BIOS. 
To fix: disable Secure Boot or set the BIOS to Secure Boot (Other OS) - or use .imgPTN23 files to Secure Boot (see below).
 

Add a grub2 menu

Some ISOs may not be directly UEFI64 bootable or you may want to boot an ISO with different parameters (cheat codes) or boot with persistence.
 
There are two types of grub2 menu files which you can add:
 
  • .cfg files        - these can be placed anywhere but must containg the correct path and filenames for each specific payload file. The user can directly select the .cfg file and run it as a .grub2 menu file.
  • .grubfm files - these must be placed in the same folder as the payload file and have the same file name as the payload file - the user must select the payload file (not the .grubfm file).
The most recent examples of these menu files can be found in the Alternate Download Area - alive grub2 Fil e Manager folder.
 
Example .cfg and grubfm files can be found in the agFM downloaded folder \Menu Files to copy to payload volume (these are not actually used by agFM but just provided as sample files).
 
Note: grub2 environment variables are case-sensitive and can be set and used as below:
 
set "fred=xxxxx"
echo ${fred}
 

.cfg files

You can make a grub2 .cfg file and select the file using the File Manager - ('Open as Grub2 Menu' is required on pre-v1.10 versions)...
 
 
You can create a .cfg file in any folder and the .cfg file can have any filename. 
 
If you select the .cfg file and then select the 'File Info' menu entry you can see what pre-defined grub2 variables are available. For instance $grubfm_device will be name of the device+partition and $grubfm_dir will be the directory, so you can use (${grubfm_device})${grubfm_dir}fred.iso which will be equivalent to (hd0,msdos1)/_ISO/LINUX/fred.iso (for example). You will however need to 'hard-code' the name of the file (e.g. fred.iso) that you want to boot.
 
(hd0,msdos1) = first partition
(hd0,msdos2) = second partition
 
.cfg files can be directly loaded as a grub2 menu - therefore the .cfg file can be placed anywhere and can boot any file with any extension.
 
 
Example .cfg files
Navigate to the .cfg file (choose the 'Open as Grub2 Menu' entry if required)...
 
Open agFM at the /_ISO/WINDOWS/WIN10 folder.
grubfm "(hd0,msdos1)/_ISO/WINDOWS/WIN10/"
 
Open agFM and select a specific file.
grubfm_open "(hd0,msdos1)/_ISO/WINDOWS/WIN10/Windows10x64UK_Oct_2018.iso"
 
 

Example Windows 10 x64.cfg menu file:

(This example can be placed anywhere on same partition as ISO and XML file).
 
menuentry "Install Windows 10 1909 x64 Pro Eng" --class=nt6 {
    set "XML=(${grubfm_device})/_ISO/WINDOWS/WIN10/Windows 10 Pro (no prompt to repair).xml"
    set "ISO=(${grubfm_device})/_ISO/WINDOWS/WIN10/Windows10_1909_x64_English_MS.iso"
    set "grubfm_file=${ISO}"
    source (memdisk)/boot/grubfm/rules/iso/win.sh
    win_isoboot "(loop)/sources/boot.wim"  "${XML}"
}
 
 

Example .cfg file for Ubuntu .isopersist file with persistence

 
#Ubuntu x64 iso boot with persistence
#No spaces in filename
#Place this .cfg file in the same partition as the .iso file (any folder)
#Assumes persistent file is in root of E2B partition
#ISO file is in \_ISO\LINUX folder
 
# Only show menu if 64-bit CPU:
if [ "$CPU" == "64" ] ; then
menuentry "Ubuntu 64-bit with persistence" --unrestricted --class ubuntu {
# WARNING: partnew will write a new partition entry
   set "grubfm_per=(${grubfm_device})/ubuntu-18.04.3-desktop-amd64-rw"
   set "grubfm_file=(${grubfm_device})/_ISO/LINUX/ubuntu-18.04.3-desktop-amd64.isopersist"
   set "grubfm_path=/_ISO/LINUX/ubuntu-18.04.3-desktop-amd64.isopersist"
 
if [ ! -e "${grubfm_per}" ] ; then 
echo ERROR ${grubfm_per} does not exist on (${grubfm_device}) ; read ; fi
if [ ! -e "${grubfm_file}" ] ; then 
echo ERROR ${grubfm_file} does not exist on (${grubfm_device}) ; read ; fi
if [ ! -e "(${grubfm_device})${grubfm_path}" ] ; then 
echo ERROR (${grubfm_device})${grubfm_path} does not exist on (${grubfm_device}) ; read ; fi
 
   if ! test -d (${grubfm_disk},4) ; then partnew --type=0x00 --file="${grubfm_per}" (${grubfm_disk}) 4 ; fi
   loopback loop "${grubfm_file}"
   set root=(loop)
   linux (loop)/casper/vmlinuz boot=casper persistent iso-scan/filename=$grubfm_path quiet splash
   initrd (loop)/casper/initrd
   boot
}
fi
 
 

.grubfm files

An alternative is to use a .grubfm file. These are automatically added as a new 'User Menu' menu entry when you select a payload file (e.g. after you select Ubuntu.iso). 
 
The filename of the .grubfm file must exactly match the filename of the payload file and must be in the same folder, e.g.
 
\_ISO\LINUX\Ubuntux64.iso            (select the iso)
\_ISO\LINUX\Ubuntux64.grubfm     (do NOT select this file)
 
Only valid payload file extensions can be used (e.g. .iso, .vhd, .wim, etc.) when using a .grubfm file.
 
 
Available grub2 variables when using .grubfm files:
# available variables are:
# grubfm_file  - (dev)+fullpath+name.ext
# grubfm_path  - e.g. /test/ubunto.iso
# grubfm_dir   - e.g. /test/
# grubfm_device - e.g. hd0,msdos1
# grubfm_disk    - e.g. hd0
# grubfm_name    - e.g. ubuntu.iso
# grubfm_filename - e.g. ubuntu
# grubfm_fileext   - e.g. iso
# grub_platform=efi or pc  (UEFI or Legacy BIOS)
# grub_cpu=i386 or x86_64 (i386=Legacy mode or 32-bit UEFI, x86_64=UEFI64)
# grub_uefi_version  (e.g. 2.4)
# grub_secureboot
# CPU  (=32 or 64)
# grubfm_file        - e.g. (hd0,msdos1)/test/ubuntu.iso
# grubfm_path      - e.g. /test/ubunto.iso
# grubfm_dir         - e.g. /test/
# grubfm_device    - e.g. hd0,msdos1
# grubfm_disk       - e.g. hd0
# grubfm_name     - e.g. ubuntu.iso
# grubfm_filename - e.g. ubuntu
# grubfm_fileext     - e.g. iso
# grub_platform=efi or pc  (UEFI or Legacy BIOS)
# grub_cpu=i386 or x86_64 (i386=Legacy mode or 32-bit UEFI, x86_64=UEFI64)
# grub_uefi_version  (e.g. 2.4)
# grub_secureboot
# CPU  (32 or 64)
 
Tip: Use the 'File Info' menu entry to view these variables for the chosen file.
 

Here is a simplified .grubfm menu which uses some of these variables:

 
menuentry "Ubuntu 64-bit with persistence" --unrestricted --class ubuntu {
# WARNING: partnew will write a new partition entry
   if ! test -d (hd0,4) ; then partnew --type=0x00 --file="(${grubfm_device})/persist/${grubfm_filename}" (${grubfm_disk}) 4 ; fi
   loopback loop "${grubfm_file}" 
   set root=(loop)
    linux (loop)/casper/vmlinux boot=casper persistent iso-scan/filename=$grubfm_path quiet splash
    initrd (loop)/casper/$init
   boot
}
 
 

.grubfm menu for Windows Install ISO:

.ISO and .grubfm must have same file name and be in the same folder. Run Windows Install with a specific XML file:
 
menuentry "Install Windows 10 1909 x64 Pro Eng" --class=nt6 {
    set "XML=Windows 10 Pro (no prompt to repair).xml"
    source (memdisk)/boot/grubfm/rules/iso/win.sh
    loopback loop "${grubfm_file}" 
    win_isoboot "(loop)/sources/boot.wim" "(${grubfm_device})${grubfm_dir}${XML}"
}
 
 

Using .imgPTN files and Secure Boot to Microsoft OS's

 
Note: Microsoft has now blocked the boot files used by agFM when Secure Booting from agFM to a Microsoft EFI boot file which requires Secure Boot (Feb 2020 Windows Update). If you experience 'Secure Boot Violation' messages, use the UEFI BIOS pop-up menu to UEFI-boot from Partition 1 after switching-in a FAT32 .imgPTN file.
If the a1ive grub2 File Manager does not provide the functionality you need for a particular payload  (e.g. Windows Install + Secure UEFI64 Boot), then you can still use E2B .imgPTN files by booting to WinPE first or using a .cfg file to switch-in a .imgPTN file.
 
Note: You must boot from a bootx64.efi file (not a .wim file) if Secure Boot (Microsoft only) is enabled in the BIOS or else you will get 0xc000000f Unexpected error. You will need to reboot after switching-in a .imgPTN file.
 

Windows 10 Secure Boot using a .cfg file (agFM v1.7 and later)


1. Boot to agFM and select the .cfg file (or .imgPTN file if v1.7 or later), answer the question and the partitions will be updated.
 
IMPORTANT: You will need to reboot before you can boot from EFI files on the new Partition 1 because the UEFI firmware will be unaware that the partitions have been changed (even though grub2 will be aware).
 
5. Reboot from the new partition 1 directly to Windows - if the system reboots to agFM instead of Windows then press F3 and boot to (hd0,msdos1) from the F3 boot menu.
 
6. You can restore the original USb drive partitions by booting to the agFM and running the \RESTORE_E2B.cfg file which is in the agFM FAT32 second partition. The original MBR and E2B partitions will be restored.
 
 

Large Windows Install ISOs

If you need to Secure Boot and the install.wim or install.esd is over 4GB, then create an NTFS .imgPTN23 file using the MPI Tool Kit instead of a FAT32 .imgPTN23 file.
It will always reboot to the agFM menu but you should be able to use F3 to boot to (hd0,msdos1) from the NTFS volume.

You can instead use agFM_imgPTN_AUTO.cfg (change the file name and edit the filename inside).
 
Note: Due to a recent (February 2020) Microsoft Windows update which updates the BIOS blacklist , you may now need to disable Microsoft Secure Boot for this to work!
 
 

WinPE methods

Since the grub2 File Manager can boot to any .EFI and .WIM file, you can copy over a WinPE .WIM file (with WoW64 support) to your E2B USB drive and UEFI Secure-boot to WinPE from the EFI boot file and then run SWITCH_E2B.exe to switch-in a new .imgPTN23 image partition. If you use an extension of .imgPTN23 then the FAT32 File Manager partition will also be available after the switch.
 

Instructions to add a WinPE ISO

  1. Download the Hirens WinPE ISO (e.g. HBCD_PE_X64.iso 1.3GB)
  2. Copy the .ISO file to the root of the FAT32 partition (you may need to increase the size of the FAT32 partition)
  3. Copy \_ISO\SWITCH_E2B.exe to the root of the FAT32 partition
Now you can boot to the agFM, select the WinPE ISO and then run \SWITCH_E2B.exe and choose a .imgPTN23 file.
 

Instructions to add WinPE files

By adding Microsoft boot .WIM WinPE files, you can install Windows even with a 'Secure UEFI: Microsoft OS only' BIOS setting.
 
When Secure Boot (Microsoft only) is enabled, we must boot from a bootx64.efi boot file:
 
bootx64.efi -> \efi\microsoft\boot\bcd -> \boot\boot.sdi -> \sources\xxxxxx.wim
 
If the following files are already present, go to Step 6 (or add your own boot.wim file).

eBook #3 WinPE files

  1. Download SWPEFAT32_eBook_FILES.zi_ and open in it 7Zip (password is given in eBook #3)
  2. Extract \EFI\Boot\BOOTX64.efi to the root of the FAT32 partition
  3. Rename \BootX64.EFI to \SWITCHPE_x64.EFI
  4. Extract \boot\boot.sdi to the FAT32 partition (\boot\boot.sdi)
  5. Extract the \EFI\microsoft folder to the FAT32 partition (\EFI\microsoft\)
  6. Extract and copy the \sources\SWITCH_X64.wim file to the FAT32 partition (\sources\SWITCH_X64.wim)
  • \SWITCHPE_X64.efi
  • \boot\boot.sdi
  • \EFI\microsoft\boot\bcd
  • \sources\SWITCH_X64.wim  (can also add SWITCH_X32.wim also)
The FAT32 partition must be large enough to contain the .wim file(s).
 
You can use any .wim file of your choice, but 64-bit WinPE must support WoW64 and you may need to add SWITCH_E2B.exe to the FAT32 partition if you don't use the eBook .wim files which already include SWITCH_E2B.exe.
 

Steps for Secure Boot to Install Windows using WinPE

Requires a pre-made Windows  .imgPTN23 file (e.g. \_ISO\WINDOWS\WIN10\Win10_x64_1909.imgPTN23).
 
  1. UEFI Secure Boot to the a1ive grub2 File Manager
    Ptn1: E2B menu system (MBR only)
    Ptn2: a1ive grub2 File Manager (MBR+UEFI) + WinPE .wim file(s)
  2. Select WinPE boot .EFI boot file on the FAT32 partition (e.g. SWITCHPE_x64.EFI) or a WinPE ISO file (use 'Boot ISO (map)' or Boot ISO (partnew)')
  3. Boot to WinPE Desktop and run SWITCH_E2B.exe
  4. Select the desired .imgPTN23 file in SWITCH_E2B.exe.
    Ptn1: Windows 10 (UEFI)
    Ptn2: a1ive grub2 File Manager (UEFI)
  5. Reboot to the new image on partition 1 (there may be two UEFI USB boot options in the BIOS Boot menu - you must pick the correct one or it will boot to the agFM again!). If you do boot to the agFM, then you can boot run the \EFI\BOOT\BOOTX64.EFI file on partition #1 to boot to Windows.
  6. Install Windows 10
  7. Reboot to WinPE and run SWITCH_E2B.exe and use the 'Restore  E2B Partition(s)' button...
    Ptn1: E2B menu system (MBR only)
    Ptn2: a1ive grub2 File Manager (MBR+UEFI)
  8. The E2B USB drive now contains the Easy2Boot menu system in partition 1.
Note: Instead of booting to WinPE, you can directly switch-in a .imgPTN file and reboot (see above).
 

Add an agFM Startup menu

agFM v1.11 and later versions will allow you to define an initial grub2 startup menu.
You can define a default menu entry and a timeout.
You can define a non-themed startup_menu with the colours and background wallpaper of your choice.
To configure your own startup menu, rename the \boot\grubfm\SAMPLE_startup_menu.txt file to startup_menu.txt.
Edit the startup_menu.txt file as required (instructions are inside the file).
 
By default, the E2B agFM v1.12 and later only lists 'bootable' files in the agFM menu system. You can use the F4 settings menu to also 'Display non-bootable files'.
 

Change wallpaper, colours or theme

agFM v1.15 and later versions allow you to change the theme and use your own wallpaper for the main agFM theme by using a \boot\grubfm\startup_menu.txt file (see above).
 
 

Debugging

In any grub2 menu, you can enable the screen pager by typing:
e  (to edit a menu entry)
F2 (to get to grub2 console)
set pager=1  (to enable screen paging)
ESC (return back to menu)
 
or type c (to get to grub2 command shell)
 
If you are using your own .cfg or .grubfm menu file, you can add debug lines such as:
 
echo myvar=$myvar  (display variables)
ls /          (list files)
ls            (list devices)
sleep 3    (delay for 3 seconds)
read        (wait for user input)
set          (view environment variables)
 
or you can directly edit the grub2 menu and change\add lines by pressing e.
 

Available icons (used with --class=)

 

Fn Menu Keys

F1 - Help 
F2 - File Manager - press F2 if you need to return back to the File Manager menu system
F3 - OS Detect - find and boot from bootable partitions
F4 - Settings - various settings including T to disable the graphical menu in case of a slow menu, and R to change screen resolution
F5 - Reboot, Shutdown, EFI Shell, grub2 console and version
 
If you have UEFI-booted, pressing LeftAlt+LeftCtrl+F12 will save a screenshot to a .PNG file (typ. 500K) in the root of the FAT32 partition.
 
A long menu entry (filename) can be scrolled left or right using Ctrl+R or Ctrl+L.
 
 

Languages

a1ive has made the File Manager available in a few different languages
 
Some menu entries may still be in English.
 
  • German
  • Hebrew (Israel)
  • Russian
  • Turkish
  • Vietnamese
  • Taiwanese
  • Chinese
 

Instructions

1. Use the latest agFM download to make the 2nd FAT32 partition as detailed above (this will be the English version)
2. Download the desired language .7z file and extract the files to the root of the 2nd FAT32 agFM partition - overwrite any existing files of the same name
3. Delete the \EFI\BOOT\grubia32.efi file
4. Move the \grubfmia32.efi file to \EFI\BOOT folder and rename to grubia32.efi
 

Payloads

See here (bottom of page) for tested payloads and how to boot them.
 

TroubleShooting

If you switch to a .imgPTN file or a .imgPTN23 file and have problems booting to the agFM after rebooting, you can use the UEFI Shell to select the \grubfmx64.efi file on the 2nd FAT32 partition - UEFI Shell - Boot Maintenace Manager - Boot from File - select partition and file.
 
Alternatively, run SWITCH_E2B.exe from Window or WinPE and click on the 'Restore E2B partitions' button.
Another alternative is to MBR-boot to the CSM menu aand select option 0.
 
If .imgPTN files fail to switch-in, check that the partitions on the E2B USB drive are correct.
Partition 1: NTFS - Type 07 (must contain E2B files)
Partition 2: FAT32 - Type 0B, 0C or 0E
 
Use RMPartUSB - Drive Info - 0 to examine the partition table in the MBR (LBA0).
 
A backup of the MBR is made to LBA30 and LBA60.
 
Note: If you have a \boot\grubfm\startup_menu.txt file, a diagnostic menu can be enabled (agFM v1.13 or later).
 

Will not UEFI boot

To UEFI-boot, there must be a FAT partition present.
The four START POS entries in the partition table must be in ascending order and must not overlap.
e.g. The table below is invalid because Ptn2 and Ptn3 use the same area and thus overlap.
 
 
Partition 1   SIZE=59998.969MiB   Type: 07 NTFS\exFAT  *ACTIVE*
START POS   = CYL:0 HD:32 SEC:33       END POS = CYL:1023 HD:254 SEC:63
START (LBA) = 2,048 (00000800) SIZE (LBA) = 122,877,889 (0752F7C1) [End=122,879,936]
 
Partition 2   SIZE=1000MiB   Type: 0C FAT32LBA (2047GB max)       
START POS   = CYL:1023 HD:254 SEC:63       END POS = CYL:1023 HD:254 SEC:63
START (LBA) = 122,880,000 (07530000) SIZE (LBA) = 2,048,000 (001F4000) [End=124,927,999]
 
Partition 3   SIZE=1000MiB   Type: 0C FAT32LBA (2047GB max)       
START POS   = CYL:1023 HD:254 SEC:63       END POS = CYL:1023 HD:254 SEC:63
START (LBA) = 122,880,000 (07530000) SIZE (LBA) = 2,048,000 (001F4000) [End=124,927,999]
 
Partition 4   SIZE=0MiB   Type: 00        
START POS   = CYL:0 HD:0 SEC:0       END POS = CYL:0 HD:0 SEC:0
START (LBA) = 0 (00000000) SIZE (LBA) = 0 (00000000)
 
 
If your suspect that a partition is causing the problem, change the partition ID type to 0 using a disk editor (e.g. BootIce - Parts Manage - (select ptn) - Modify ID - 0).
Change ID Type to 0 to remove a partition.
 
 

a1ive's  grub2 build

a1ive grub2 command primer is here.


Recommended for Easy2Boot (fastest flash drive!)
SanDisk Extreme SDCZ880-128G-G46

Fastest USB 3!
See Blog post

 

To Top