If you already have a working bootable USB stick that uses grub4dos and a grub4dos menu, you might want to make a bootable ISO file from it. This tutorial explains how to do it.
Grub4dos (0.4.5c) can read files on a CD/DVD ISO 9660 CDFS filesystem and the RockRidge filesystem, but not the Joliet filesystem - thus CDs/DVDs or ISOs that are prepared with no RockRidge extensions will only be read by grub4dos as ISO 9660 standard (filenames will be 8.3). Note: Grub4dos 0.4.6a can read Joliet ISOs (but it is in Alpha status).
What this means is that with some ISOs (or when you boot from a CD/DVD), grub4dos may not be able to access a particular file if it has a long filename: e.g.
If our ISO contains the file MyFileIsHere.txt and the ISO was prepared as Joliet but not RockRidge, then long filenames will not be visible via grub4dos. In this case, the file we are listing under grub4dos (MyFileIsHere.txt) will appear as /MYFILEIS.txt if the ISO has no RockRidge filesystem extension.
Also note that grub4dos does not usually care about case on FAT, exFAT and NTFS volumes, so in this example ls /MYFILEISHERE.TXT and ls /MYFILEIS.TXT would also work (but this may depend on how you made the ISO file - so try all capital letters as well)..
Also, be aware that your grub4dos menu.lst file may need modifying because your files will be on a CD and not a 'hard disk' when the ISO boots. Therefore if you have any commands which expect two hard disks to be present, i.e. (hd0) and (hd1), or you have hard coded the payload files as (hd0,0)/xxxx, or if you have excluded CD's from any file 'find' commands used in the menu, then when you boot from an ISO you cannot expect these to work! You can use () or (bd) as a device name for the boot device or just use / in your menus.
If you have downloaded and installed the WAIK you can use the microsoft OSCDIMG.exe utility.
If you do not have OSCDIMG.exe then you will need to download MKISOFS.exe.
To test that your ISO boots correctly, I recommend you load the ISO file in QEMU (use RMPrepUSB File - Boot from ISO file using QEMU Emulator) which allows you to emulate booting direct from the ISO file under Windows just as if it were a CD/DVD but without affecting your Windows system.
Some of the oscdimg information has been taken from this forum post and I have used the switches suggested by jaclaz/Wonko-the-Sane (thanks!).
Use RMPrepUSB - use the latest version of RMPrepUSB - and use Files - 'Make grub4dos ISO from Drive' to automatically convert the selected grub4dos bootable USB drive to an ISO file! RMPrepUSB will run a .cmd script to make a grub4dos bootable ISO file.
If your USB drive has WinPE files (i.e. bootmgr, \boot\BCD and boot.wim) then add oscdimg.exe to the RMPrepUSB installation's \QEMU folder. 'Make grub4dos ISO from Drive' will then use oscdimg to make the ISO instead of mkisofs which does not make bootable WinPE ISO properly.
Note that it does not alter the menu.lst file, so you must ensure your menu.lst is suitable to run from a CD/DVD.
If you wish to use a similar manual process using a Windows .cmd script, then follow steps 1 and 2 below...
2013-01-01 - I have changed the mkisofs download link to point to a cygwin version - the old link used a version of mkisofs.exe that had a 2GB ISO size limitation. The cygwin version of mkisofs.exe has a 4GB size limitation. If this is still a problem then use oscdimg instead!
2013-05-26 - Changed makegrub4dosiso.cmd to use start segment of 7C0 for better compatibility with some BIOSes!
1a. If you already have Microsoft Windows WAIK installed...
1. Download the Makegrub4dos.zip file from the Download - Beta Downloads page - extract the cmd file and place it in the same folder that you want your ISO file to be made in (or an empty folder)
2. In the Windows Start Menu - click on the Deployment Tools Command Prompt to open a Command Prompt window
1. Create a new empty folder on your hard disk (e.g. C:\MAKEISO)
2. Download mkisofs.exe and the dll (note: this is a cygwin (4GB) version, MinGW versions only make files up to 2GB!)
3. Download the Makegrub4dos.zip file from the Download - Beta Downloads page - extract the cmd file and place it in the same folder.
4. Run a Windows Command Prompt window (e.g. Start Menu - Accessories - Command Prompt)
1. Type ma and hit the <TAB> key to complete the command and press <ENTER> - you should see a usage prompt:
2. To make an ISO, you need to make sure that the grldr file is present at the top level of your source folder. Now type the command (use ma <TAB> to save typing!):
where test.iso is the name of the iso that you want to create, I: is the USB drive that you want to convert to an ISO file and my_iso_label is the volume label of the ISO that you want to create.
If all your boot files are in a folder, you can specify a source folder instead of a drive letter - e.g.
Do NOT use any filenames/foldernames with spaces in them.
The script will use either OSCDIMG or MKISOFS (depending on which one you have on your system) to create a new grub4dos bootable ISO file.
Use this command for a WinPE bootable ISO
mkisofs -iso-level 3 -force-uppercase -volid "%VNAME%" -b %BOOTFILE% -no-emul-boot -hide boot.catalog -o %ISONAME% %SRCFOLDER%
You may find grub4dos 0.4.6 does now work with level 4, so use level 3
I would recommend that you test your new ISO file before burning a CD to save making coasters! Here are some alternatives which you can try:
1. The latest versions of RMPrepUSB (v2.1.652 and later) can boot from an ISO via the emulator QEMU under Windows - just type Ctrl-F11 or use the File menu tab to test that your new ISO works.
use Qemu Manager - install this on your Windows system and create a new new virtual machine (New virtual machine - choose an OS and create a virtual hard disk so that at least one hard disk is present when the ISO file boots). Then in the Drives tab, click the CD-ROM icon and set the image name to your new ISO file. Then click the green arrow button to test your new ISO file.
2. Use RMPrepUSB to copy the new ISO file to a USB drive. Make a menu list that will load your ISO as a CD and test it using the RMPrepUSB - QEMU button. Note that this will test that you can at least get to the ISO's grub4dos menu, but it may not run the menu entries correctly. If the ISO file is large (>4GB) you may need to use NTFS when you prepare the bootable USB drive.
or easy still, just copy your new ISO file to an Easy2Boot USB drive and boot it.
3. Install and run Oracle VM Virtual Box or some other virtual machine and load the ISO onto a virtual CD drive used by the emulator. Be aware that I have seen problems where QEMU boots from a grub4dos ISO successfully but Virtual Box does not.
4. If you have a Zalman VE200 HDD caddy, copy your new ISO file to the _ISO folder and select it as the CD boot file - then test it on a real system.
Note: I have seen grub4dos bootable ISOs which don't boot from the ZalMan VE200 but that do boot when burnt to a Real CD and booted on a real system.
5. The acid test - burn the ISO to a CD or DVD and boot from it using a real computer!
If you are using MKISOFS, try the OSCDIMG utility instead (and vice versa). Mkisofs may have a 4GB size limitation.
The usual problems are due to the type of filesystem used for the ISO. When an OS boots, it may expect the files to have lowercase filenames or uppercase filenames. e.g. bootmgr or BOOTMGR. If it looks like some files are not being detected by the booting OS, this may be the reason. Try Googling for someone with similar problems to see if you can modify the makegrub4dos.cmd file by changing some of the switches on the command line.
If you are having trouble getting your grub4dos menu to work when a menu option is selected (grub4dos reports an error due to a 'bad' command), this is probably due to the fact that it is now booting as a CD rather than a 'hard disk' device. Here are some points to watch:
1. When booting from CD there may only be one hard disk (the system's internal hard disk) in the system. So any reference to (hd1) in a menu will cause an error.
2. Try to avoid booting from a mapped image using chainloader (xxx)+1 (where xxx is whatever you have mapped it to) - instead specify the actual boot file such as chainloader ()/io.sys or chainloader ()/bootmgr or chainloader ()/ntldr
3. Check filenames are not case sensitive - e.g. if chainloader /bootmgr does not seem to work try chainloader /bootmgr || chainloader /BOOTMGR so that it will work whether it is lower case or uppercase.
4. If you have excluded CDROM drives from a find command then it obviously won't find the file on the CD! For example, don't use find --set-root --devices=h /bootmgr .
5. Use find --set-root xxx to set the root device, this way it will work on a USB drive or on a CD.
6. There could be more than one CD device present in a system, the boot CD may not always be (cd0).
Tip: use (bd) to reference the boot device disk and that will work for both USB drives and CD/DVDs.
Here is an example of a menu that loads a DOS hard disk image file and boots it as a hard disk. Note how io.sys is specifically loaded instead of just ()+1 being used.
Booting from a CD or DVD to DOS is a problem these days as most PCs have modern SATA drives and the old DOS CD-ROM drivers are often not compatible.
Do you want to make a CD which boots to DOS (MS-DOS or FreeDOS) as A: but has access to all files on the CD without needing any CD drivers?
Using the method below, you can make a bootable CD which will boot to a grub4dos menu (which can be made invisible to the user). You can then run MS-DOS or FreeDOS and boot to DOS. Once at the DOS command prompt (A:) you will have the entire contents of the CD on the virtual A: drive. Drive A: can be 500MB or more! You do not need to load CD drivers in order to access all the CD contents as the contents will be on the A: drive.
The only problem with this method is that you cannot have more than 1000's of files in any one folder (and cannot have lots of large deep sub-folders). It does not work with an XP CD (/I386 folder), for instance, as this has 1000's of files in one folder - however it should work with most ordinary DOS folder structures.
When you boot from a CD it can be booted as a floppy or a hard disk or as neither. The Makegrub4dos.cmd script uses a switch with mkisofs of --no-emul-boot so that the BIOS does not emulate either a floppy disk or a hard disk when booting the CD. If we used floppy-disk emulation then we could only access 2.8MB within a floppy disk image. We could use a hard disk image but that might confuse DOS when it boots, as the CD will appear as hd0 (but write-protected). Instead of using a hard disk or floppy disk image, we specify the grub4dos bootloader file grldr and specify 'no emulation' when we create the ISO. The 'El Torito' BIOS specification has more details.
When we boot from a cd with no emulation, the operating system that is loaded must use it's own drivers to access the CD/DVD. However, grub4dos can access the CD as it understands the CD filesystem which has a CDFS (non-FAT, non-NTFS) filesystem with 800h long sectors. Once grub4dos has been loaded, we call copycd.bat. This is a grub4dos batch file which makes a large (500MB+) ram drive and then copies the contents of the cd to the virtual ram drive (fd0), folder by folder. We can then boot to DOS from the files that are now on the virtual fd0 drive. The internal Hard Disk 0 will still be hd0 in DOS so we can fdisk it or format it and copy files to it.
Use latest RMPrepUSB to install the latest grub4dos version. Old versions of grub4dos (2011 and before) will not work!
6. Test the USB drive by using the QEMU button (or just press F11) in RMPrepUSB. Use the TEST ENTRIES menu options to check that your files boot to DOS as A: and your DOS utilities run correctly. Note: the first entry which uses copycd.bat will not work correctly at this stage!
7. Now make an ISO file using the Makegrub4dos.cmd method described at the top of this article - e.g. makegrub4dos new.iso J:\ TESTCD where J: is your USB drive letter.
8. Use the latest version of RMPrepUSB and hit Ctrl-F11 and then select your ISO. If your CD requires that a hard disk should be present, you will also have to create a virtual hard disk when prompted.
9. 'Rinse and Repeat' until you are happy that it appears to be working as expected.
10. Finally delete the TEST ENTRIES from the menu.lst and change anything else you require. If you don't want a user menu at all, just add the lines
to the start of the menu.
Note that the size of the virtual floppy that is created is set by the line call (bd)/copycd.bat (fd0) 0x100000 where (fd0) is the device ID and 0x100000 is the size of the virtual floppy (0x100000 = 512MB) - this must be at least as big as the CD files so you should increase this if your CD is bigger than 500MB or decrease it if the CD is smaller.
There is a 3 second delay in copycd.bat - you can reduce or remove this (see pause --wait=3 line)
Now create the ISO file again using Makegrub4dos.cmd, test it in QEMU Manager and if OK, burn it to a CD ready for testing.
copycd.bat contents (last updated 2012-02-19 - bugfix now use %FD%%%cd%) - (Remove # from red line below if you want to see the files listed as they are copied)
There are different types of CD boot emulation, including floppy emulation - in which the boot sector of the CD is a bootable floppy disk image. The boot sector is not accessible when viewing the CD in a file manager such as Windows Explorer and might appear to be a blank disk if no files are contained on the disc root. These ISOs can be mounted as a virtual CD/DVD and most modern applications (Virtual CloneDrive or ImDisk) will allows access to all files in the UDF volume,
The Hirens Boot CD contains a Make ISO batch file which uses the following command to create an HBCD ISO called MyHBCD.ISO which has a grub4dos boot loader...
mkisofs.exe -R -D -J -l -joliet-long -duplicates-once -o MyHBCD.iso -b HBCD/grldr -c HBCD/boot.cat -hide-joliet HBCD/boot.cat -hide HBCD/boot.cat -no-emul-boot -N -boot-info-table -V HirensBootCD -boot-load-size 4 CD
You may come across an ISO that is in UDF format (a newer standard intended to replace ISO9660). When grub4dos maps this to a drive, all it may see just a single README.TXT file containing the text:
grub4dos 0.4.5c cannot read the UDF file system (but 0.4.6a can!), however you can still boot from a UDF ISO file using grub4dos as follows:
Some help on booting from ISO images can be found here.