If you have a grub4dos multiboot USB drive, you may find that some linux ISO files require complex menu entries or simply do not support being booted as an ISO file (e.g. BackTrack).
However, if you download and add these 6 files to your grub4dos multiboot drive, you just need to add one menu entry to your menu.lst file and place all your linux ISO files under the \_ISO\Linux folder on your USB drive.
When the user selects the Auto Linux menu option in your menu, a grub4dos batch file will find all ISO files under the \_ISO\Linux folder (inc. subfolders), create a new menu file in memory and then load the new menu. An example of the dynamically generated menu is show below.
Once you have added the 6 files from this tutorial, all you need to do is copy all your linux ISO files to the \_ISO\Linux folder. The next time you run the Auto Linux ISO menu, it will magically appear in the new dynamic menu. If you later delete any ISO in the \_ISO\Linux folder (or below), the menu entry will no longer appear the next time you run it.
Linux ISO filenames can contain spaces and it supports long-filenames.
So it is very easy to add a new linux ISO file to your multiboot drive - just drop it into the \_ISO\Linux folder!
Even BackTrack 5 (BT5) will boot directly from an ISO file using this method!
Example of the dynamically generated menu
You need a grub4dos bootable drive. You can make a grub4dos USB drive or even use your internal HDD if you already have grub4dos installed on it.
If your menu file is not called \menu.lst, then change the LBACKMENU line to specify the actual name and path of your calling menu.
3. As this method relies on a blank, unused 4th entry in the boot drive's partition table, you should add these lines to the top of your main menu.lst file to check that it is safe to use:
#enable parttype output
# make empty table entry in 4th position in ptn table
parttype (hd0,3) | set check=
if "%check%"=="0x00" partnew (hd0,3) 0 0 0
if not "%check%"=="0x00" echo WARNING: PTN TABLE 4 IS ALREADY IN USE! && pause && configfile /menu.lst
Most USB Flash drives do not have more than one or two partitions, however some HDDs may have multiple partitions, so it is wise to include these lines at the top of your menu if you use a boot device which has more than 2 partitions, just in case!
4. Now just copy any linux-based ISO file to the \_ISO\Linux folder. You can also create any number of subfolders under \_ISO\Linux and place ISO files in them too.
How it works
The menu entry simply calls \grub\autolinuxmenu.bat - this is a grub4dos batch file which enumerates all ISO files under the folder \_ISO\Linux and all sub-folders under that, and then creates a new grub4dos menu in a ram drive. The grub utility wenv is called in this batch file.
The menu entries created in the ram drive (rd) comprise of the following lines (different for each ISO file):
partnew (hd0,3) 0x00 /_ISO/Linux/xxxx.iso
map /_ISO/Linux/xxxx.iso (0xff)
This uses the grub4dos partnew command to map the ISO file as a partition entry (it uses the fourth partition table entry which MUST be unused on your boot drive) - See Tutorial #93 for more details.
If you wish to change the appearance of the linux ISO menu, you can edit the \grub\LINUXUSER.MNU file. This is a normal grub4dos menu (configfile). It has UK keyboard settings as well as a background image. If you delete the LINUXUSER.MNU file then a basic menu will be created.
Although this technique will work for booting any (most) linux ISO files, very few non-linux OS's will work as they will not detect the 4th partition as a valid filesystem. Some DOS- or PE-based ISOs may work.
If you wish, you can change the search folder path by changing the last parameter when calling the autolinuxmenu.bat batch file. Alternatively, you can add another menu entry for say WinPE and change the search path to \_ISO\WinPE and place the WinPE ISO files under \_ISO\WinPE. You can even search the whole USB drive for all ISO files by using /grub/autolinuxmenu.bat .automenu /