Add E2B to your own grub4dos USB drive

I strongly recommend that you add your own grub4dos menus as .mnu files into E2B, rather than try to use some of the E2B features and batch files into your own menu system without running from the E2B menu system.
 
  • The USB drive should not contain more than 2 primary partitions. 
  • Partition 4 must be empty. 
  • Partition 3 is used by some functions (e.g. if you use linux+persistence) and so this also should be unused.
  • For best 'bootability', I recommend that the USB drive contains two Primary partitions (even if the 2nd one is very small and hidden).
  • Also, ensure grub4dos is installed to both the MBR and the PBR of the first partition.
  • Ensure you are using the same version of grub4dos that E2B uses - copy the \grldr file in the E2B download to the root of your grub4dos-bootable USB drive and overwrite any older version.
  • You must keep the \_ISO folder structure used by E2B.
If you already have a syslinux or grub4dos multiboot USB drive, you can add E2B to your USB drive as follows:
 
1. Download, extract and copy ALL the E2B files to your existing multiboot USB drive (including the files in the root). 
If you already have a \menu.lst file then do not overwrite it with the E2B menu.lst.
Ensure the E2B folder \_ISO is in the root of the USB drive (do not move it to a different folder).
 
2a. If you have a grub4dos menu.lst file, add in a menu entry to run E2B as follows:
 
title Run Easy2Boot
set grub=_ISO/e2b/grub
configfile /%grub%/menu.lst
 
2b. If don't already have a \menu.lst file and have a syslinux boot pen, add this to your syslinux menu (the E2B \menu.lst file will be required)
 
LABEL Easy2Boot
MENU LABEL Easy2Boot
BOOT /grldr
 

Using E2B features in your own grub4dos menus (not recommended)

If you just want to use the same method of autorunning any payload file but don't want the E2B menu system (not recommended), you can use QRUN.g4b in your menus, e.g.
 
title Run xxxx.iso
/%grub%/qrun.g4b   ()/_ISO/MAINMENU/xxxx.iso
boot
 
title Run Hirens
/%grub%/qrun.g4b   ()/_ISO/MAINMENU/Hirens.isowinvh
boot
 
You can also force QRUN to run an iso as if it had a different extension, e.g. this will run the iso as if it had the .isowinvh file extension
 
title Run Hirens
/%grub%/qrun.g4b force.isowinvh  ()/_ISO/MAINMENU/Hirens.iso
boot
 
Note: If the filename or path contains spaces, you must precede the space with a \ character, e.g. /_ISO/MAINMENU/Windows\ PE.iso
 
Note: The %grub% variable must be set by you to point to the folder that contains QRUN.g4b and all the other files and folders under grub, so at the top of your menu.lst put something like:
 
set grub=_ISO/e2b/grub
set LANG=ENG
cat /%grub%/%LANG%/STRINGS.txt > (md)0x880+0x80
# next line assumes the USB drive will be hd0 - it usually is when booting from USB.
set E2BDEV=%?_BOOT:~1,3%
if not "%E2BDEV%"=="hd0" pause ERROR: E2BDEV = %E2BDEV% !!!
#initialise memory areas so they are not confused by grub4dos seeing them as compressed files!
echo fffffffffffffff > (md)0x800+1
echo fffffffffffffff > (md)0x220+1
echo fffffffffffffff > (md)0x3000+1
echo fffffffffffffff > (md)0x6000+1
echo fffffffffffffff > (md)0xA000+1
# set keyboard scan codes (uses USA if not set) - optional
###set KBD=KBD_GERMAN.g4b
###call /%grub%/%KBD%
# load font file for non-US language fonts - e.g. Ü. 
font ()/%grub%/unifont.hex.gz
 
You will need to load a language file into memory (3rd line). If you don't do this you will get 'Missing $$STRxxxx' messages.
 
Note that you should check E2BDEV is hd0.
 
Many different files and folders are used by QRUN.g4b - ALL the files and folders under the grub folder must be present.
 

You MUST preserve the folder structure (i.e. \_ISO\e2b\grub and \_ISO\e2b\firadisk and \_ISO for CONTIG.ISO and MyE2B.cfg) and set the grub variable to _ISO/e2b/grub . You can use a different folder for %grub% as long as you only boot simple linux ISOs (not Windows or WinPE) - ALL the E2B files and folders under the grub folder must be present. I do not recommend this though and cannot support it or be held responsible for any damage to the USB drive or to system disks if you don't use the original E2B folder structure!

WARNING: I recommend you do not use .imgPTN files in non-E2B menus! You can potentially destroy partitions on the system hard disk if anything goes wrong or if E2BDEV is set to the wrong device.
 
To run WinPE/Windows Install ISOs, you should first clear the \AutoUnattend.xml and \Unattend.xml files using the code below. 
Otherwise, if you run any WinPE payload using .iso or .vhd or .wim, then it may use the \AutoUnattend.xml file from the previous boot!
 
# don't abort if error
errorcheck off
# fill (rd) with 0's , 0x82d0 is rd-base mem address, Fn24 is memset - fill memory 
call Fn.24  0x60000 0x20  102400 > nul ;; map (md)0x300+0x800 (rd) > nul
if exist ()/AutoUnattend.xml dd if=(rd)+1 of=()/AutoUnattend.xml > nul
if exist ()/AutoUnattend.xml dd if=()/_ISO/e2b/firadisk/empty.xml of=()/AutoUnattend.xml > nul
if exist ()/Unattend.xml       dd if=(rd)+1 of=()/Unattend.xml > nul
if exist ()/Unattend.xml       dd if=()/_ISO/e2b/firadisk/empty.xml of=()/Unattend.xml > nul
# don't abort if error
errorcheck off
# fill (rd) with 0's , 0x82d0 is rd-base mem address, Fn24 is memset - fill memory 
call Fn.24  0x60000 0x20  102400 > nul ;; map (md)0x300+0x800 (rd) > nul
if exist ()/AutoUnattend.xml dd if=(rd)+1 of=()/AutoUnattend.xml > nul
if exist ()/AutoUnattend.xml dd if=()/_ISO/e2b/firadisk/empty.xml of=()/AutoUnattend.xml > nul
if exist ()/Unattend.xml     dd if=(rd)+1 of=()/Unattend.xml > nul
if exist ()/Unattend.xml     dd if=()/_ISO/e2b/firadisk/empty.xml of=()/Unattend.xml > nul
 
I recommend you use the Easy2Boot menu system to run Windows-based payload files for these reasons.
 
Example for running a Win7 Install ISO using E2B  (RunVista.g4b is for Server2K8R2,Win7 or Vista, RunWin8.g4b is for Server2012, Win10 and Win8)
 
title Install Windows 7 (32-bit) \n Install Win7  from ISO
# suppress return to Windows Install menu
set NOWMENU=1
set ISO=Win732.iso
set MFOLDER=/_ISO/WINDOWS/WIN7
/%grub%/RunVista.g4b  %MFOLDER%
boot
 
title Install Windows Server 2008 R2 (64-bit) \n Install SVR2K8  from ISO
# suppress return to Windows Install menu
set NOWMENU=1
set ISO=Win2K8R2_x64.iso
set MFOLDER=/_ISO/WINDOWS/SVR2K8R2
/%grub%/RunWin8.g4b  %MFOLDER%   
boot
 
MFOLDER is the folder containing the ISO and any XML file.
You can also specify a specific XML file as the second parameter - see here.
 

Example \menu.lst file

This \menu.lst file assumes you also want to use the QAUTO.g4b E2B menu system and the standard E2B menu system with folders in the \ISO folder.
 
graphicsmode -1 800
set grub=_ISO/e2b/grub
/%grub%/hotkey -A
set LANG=ENG
cat /%grub%/%LANG%/STRINGS.txt > (md)0x880+0x80
set E2BDEV=%?_BOOT:~1,3%
if not "%E2BDEV%"=="hd0" pause ERROR: E2BDEV = %E2BDEV% !!!
echo fffffffffffffff > (md)0x800+1
echo fffffffffffffff > (md)0x220+1
echo fffffffffffffff > (md)0x3000+1
echo fffffffffffffff > (md)0x6000+1
echo fffffffffffffff > (md)0xA000+1
font ()/%grub%/unifont.hex.gz
 
#clear GFX if not using GFX menu
set GFX=
 
default 0
timeout 30
 
# Colour pairs are Text/Background - i.e cyan/blue = cyan text on blue background
# Valid colours are: black, blue, green, cyan, red, magenta, brown, light-gray, dark-gray, light-blue, light-green, light-cyan, light-red, light-magenta, yellow and white.
color normal=light-cyan/black highlight=red/black helptext=yellow/black standard=light-cyan/black border=light-gray/black
 
#                 00rrggbb00rrggbb  =  00Bgnd00Fgnd
color highlight=0x0000000000FF0000
 
#dont show extensions in menu
#set EXTOFF=1
 
#center heading
set CENTREHD=1
 
# Footer variables
set FCOLOUR=0103
set HELPTEXT=\x20Help [F1]  HDD0 [F7]   Back [F8]   Reboot [F9]   Power [F10]  (%^LANG%)  www.easy2boot.com
set HBTM=3502
 
# Heading
set HCOLOUR=0103
set HEADPOS=0000
 
# menu
# wordspacing linespacing borderwidth tophelp numberofitemsinmenu topstart menuwidth rightstartposofmenu
# n = unchanged  (if wdspace or lnspace is not n then screen is cleared)
# tophelp=topstart+noitems for menuhelp text just under menu box
set wdspace=n
set lnspace=n
set topstart=2
set rstart=3
set menuw=64
set bdwidth=1
set noitems=24
set tophelp=26
 
# md5 text below = easy2boot
set pwd=--md5 $1$1$okAQ3AJUdhqf3TVrwKvJP1
 
# == code for menu ===
 
set NEWGRUB=
# detect new setmenu command
cat --locate="setmenu --param" (md)0x200+0x100 > nul && set NEWGRUB=1
if not exist NEWGRUB && if exist RTL pause --wait=3 WARNING: This version of grub4dos does not fully support right-to-left languages (%LANG%) %redirp%
#will restore max menu grub4dos default (screws up though!)
#/%grub%/menusetting.gz u
# set menu position (clears the screen so use clear afterwards to fill the screen with background colour)
if %rstart%<=1 set rstart=2
if "%GFX%"=="" if not "%DONEMENU%"=="1" /%grub%/menusetting.gz   %wdspace% %lnspace% %bdwidth% %tophelp% %noitems% %topstart% %menuw% %rstart%
# calculate padding for headings
if not exist HPAD call /%grub%/SetHPAD.g4b %rstart%
# HPAD now has correct number of spaces for padding the headings
# If want centering of headings, set CENTERHD to menu width
if "%CENTREHD%"=="1" set /a CENTREHD=%menuw%
if "%RTL%"=="1" set /a RTL=%menuw% > nul
# if AUTONUM not turned off adjust width
#if exist RTL if not exist AUTONUM set /a RTL=%menuw%-4 > nul
# use new right-align command if available
if exist NEWGRUB setmenu --left-align
if exist NEWGRUB if exist RTL setmenu --right-align
#remove cursor help text 
if exist NEWGRUB setmenu --keyhelp=61=0xe && setmenu --ver-off
#autonumber all menu entries with a space (20) and a number (01)
if "%AUTONUM%"=="" set AUTONUM=0x2001
write 0x8274 %AUTONUM% > nul
#set menu help text position
if not exist hstart set /a hstart=%rstart%-1
if not exist hwidth set /a hwidth=%menuw%+2
if exist NEWGRUB setmenu --help=%hstart%=%hwidth%=%tophelp%
if exist NEWGRUB setmenu --box x=%rstart% y=%topstart% w=%menuw% h=%noitems% l=%bdwidth%
set hstart= && set hwidth=
#clear variables
set NEWGRUB=
set wdspace= && set lnspace= && set topstart= && set rstart= && set noitems= && set menuw= && set bdwidth= && set tophelp=
 
#===== MENU ITEMS HERE =====
 
iftitle [ls (bd)/iso/autoboot/ > (md)0x9F00+1 && checkrange 1:-1 read 0x13E0000 > nul] Load E2B AutoBoot Menu
set LBACKMENU=(bd)/menu.lst
(bd)/%grub%/QAUTO.g4b .automenu /iso/autoboot
debug 0
dd if=%LBACKMENU% of=(md)0xA000+0xA0 > nul
configfile (md)0x3000+0xA0
 
iftitle [ls (bd)/iso/LINUX/ > (md)0x9F00+1 && checkrange 1:-1 read 0x13E0000 > nul] Load E2B Linux Menu
set LBACKMENU=(bd)/menu.lst
set MFOLDER=(bd)/ISO/LINUX
set HDG=Steve's Linux Menu
dd if=%LBACKMENU% of=(md)0xA000+0xA0 > nul
debug 0
(bd)/%grub%/submenu.g4b
boot
 
 

GFXboot example

This can be used in your \menu.lst file if you have a message GFXBoot menu file
 
#######################################################################################
set grub=_ISO/e2b/grub
if "%LANG%"=="" set LANG=ENG
cat /%grub%/%LANG%/STRINGS.txt > (md)0x880+0x80
set E2BDEV=%?_BOOT:~1,3%
if not "%E2BDEV%"=="hd0" pause ERROR: E2BDEV = %E2BDEV% !!!
echo fffffffffffffff > (md)0x800+1
echo fffffffffffffff > (md)0x220+1
echo fffffffffffffff > (md)0x3000+1
echo fffffffffffffff > (md)0x6000+1
echo fffffffffffffff > (md)0xA000+1
set EXTOFF=
default 0
timeout 30
# GFX file must be in \_ISO
set GFX=message
gfxmenu = /_iso/message
 
#######################################################################################
 
iftitle [ls (bd)/iso/autoboot/ > (md)0x9F00+1 && checkrange 1:-1 read 0x13E0000 > nul] Load AutoBoot Menu\n Run any ISO
set LBACKMENU=(bd)/menu.lst
(bd)/%grub%/QAUTO.g4b .automenu /iso/autoboot
debug 0
dd if=%LBACKMENU% of=(md)0xA000+0xA0 > nul
configfile (md)0x3000+0xA0
 
iftitle [ls (bd)/iso/LINUX/ > (md)0x9F00+1 && checkrange 1:-1 read 0x13E0000 > nul] Load Linux Menu\n Load Linux Menu
set LBACKMENU=(bd)/menu.lst
set MFOLDER=(bd)/ISO/LINUX
dd if=%LBACKMENU% of=(md)0xA000+0xA0 > nul
debug 0
(bd)/%grub%/submenu.g4b
boot
 

Transfer to a different E2B drive (DANGER!)

If you boot grub4dos from a different drive or partition, you can transfer to the E2B drive using this menu entry:

find --set-root /_ISO/e2b/grub/menu.lst
chainloader /grldr
boot
 
Note that this is not recommended because the boot drive will not be the E2B drive. Check the E2BDEV variable carefully! Be aware that Easy2Boot menus may destroy partition 4 of a drive (drive is defined by %E2BDEV%). Also, some .mnu files may expect to be running from hd0 and be hard-coded for hd0. It also assumes that hd0 is a USB drive for certain functions - it may accidentally erase/modify disk 0 of your system! So check carefully any menu you use!
 
Note: This may not work for exFAT E2B drives because grub4dos may just load your other \menu.lst file first!


More Info