Thursday, 26 September 2013

Understanding the Easy2Boot folder structure


It is difficult to understand the folder structure used in E2B and to know where to put your ISOs and .mnu files.

As there is so much to read in the E2B Tutorial, I thought I would try to explain it in my blog.

TWO GOLDEN RULES FOR E2B USER FILES

  • E2B will only auto-detect payload files that are at the \_ISO\XXXXX folder level.
  • E2B will auto-detect .mnu files that are at the \_ISO\XXXXX folder level AND also any sub-folders underneath that level.
'Payload' files are the files that you want to boot (e.g. .ISO, .IMA, .BIN, etc.).
.mnu files are grub4dos menu entry files (e.g. as required when booting linux from an ISO with persistence).

If you want to know more then read on, but if not, it would be worth re-reading the two rules above just to get them into your head before you close this browser tab and go and get that cup of coffee!

So you can put any payload file (a linux ISO say) in any folder at the \_ISO\XXXXX level - e.g. copy the .ISO file to the \_ISO\DOS folder and it will be listed in the E2B DOS menu and will work just the same as if you had put the ISO file in the \_ISO\MAINMENU or \_ISO\LINUX folders. 

However if you put the .ISO file in a folder below the \_ISO\XXXXX level (e.g. at the \_ISO\XXXXX\YYYYY level) it will not be listed in the menu and you won't be able to select and run it.

On the other hand, .mnu files are enumerated by E2B at the \_ISO\XXXXX level  AND all levels below that level

To test this for yourself, you can 'tidy up' your E2B \_ISO\MAINMENU folder as follows:

1. Create a new folder at \_ISO\MAINMENU\ZZMNU
2. Move all the ZZSubMenuxxxxx.mnu files from \_ISO\MAINMENU to the new \_ISO\MAINMENU\ZZMNU folder

E2B will boot just the same as before but your MAINMENU folder will look a lot tidier!

Note that the folder is called ZZMNU so it will be enumerated last. If you name the folder as $$MNU then the sub-menu entries would appear first in the Main menu followed by any payload (ISO) files and then the F9 and F10 menu entries (as these two are automatically added to the end of the Main menu).

E2B starts by just enumerating the payload files and all the .mnu files under \_ISO\MAINMENU. All the other sub-menus and sub-sub-menus in the Main menu are caused by .mnu files that are present in or under the \_ISO\MAINMENU folder.  

So the code in E2B basically says:

folder = \_ISO\MAINMENU  - go and enumerate it and make a menu.

Some of the ZZSubMenuxxx.mnu files under \_ISO\MAINMENU also contain similar code for the other E2B folders, e.g. when you select DOS MENU from the Main E2B menu, E2B runs the code in the ZZSubMenuDOS.mnu file which says:

folder = \_ISO\DOS - go and enumerate it and make a menu.


Note: These 2 Golden Rules do not apply to the \_ISO\WINDOWS and \_ISO\AUTO folders which are 'special' cases.
  • The \_ISO\WINDOWS folder has sub-folders in which you must place the appropriate Windows Install ISO files (e.g. Win7 Install ISOs go in the \_ISO\WINDOWS\WIN7 folder).
  • Any payload files placed in the \_ISO\AUTO folder and any folder that you make underneath that folder will be enumerated and listed in the DIRECT BOOT menu

The AUTO folder allows you to have 100's of ISOs nicely arranged into dozens of separate folders with your own naming convention - E2B will just collect all the payload files at any folder depth. When you select  'DIRECT BOOT' from the Main menu, they will all be listed in one single, large menu.

E2B enumerates files and folders in alphabetical order. To change the order of entries in a menu, simply rename the payload files (e.g. $listmefirst.iso) and .mnu files (e.g. $$$ZZSubMenuxxx.mnu) to list them first.
If the menu entries are not in the order you expect, remember that directories are also enumerated at the same time as files, so ZZ.mnu in a folder at \_ISO\MAINMENU\A will appear in the menu before \_ISO\MAINMENU\linux.iso.

Lastly, when E2B enumerates payload files, it looks for a file in the same folder with the same filename but with a .txt file extension. If it detects one, then the 'title' text inside is used by E2B for the menu entry title, instead of just the name of the file itself. This means your menu does not have to look like a list of files, you can make .txt files for each .iso/.ima, etc. payload file and have any text you like for the menu entries (and even define a hotkey for each one).