Sunday 23 August 2015

Add a global hotkey to Easy2Boot

You can define global hotkeys to do various things by adding hotkey commands to the \_ISO\MyE2B.cfg file. Some examples are given in the \_ISO\Sample_MyE2B.cfg file.

Do you have a favourite ISO file that you always like to boot to in Easy2Boot?
Why not set up a global hotkey for it so you can boot to it from any E2B menu?
What about booting Hirens or WindowsToGo or WinPE, using a hotkey from any menu?

For instance, set up the F11 hotkey to always run an Ubuntu Live ISO (or any ISO file) from any menu, by adding the line below to your \_ISO\MyE2B.cfg file:

(bd)/%grub%/hotkey [F11] "(bd)/%grub%/qrun.g4b force.isodefault  (bd)/_ISO/MyUbuntu.iso ;; boot" > nul

This assumes you have a MyUbuntu.iso file already present in the \_ISO folder, but you could change the path to point to any ISO file, anywhere on the E2B drive.

The 'force.isodefault' prevents E2B from suggesting alternative file extensions by forcing QRUN.g4b to treat the ISO file as if it had a .isodefault file extension. Instead, you could just re-name your ISO file with the .isodefault file extension and use:

(bd)/%grub%/hotkey [F11] "(bd)/%grub%/qrun.g4b  (bd)/_ISO/MyUbuntu.isodefault ;; boot" > nul

(bd) is grub4dos-speak for the 'boot device', i.e. the partition that contains E2B. We use it in case we happen to be in an E2B menu that has changed the root device to another partition when the user presses the F11 key (e.g. PTN2_MNU.mnu).

Instead of an ISO payload, you could use a .VHD payload or .imgPTNAUTO payload or .WIM payload, etc. etc.

(bd)/%grub%/hotkey [Shift+F11] "(bd)/%grub%/qrun.g4b  (bd)/_ISO/UTILITIES/Hirens_15.2.isowinvh ;; boot" > nul


(bd)/%grub%/hotkey [Shift+F12] "(bd)/%grub%/qrun.g4b  (bd)/_ISO/SECRET/WinToGoPro1064.vhd ;; boot" > nul

Run a .mnu file from a hotkey


If you want to set up a .mnu file to run from a hotkey (e.g. you run a linux Mint ISO with persistence using the linuxmint-17-mate-32bit-v2.mnu menu file) it is a little more tricky!



Suppose you already have a working iso and .mnu file in the \_ISO\LINUX\Linux folder

\_ISO\LINUX\Linux\linuxmint-17-mate-32bit-v2.mnu
\_ISO\LINUX\Linux\linuxmint-17-mate-32bit-v2.iso

and you want to set up the F4 key to run the .mnu file so you can run Mint with persistence just by pressing F4 in any E2B menu:

1. Make a copy of the .mnu file in the \_ISO folder (any file name will do), e.g.

\_ISO\F4_Hotkey.mnu

2. Edit the new file as follows:
   a. Delete the line beginning with title or iftitle (e.g. comment it out with #)
   b. Change any occurrences of $HOME$ to the full path of the ISO file
   c. Change any occurrences of $NAME$ to the name of the ISO file

Example: The lines with text in red below have been edited:

iftitle [if exist $HOME$/linuxmint-17-mate-32bit-v2.iso] Mint\n Boot using .mnu file with persistence
set ISO=linuxmint-17-mate-32bit-v2.iso
set PER=/mint-rw

if exist CD echo WARNING: Cannot use partnew command! && pause && configfile (bd)/menu.lst
if "%E2BDEV%"=="" set E2BDEV=hd0 && pause E2BDEV forced to hd0!
#enable parttype output
debug 1
# make empty table entry in 3rd position in ptn table
parttype (%E2BDEV%,2) | set check=
debug off
set check=%check:~-5,4%
if "%check%"=="0x00" partnew (%E2BDEV%,2) 0 0 0
if not "%check%"=="0x00" echo WARNING: PTN TABLE 3 IS ALREADY IN USE - PERSISTENCE MAY NOT WORK! && pause
debug 1
if not exist %PER% echo WARNING: %PER% persistence file not found! && pause
errorcheck off
if "%check%"=="0x00" partnew (%E2BDEV%,2) 0x0 %PER%
errorcheck on
#map ptn 4 to ISO
partnew (%E2BDEV%,3) 0x0 /_ISO/LINUX/Linux/%ISO%
map /_ISO/LINUX/Linux/%ISO% (0xff)
map --hook
root (0xff)
errorcheck on
kernel /casper/vmlinuz file=/cdrom/preseed/linuxmint.seed boot=casper persistent
# quiet splash --
initrd /casper/initrd.lz
boot


3. Add the hotkey entry to the \_ISO\MyE2B.cfg file:

(bd)/%grub%/hotkey [F4] "configfile (bd)/_ISO/F4_Hotkey.mnu" > nul


You can now press F4 in any menu (or whilst E2B is booting) and it will immediately run your .mnu file.

No comments:

Post a Comment