Grub4dos version 0.4.6a has Joliet ISO support, can map non-contiguous files, better debugging and it's own rd/wr USB 2.0 driver and better NTFS file-write support, exFAT and ext3/4 support, new features such as setmenu, large font support, .jpg support, etc. etc.
To install grub4dos, I recommend using RMPrepUSB. Click here for a complete set of RMPrepUSB and grub4dos YouTube video tutorials.
Use the Search box at the top of this page to find a grub4dos menu for your particular ISO/OS/App.
RMPrepUSB Blog- please leave a comment or feedback on RMPrepUSB or this Tutorial (please mention Tutorial number).
Introduction to grub4dos
This tutorial is an introduction on how to make a bootable grub4dos USB drive.
If you are a beginner to multibooting USB drives and just want to quickly make and test a multiboot USB drive, check out the Easy2Boot Project here.
Grub4dos allows you to make a multiboot (multipass) drive. When you boot from a bootable drive that contains the grub4dos bootloader, you are normally presented with a menu which allows you to boot from any OS or other program such as a memory test program that you have copied to the drive.
Grub4dos does not support UEFI-booting (but you can UEFI-boot using Easy2Boot).
Grub4dos boot code can be installed either onto the MBR (Master Boot Record, on the first sector of the disk) and boot track (first track) of a drive, or the partition boot record. It consists of two parts or stages. The first part is the boot code which is in the first sector and some of the following sectors of the boot drive or partition. Once this code is run by the CPU, the code then looks for a file called grldr. The grldr file needs be in the root and on the same boot partition if the boot code is installed onto the partition boot record (PBR - start of the partition).
If the boot code was installed onto the MBR, then the root of all devices will be searched to find the grldr file. See here for more details.
Grub4dos can boot an OS or executable from a 'flat file' structure or from disk image files or even ISO files. It can even load images into memory (ram drive) and run the OS from there! Grub4dos is used in most of my tutorials and is well worth getting to know it, if you are interested in making your own multi-boot drives. The RMPrepUSB download includes grub4dos. RMPrepUSB will install grub4dos onto a drive at the click of a button either to the MBR (Master Boot Record) or PBR (Partition Boot Record). Tip: If in doubt, always install twice, to both MBR and PBR!
Most of the tutorials on this website use grub4dos. Grub4dos can be installed onto a USB Flash drive, USB Hard Disk or even your PC's hard disk. It can also be added to a bootable CD or DVD. Using grub4dos, you can make a bootable disk/CD/DVD that can run or install Windows XP, Windows 7/8, various versions of linux, memory tests and do much, much more...
Grub4dos can run grub4dos batch files (which must start with !BAT) and grub4dos executables and supports environment variables. It can access FAT12, FAT16, FAT32, NTFS, exFAT, ISO 9660 CDFS and ext2/3/4 filesystems. It is a very powerful environment and is under constant development and improvement by chenall, tinybit, yaya and many others. There is an active forum on reboot.pro here. By convention, grub4dos programs may have the file extension .g4e, grub4dos batch files may have the extension .g4b.
Tip: You can make Nov 2013 and later versions of grub4dos run these without needing to specify the file extension, by adding command --set-ext=.g4b;.g4e to a grub4dos menu.lst file.
# set default extensions for executables
command --set-ext=.g4b;.g4e > nul
# set default path for executables
command --set-path=/bin > nul
If you have never used grub4dos before, I will give you a quick 'How to' introduction so you can make a working USB pen drive with which you can experiment.
IMPORTANT: Always use the latest RMPrepUSB version which will include a recent version of grub4dos or obtain the recommended grub4dos grldr file.
I recommend that you always use the latest version of RMPrepUSB to install grub4dos rather than using grubinst or bootice for two reasons:
(1) Only (small) USB drives are listed by default, so you cannot accidentally damage your system or external USB hard disks,
(2) RMPrepUSB adds special modifications to the grub4dos boot code (using a specially modified version of grubinst.exe) which increase the chances of booting grub4dos on a wider variety of systems.
Note: The RMPrepUSB version of the grub4dos MBR code is not compatible with BootIce - so don't attempt to tweak the defaults timeout,etc. using BootIce!
If you are having problems booting to grub4dos on some very old systems try FlashBoot to prepare your USB drive.
RMPrepUSB Part 3a - grub4dos
RMPrepUSB Part 3b - grub4dos
grub4dos ReadMe.txt (old but useful user manual - data references ) - recommended!
Tutorial 57- Automatic grub4dos menus, using hotkeys, hiding the menu and silent startup
Look here for advanced example menus and downloads including unifont to support UTF.8 characters, wallpapers, moving the menu, coloured text, etc.
Part 1 - Make a bootable USB pen drive
Download and install RMPrepUSB onto your Windows XP/Vista/Win7 system
(always use latest Beta) . There is a portable version if you prefer this (though the full version adds no system drivers and is easy to completely uninstall should you want to). Linux users can install grub4dos using BootIce.
Insert a USB Flash memory pen drive (or USB hard disk) into the USB port of your Windows computer and run RMPrepUSB - set the following options:
1. MAX size in MiB (1 MiB = 1024KB) 2. MEMTEST as a volume label 3. MS-DOS 4. FAT16 (or use FAT32 if you have >2GB USB drive) + Boot as HDD (2PTNS) 5. Leave the COPY FILES box unticked 6. Click Prepare Drive to format the USB pen (Note: you will lose all contents as it reformats the whole drive!)
Fig. 1 Notice that the settings are numbered 1 to 6 for you - just set 1-5 as shown and then click on 6 Prepare Drive.
Note: If you are using a USB HDD, you may need to select Settings - List Large Drives >128GB.
3. Click on the Install grub4dos button - answer 'Yes' to use the MBR option and hit Enter when prompted to copy the grldr file over - or use PBR option if you prefer. ('No User Prompts' must be unticked to get this option').
You can use MBR or PBR or both with RMPrepUSB as it uses a special version of grubinst which works even when booting MS-DOS from grub4dos . Make sure that the \grldr file has been copied across to the USB drive afterwards (you must hit the Enter key when requested - do not just quit the console window!).
Tip: Some systems give a 'flashing cursor' when they boot from grub4dos installed to the MBR. If you want your USB drive to boot from a wide variety of different systems, install grub4dos twice - once to the MBR and again to the PBR ('No User Prompts' must be unticked to get this option')! For very old systems, you may need to format the USB drive using FlashBoot.
4. Now follow Tutorial #20 on how to add MemTest86+ to the USB drive you have just prepared (Memtest86+ is a good one to start with because it is quick to boot and ideal for testing the grub4dos menu with - or if you prefer, try Tutorial #37 to make a FreeDOS USB bootable pen drive).
Assuming you have added MemTest86+, you should now have a USB drive with the following 3 files on it (press F2 to check USB drive the contents):
Note that grub4dos consists of two parts as explained previously.
Part 1 is the boot code which does not actually exist as a file and so cannot be easily seen. It's code can be located either in the Master Boot Record (first 31 sectors on a disk) or in the Partition Boot Record (first sectors at the start of a partition). This is written to the disk when you click on the 'Install grub4dos' button and grubinst.exe is run.
Part 2 is the main grub4dos code which is loaded by the Part 1 boot code. Part 2 is just the file grldr which should be located in the root of your bootable drive partition. This grldr file is copied from the RMPrepUSB application folder to the target drive when you click on the 'Install grub4dos' button and after grubinst.exe has run successfully. If you wish to use a different version of grub4dos, simply replace the grldr file on the USB boot drive with your different grldr file.
Once the the glrdr file loads into memory and runs, grub4dos will look for a menu file to parse and run (grldr includes a pre-boot configfile which then looks for a menu.lst file). The menu is in the form of a text file named menu.lst which is normally placed in the root of the drive. The search path that grub4dos uses to find a menu.lst file is:
root / of the boot device, then /boot/grub folder, then /grub folder of boot device
search all volumes except cd and floppies - same paths and in same order as above
The grldr file contains it's own small pre-boot menu (512 bytes) which includes the commands to search for the menu.lst file. This embedded menu can be changed if you wish.
If a menu.lst file is not found, grub4dos will display a grub> command prompt. You can type in most of the grub4dos commands at the grub4dos command prompt (such as help).
If a menu.lst file is found then the commands inside that file will be run.
Whatever device the /menu.lst file was found on, it will be set as the 'root' device and partition. So ls / or ls (bd)/ (bd=boot device) will always list the files on the root of the partition that contained the menu.lst that was found and loaded by grub4dos.
A menu file consists of two sections - all commands before the first title command are executed, in sequential order, as soon as the menu file is loaded.
When the first title command is found, any further lines are interpreted as menu entries (each menu entry starts with a title command word followed by one or more command lines).
Note: If your menu uses iftitle commands, all iftitle [xxxxx] lines are evaluated and any commands inside the [...] brackets are executed, before the initial menu commands are run and the menu is displayed
When a user selects a menu entry and presses [Enter], the commands below the title command are executed by grub4dos until the next title command is found (or the end of file is found). When the next title command is found (or the end of file is reached) grub4dos will automatically issue a boot command and CPU control will be passed to whatever code was loaded by the previous menu instructions.
Note: The menu.lst file can be saved in ANSI format or UTF-8 format using Windows NotePad.
If saved in UTF-8 format, then non-ANSI characters can be used (e.g. chinese glyphs) but you must also load a font file such as unifont.hex.gz and the display must be in a graphics mode to display non-ANSI characters - e.g.:
graphicsmode -1 800
title reboot (重启)
title halt (关机)
Here is a video on how to make a simple ANSI menu.lst menu file and it explains some of the command words that can be used in the menu.
Hak5 video on menu.lst entries
Starts at 0:28
Tip: run RMPrepUSB and press F4 to create/edit a menu.lst file
Part 2 - Testing your USB pen drive
We now need to test your USB pen drive to see if it boots.
You can either reboot your computer (or use a different computer), change the BIOS boot menu so that the BIOS will boot from the USB pen first and see what happens - OR - you can use an emulator like Qemu (this saves having to reboot your computer or unplug the USB drive and move it to another system) - simply press the F11 keyboard function key when running RMPrepUSB or click on the 'Test using QEMU emulator' button in RMPrepUSB to run QEMU and see if your USB drive will boot!
Normally, Qemu does not allow BIOS sector writes (except to the MBR!) to the USB drive when it is mapped as a \\PhysicalDriveX on your computer (though no error will be reported as the drive is 'snapshotted' so that any writes are temporary only and cached) - i.e. any physical drive mapped by Qemu will be treated as a read-only device because Windows locks the volume and no physical writes to the volume will occur. For this reason, if you are emulating DOS USB drives using Qemu, you may find it does not work as expected when writing files to the USB drive under DOS and then rebooting again (once booted under Qemu) or even within grub4dos (e.g. the savedefault command does not actually save anything!). If, however, you use the latest version of RMPrepUSB, writes will work as expected! See also Tutorial 4 for how to boot from a USB drive in a VirtualBox VM (much faster than QEMU!).
Qemu may not always work as expected (it will be mentioned in the Tutorial if there is a known issue with any particular setup and QEMU), but booting from real computers should work as long as the USB drive is booted as a 'hard-disk'/USB-HDD and not as a 'USB-ZIP' or 'USB-FDD' device!
When you press F11 in RMPrepUSB to run QEMU, you will be asked if you want to create a virtual hard disk drive - answer 0, next you will be asked how much memory to allocate to QEMU - just click on OK. You should now see a BIOS boot screen window appear briefly and then a window like this:
When you see this grub4dos menu - press the <ENTER> key and memtest86+ should start to run.
It is possible to spice up this menu and make it look better. Let us change the text and background colour, set a 200 second timeout, set a default menu choice if no key is pressed and add a background wallpaper using a .gz file by using these lines at the top of your menu.lst file (add it now and try it!):
#Normal text black with cyan background, Highlighted menu=yellow text with cyan background, Help text=red with light=blue background, Heading is yellow text with white background
color black/cyan yellow/cyan red/light-blue yellow/white
# IMPORTANT: There must be no spaces at the end of the colour values (e.g. 0033FF) below or it will not take affect!
# The foreground and background commands must be AFTER the splashimage is loaded
# format: RRGGBB - e.g. FF0000 is bright red, 100000 is very light red, FFFFFF is pure white, 008000 is mid-green, C0C000 is red+green
Note: A line starting with # is a comment line - text which follows a # symbol (or pretty much any character!) will be ignored by grub4dos
Note: foreground and background commands will only work in old 16 colour graphicsmodes (e.g. graphicsmode -1 800 -1 4 or graphicsmode x - where x= 0, 1, 2, 4, 5, 7, 13, 14, 15, 16, 17, 18, 19 + some others). It is best to avoid these commands and use the color command instead - see below.
Note: The XPM format for splashimage is no longer supported by grub4dos.
Grub4dos 'color' values
The color statement has the format color NORMAL HIGHLIGHT HELPTEXT HEADING in pairs consisting of foreground text colour/background colour - valid colours are:
Tip: A nice colour scheme can be made by using a light colour for the foreground and the same colour but darker for the background - e.g. light-cyan/cyan or light-green/green.
Note that using
will result in no menu text or timeout or timer countdown text being displayed (black text on a black background)!
The 'NORMAL' colour setting also sets the console text colours too, unless you specify a 'standard' colour too.
With later versions of grub4dos (2012+) you can set individual colours if you are using a high resolution image (256 colours or more) as below:
#0=black,1=blue, 2=green,3=cyan,4=red,5=magenta,6=brown,7=grey (add 8 for bright color - e.g. 15=white, 14=yellow, 13=pink,12=red,11=cyan,10=l.green, 9=bright blue, 8=grey)
#multiply by 16 to make the background blue (16x1), 32 to make the background green (16x2), 48 for bkgnd cyan (16x3), etc.
#set normal menu text color to bright red text (12 = 8+4), background to cyan (48) = 12 + 48 = 60
# or same as ...
#set selected menu heading text to green
#set helptext at bottom of menu to red
#set menu heading colour to black
#set console text colour to white on black background (0x0F)
# or can use on one line as below
# color normal=60 highlight=02 helptext=04 heading=00 standard=0x0F border=0x00
#Another way to set colours is using hex values - a single hex digit for each colour - 0xbf where b=background=0-F and f=text foreground = 0-F
# colour background=blue (1), text=white (f) for normal menu text
# normal = white text on blue, highlight = white text on green, helptext = grey text on red, heading = black text on light-magenta background
color 0x1f 0x2f 0x47 0xd0
# set console to light-red text on cyan background
color standard 0x3c
# note that if in graphics hi-res mode, the background colour for normal text and help text will be ignored and will be set to transparent.
the = sign can be omitted in the color command.
You can prefix most colours with 'blink-' to make them flash. Note that blink only works in textmode (e.g. graphicsmode 3) and not in a non-text (hi-res) graphics mode. Also you cannot have light blinking background colours, e.g. color blue/blink-light-blue will report back a parsing error; color blink-light-blue/blue is OK and so is color blue/light-blue. Equally color 0x91 will set blinking blue text on a blue background (i.e. invisible!), whereas color 0x99 will set blinking light-blue text on a blue background.
color standard=blink-light-blue/green will work, but color standard=blink-light-blue/light-green will not work.
Another way to set the colours if using a splashimage is shown below (graphicsmode command is required if the splashimage is not exactly 640x480, or 800x600, etc), this way you do not have to remember the numbers!
graphicsmode -1 640x480
set black=0 && set blue=1 && set green=2 && set cyan=3 && set red=4 && set magenta=5 && set brown=6 && set lgray=7 && set lgrey=7
set dgrey=8 && set dgray=8 && set lblue=9 && set lgreen=A && set lcyan=B && set lred=C && set lmagenta=D && set yellow=E && set white=F
#colors set in pairs background+foreground (if splashimage then only highlight and standard console text have a background colour - all rest use transparent background)
color normal=0x%white% highlight=0x%lblue%%blue% helptext=0x%lmagenta% heading=0x%red% standard=0x%black%%lcyan% border=0x%red%
If you issue the command echo -h at the grub4dos command console, all the possible values from 0x00 to 0xff are listed in a table:
color 0x03 has a black background (0) and a bright green foreground (3). color 0x5F has a pink background (5) and a white foreground (F)
You can also specify a colour pair as one or two RGB 3-byte hex value if in a hi-res VGA graphics mode (not text mode 3) instead of a foreground/background single byte value - e.g.
# 0x00-0xFF (a value of 0-255) is treated as a background/foreground color value pair
# numbers larger than 1 byte (0x100-0xFFFFFF) are treated as an RGB value and sets a black background
echo This is red on a white background
echo this is blue on a black background (same as 0x0000000100F4)
color standard 0xFF00000000FF
echo this is blue text on a green background
#sets a mauve menu border colour
Later versions of grub4dos (June 2013 and later) can also understand individual colur settings, e.g. color standard=blink-light-blue/black will set blinking (if in text mode) light blue text on a black background.
You can use a 64-bit value to set both the highlight background colour and the text colour:
# yellow 00FFFF00 + background will be 00222222 (v. dark grey/black) color highlight=0x0022222200FFFF00
Quick summary of graphics mode colour options
color standard=cyan/black - sets cyan text on a black background
color standard=0x00AAAA - sets cyan text on a black background (background always black/transparent)
color standard=0x03- sets cyan text on a black background (0x13 would set cyan on blue background)
echo $ Hello - prints cyan text on current background (0013 would set cyan on blue background)
echo $[0x03] Hello - prints cyan text on a black background (0x13 would set cyan on blue background)
Use $ to set the colour back to it's previous value - e.g. echo -e Hello $This is yellow$ This is the same colour as 'Hello'
When in graphics mode, background = black = transparent. Only the standard and highlight colours accept a background colour setting.
color highlight=0x22222200FFFF00 - sets background (0x222222) and text colour (0xFFFF00) using 0x00rrggbb00RRGGBB format.
color standard=0x0000FF00FFFFFF - sets console text to white text on blue background.
Comment lines start with a # in my tutorials (actually for most grub4dos versions, any starting character except A-Z,a-z,0-9,/(%,white space and + are treated as a comment line character - but the 'official' character for a comment is #).
For commands that are above any menu title command (i.e. before a 'title' line), the commands must start on a new line with no space or other character in front of them.
For lines which follow after a 'title' line, white space and graphics characters are ignored unless they follow a command word - e.g. echo ## ##.
Nearly all grub4dos commands are (and must be) lower case (e.g. root (hd0,0) is OK, but Root (hd0,0) or root (HD0,0) will give an error). Grub4dos filenames are not usually CaSe SeNsItIvE, but to be on the safe side always use the same upper and lower case letters to match the files on the USB drive (ext2/3/4 grub4dos volumes will be case sensitive). It is also recommended to use 8.3 filenames if possible (i.e. not long filenames) as you may get problems when booting OS's that do not cope well with long filenames such as MS-DOS or some ISO filesystems. Also be aware that files within a CD or ISO image may be uppercase when accessed by grub4dos, even if they appear as lowercase when viewed in Explorer.
Note that, like linux, grub4dos uses forward slashes for directory path separators(/) and does not use the backslash (\) character as used by Windows! The \ character in grub4dos is used for literal characters, e.g. \n can be used as a carriage return character for adding help text on a title line but \\n would be treated and displayed as '\n'.
Long filenames that have spaces in them (e.g. A File Name with Spaces.txt) must be 'escaped' using a backslash character (\) before each space character like this:
ls /A\ File\ Name\ with\ Spaces.txt
If the file 'A File with Spaces.txt' exists, then the ls command (equivalent to a dir command) when run, produces the result...
/A\ File\ Name\ with\ Spaces.txt
Setting a background image
Older versions of grub4dos required a 14-colour, 640x480 bitmap to be made, however, new versions (2011+) allow you to specify high-colour graphics modes and use high-resolution bitmaps.
NOTE: XPM format is not supported in later versions of grub4dos (2015+)
Low Resolution 14 colour 640x480 bitmaps
Note that the menu example above has a 'splashimage' statement. For older versions of grub4dos this command can only use a 14 colour 640x480pixel image to use as a background image (if you do not change the graphicsmode and leave it set to the default mode). For your 14-colour splashscreen image (if you have used a splashimage command), by default, the foreground colour (all of the menu text and the highlight for the currently selected option) will be white, and the background colour (the highlighted text within the currently selected option) will be black. This menu text will be laid over the background image.