Grub4dos Guide - Boot Options


Grub4dos utilises two different methods for booting operating systems - both of which can be used via command line or configuration file entries. Both methods involve using the chainloader command, one to boot the device, the other to boot the operating system kernel or bootloader file(s). By chainloading the device Grub4dos can be used to boot unsupported partition types, as long as the operating system uses the MBR and/or partition boot sector as part of the bootstrap process. For chainloading devices refer to the following sections -

Directly chainloading OS files has an advantage over chainloading the device, as a partition or floppy (or partition/floppy image) with a corrupted boot sector can still be booted (as long as the filesystem remains correct).

NOTE - all of the following examples are configuration file entries, however they can easily be amended to run from the command line interface. To run from the command line omit the title command entry. After entering the last command you will also need to run the boot command (this is not needed in configuration file entries). The following menu.lst entry for example -

title Boot MBR of First Hard Disk
chainloader (hd0)+1
rootnoverify (hd0)

Should be entered as chainloader (hd0)+1 [enter], rootnoverify (hd0) [enter], boot [enter] from the command line.


Master Boot Record (MBR)

The Master Boot Record (or MBR) is always the first sector of a hard disk (sector 1). It contains the disks primary partition table, identifying which partition is marked as active (the active partition is the device boot partition). It is possible to boot a hard disk MBR by using the chainloader command. To boot the MBR of the first hard disk we would use the following command -

title Boot MBR of First Hard Disk
chainloader (hd0)+1
rootnoverify (hd0)

Where (hd0) is the whole of the first disk, (hd1) would be used to boot the MBR of the second hard disk, etc. The "+" symbol is used to specify a blocklist - in this case +1 is the first sector of the device (hd0). A block list is used for specifying a file that doesn't appear in the filesystem, like a chainloader.


Partition Boot Sector

During the installation of a Windows operating system a bootsector is written to the first sector of the partition on which it is installed (more than one sector might be used if the partition type is NTFS). Typically the partition boot sector (PBS) will identify which file to load as part of the bootstrap process - when booting Windows XP for example the PBS will load the Windows NT loader ntldr. The filename "ntldr" is hardcoded into the PBS and can be viewed via a hex editor. GRUB and other Linux loaders can also be written to the PBS. To boot the partition boot sector for the first partition on the first hard disk use the command -

title Boot Partition Boot Sector - First Hard Disk, First Partition
root (hd0,0)
chainloader (hd0,0)+1

Refer to previous section "Master Boot Record (MBR)" above for more information on the "+1" (blocklist) notation.


Boot Floppy Disk (or disk image)

To boot from the first floppy disk drive (fd0) use command -

title Boot Floppy Disk
chainloader (fd0)+1
rootnoverify (fd0)

To map the disk image win98.ima on device (hd0,0) as a virtual floppy disk drive (fd0), then boot the virtual device -

title Boot Disk Image
map (hd0,0)/win98.ima (fd0)
map --hook
chainloader (fd0)+1
rootnoverify (fd0)
map --floppies=1

Refer to Map section here for a more detailed explanation of the above commands.

Alternatively the memdisk kernel (part of the Syslinux package) can be used to boot disk images. The following example uses memdisk to boot the disk image win98.ima (on device (hd0,0)) -

title Boot Disk Image – (memdisk)
root (hd0,0)
kernel /memdisk
initrd /win98.ima

Boot CDROM

To boot from CD/DVD drive -

title Boot CD-ROM - (cd)
chainloader (cd)
rootnoverify (cd)

If the (cd) device is not detected, or the above command does not work, then try -

title Boot CD-ROM - (cd0)
cdrom --init
map --hook
chainloader (cd0)
rootnoverify (cd0)

If the CD still fails to boot and you are returned to the menu (or command line), the cdrom driver will still be running. To stop the cdrom enter the commands, map --unhook [enter], cdrom --stop [enter].

To boot a CD that Grub4dos is unable to boot, try using BCDL (Bootable CD Loader) - available here (or here). The program is downloaded as a floppy disk image, which can be booted using the map command, e.g. -

title Boot CD Loader
find --set-root /bcdl201a.ima
map --mem /bcdl201a.ima (fd0)
map --hook
root (fd0)
chainloader (fd0)+1

Alternatively, use a gzip'ed compressed image, e.g. -

title Boot CD Loader
find --set-root /bcdl201a.ima.gz
map --mem /bcdl201a.ima.gz (fd0)
map --hook
root (fd0)
chainloader (fd0)+1

NOTE - the newer version of BCDL (version 2.01a) worked during testing despite being an alpha release. The older (stable) version 1.50z, did not.


Load Windows NT/2K/XP

To directly chainload the NT loader file ntldr (installed on the first partition of the first hard disk) use the command -

title Boot Windows NT on (hd0,0)
root (hd0,0)
chainloader /ntldr

Assuming only one Windows NT OS is installed the following command could also be used (if more than one Windows NT OS is installed the first one found will be loaded) -

title Boot Windows NT
find --set-root /ntldr
chainloader /ntldr

NOTE - NT based systems must be installed on the first hard disk - attempting to boot from the second hard disk will fail. It is possible to boot from Windows on device (hd1) by remapping the drive to (hd0) – see here.


Load Windows NT/2K/XP Recovery Console (cmdcons)

To boot into the Windows NT/2000/XP Recovery Console, use either of the following entries -

title Windows NT/2K/XP Recovery Console
find --set-root /cmldr
chainloader /cmldr
########################################################
# write string "cmdcons" to memory 0000:7C03 in 2 steps:
########################################################
# step 1. Write 4 chars "cmdc" at 0000:7C03
write 0x7C03 0x63646D63
# step 2. Write 3 chars "ons" and an ending null at 0000:7C07
write 0x7C07 0x00736E6F

or,

title Windows NT/2K/XP Recovery Console
find --set-root /cmdcons/setupldr.bin
chainloader /cmdcons/setupldr.bin
########################################################
# write string "cmdcons" to memory 0000:7C03 in 2 steps:
########################################################
# step 1. Write 4 chars "cmdc" at 0000:7C03
write 0x7C03 0x63646D63
# step 2. Write 3 chars "ons" and an ending null at 0000:7C07
write 0x7C07 0x00736E6F

Load Windows Vista

The process for booting Vista based systems is similar to booting older NT based systems and the OS files should be contained on the first hard disk (or remapped disk). To boot Vista either chainload the MBR/partition boot sector, or directly chainload the Vista loader file bootmgr. To chainload bootmgr on the first partition of the first hard disk (device (hd0,0)) -

title Boot Windows Vista on (hd0,0)
root (hd0,0)
chainloader /bootmgr

Some notes from README_GRUB4DOS.txt -


Load Linux

To boot Linux systems we need to use the kernel and initrd commands – with paths to the relevant files. E.g. to boot Puppy Linux (kernel file vmlinuz and initrd file initrd.gz) on a USB flash drive (recognised as second hard disk with one partition by the BIOS) use command -

title Linux Puppy
root (hd1,0)
kernel /vmlinuz PMEDIA=usbflash
initrd /initrd.gz

Due to the immense variety of Linux based Operating Systems it is not possible to list the required Grub4dos entries. You will need to identify the relevant command for the distro, then manually enter the configuration file entry.


Load Windows9x/ME/DOS/FreeDOS

To boot MS DOS (or DOS based OS's such as Windows 9x/ME) you can either chainload the partition boot sector of the relevant partition or directly chainload the file io.sys. E.g. if DOS files are located in the second partition on the first hard disk -

title Boot MS-DOS
root (hd0,1)
chainloader /io.sys

Similarly, FreeDOS can be booted by either chainloading the partition boot sector of the relevant partition, or directly chainloading the file kernel.sys -

title Boot FreeDOS
root (hd0,0)
chainloader /kernel.sys