37 - Create a DOS Bootable USB drive (using grub4dos) suitable for BIOS flashing

Unique hits stat tracker for tumblr

If you need to boot a computer to DOS to flash the BIOS or perform some other task under DOS such as formatting a hard disk or running a DOS-based recovery program, here is how to do it.

1. Download and install RMPrepUSB v2.1.622 or later
2. Insert a USB drive (hard disk or Flash drive) into the same computer and run RMPrepUSB
3. Select the USB drive in the top selection box and then set the options numbered 1 to 5 as follows:
1. MAX
2. FreeDOS (or any volume name you like) - you may be prompted to set the copy folder to FREEDOS_USB_BOOT - if so then accept it.
3. FreeDOS
4. FAT16 (or FAT32) + Boot as HDD
5. Tick the Copy OS Files box and Browse to the .\FREEDOS_USB_BOOT folder if it has not already been set.

4. Now click on the 6 Prepare Drive blue button




5. When the drive has been formatted, click on the Install grub4dos button and follow the prompts (choose MBR option or PBR option).
6. Now copy your BIOS Flash tools (typically a .exe file and a .ROM file) to the USB drive.


The USB drive is now ready to test. You can do this by pressing F11 when in RMPrepUSB. You should see a menu like the one below:



Note that you can choose to boot the USB drive either as a floppy (so you get the drive A: prompt), as hard disk 0 (so your computer hard disk will be the second hard disk when FreeDOS booots), or as hard disk 1 (so the computers hard disk will be the first hard disk and if you run FDISK or a DOS partition program, the first hard disk will be the computer's hard disk and not your USB drive).



Example if 'boot as floppy' option 1 is chosen.

Once you have booted to DOS, you can type DIR to list the files on the USB drive.

Note: If you receive a message 'Bad or missing Command Interpreter' then you may need to type in the path and name of COMFREE.COM - e.g. Type D:\COMFREE.COM.

Feel free to edit the menu.lst file to change the title to anything you like! See the grub4dos tutorial for how to do this and more details on how grub4dos works.


How it works:

The 'boot chain' is - (MBR boot code) -> (grub4dos code and menu) -> KERNEL.SYS -> FDCONFIG.SYS -> COMFREE.COM -> FDAUTO.BAT

FreeDOS is booted by executing the file KERNEL.SYS (this is equivalent to the IO.SYS file when booting to MS-DOS).
KERNEL.SYS then looks for a CONFIG.SYS text file or an FDCONFIG.SYS text file. The commands inside this text file tell it what to do next.
In our case, it will load the shell COMFREE.COM (this is equivalent to the file COMMAND.COM when booting to MS-DOS).
When COMFREE.COM loads, it will look for a file called AUTOEXEC.BAT or FDAUTO.BAT. In our case we have FDAUTO.BAT and so commands in this file are executed.

The file GRLDR contains the grub4dos code and the text file menu.lst contains our grub4dos menu.

If you wish, to simplify the files, you can rename COMFREE.COM to COMMAND.COM and delete FDAUTO.COM and FDCONFIG.SYS. The 'boot chain' is then: KERNEL.SYS -> COMMAND.COM.


Booting to MS-DOS instead of FreeDOS

If you want to boot MS-DOS instead of FreeDOS, simply copy all MS-DOS (v7) files to the USB drive after following the steps above and then copy the IO.SYS file and rename it as KERNEL.SYS file so that the file KERNEL.SYS will actually contain the contents of IO.SYS.

You will, of course, need to obtain the MS-DOS boot files (IO.SYS, COMMAND.COM, MSDOS.SYS, CONFIG.SYS) first.

Create and boot from an MS-DOS 7 image file

RMPrepUSB can make a 1.44MB MS-DOS 7 floppy disk image containing the standard DOS boot files by extracting the floppy disk image from a standard Windows file within your Windows system.

1. Click Files - Create 1.44Mb Floppy DIsk Image - the disk image file DOSBOOT.IMA will be created and automatically highlighted in Windows Explorer.

2. Copy the DOSBOOT.IMA file to your USB boot drive and add the following menu.lst entries (use F4 in RMPrepUSB):

title MS-DOS Floppy boot image
map /DOSBOOT.IMA (fd0)
map --hook
chainloader (fd0)/io.sys


You will need to make your USB drive bootable by formatting it with RMPrepUSB (use the 2PTNs option) and installing grub4dos (use the Install grub4dos button).

3. Press F11 in RMPrepUSB to test it...

MS-DOS boot disk obtained as above.

Alternativrly, you can extract the boot files from the .ima file using 7Zip or WinImage, etc.


Booting to MS-DOS and FreeDOS

If you want to put both MS-DOS and FreeDOS onto the one USB drive and boot to either OS, simply copy the MS-DOS files to the USB stick after preparing it as above, and then edit the menu.lst menu text file and copy the FreeDos menu items 1 - 3 to make three more menu items (4, 5 and 6). Then edit the 3 new entries to change the titile and also change the KERNEL.SYS text in the menu item to IO.SYS. An example complete menu.lst is shown below which you can cut and then paste into the menu.lst file if you prefer.


#This file is only of use if you also install grub4dos to your USB drive
#Lines starting with # are comments

#valid colours are: black, blue, green, cyan, red, magenta, brown, light-gray, dark-gray, light-blue, light-green, light-cyan, light-red, light-magenta, yellow and white
#color pairs are : NORMAL HIGHLIGHT HELPTEXT HEADING consisting of foreground/background
color black/cyan red/yellow green/light-blue white/light-cyan
timeout 20
default 2

#These next two lines overwrites the grub4dos info with a nice title
write (md)0x220+1 !BAT\necho -n -P:0000 $[0133] --- STEVE'S MENU --- index= \0
initscript (md)0x220+1

#Put a section heading here
title ******** MY SUPER BOOT DRIVE ********\nPlease user the cursor keys or type a number to select a menu item
root ()

title ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
root

title ³ 1 Boot FreeDOS as Floppy Disk 0 ³\n\n Boot from this USB drive as Floppy Disk A:
map --unhook
map --unmap=0:0x82
#Next line checks to see if we booted as a hard disk (80) and if so maps the boot device as a floppy disk
checkrange 0x80 read 0x8280 && map (hd0,0)+1 (fd0) && map (hd1) (hd0) && map --hook && find && rootnoverify (fd0) && map --harddrives=1
map --floppies=1
chainloader /kernel.sys
clear
title ³ 2 Boot FreeDOS as Hard Disk 0 ³\n\n Boot from this USB drive as Hard Disk C: with the real hard disk as 2nd disk
map --unhook
map --unmap=0:0x82
#Next line checks if we booted as a floppy drive (0) - if so we cannot convert to a hard disk
checkrange 0x00 read 0x8280 && clear && find && echo Sorry - cannot map this floppy device as a hard disk! && pause && configfile (bd)/menu.lst
rootnoverify (hd0,0)
chainloader /kernel.sys
clear

title ³ 3 Boot FreeDOS as Hard Disk 1 ³\n\n Boot from this USB drive as Hard Disk C: with the real hard disk as first disk
map --unhook
map --unmap=0:0x82
#Next line checks if we booted as a floppy drive (0) - if so we cannot convert to a hard disk
checkrange 0x00 read 0x8280 && clear && find && echo Sorry - cannot map this floppy device as a hard disk! && pause && configfile (bd)/menu.lst
#Next line checks to see if we booted as a hard disk (80) and if so swaps the boot device with the 2nd hard disk
checkrange 0x80 read 0x8280 && map (hd0) (hd1) && map (hd1) (hd0) && map --hook
rootnoverify (hd1,0)
chainloader /kernel.sys
clear

title ³ 4 Boot MS-DOS as Floppy Disk 0 ³\n\n Boot from this USB drive as Floppy Disk A:
map --unhook
map --unmap=0:0x82
#Next line checks to see if we booted as a hard disk (80) and if so maps the boot device as a floppy disk
checkrange 0x80 read 0x8280 && map (hd0,0)+1 (fd0) && map (hd1) (hd0) && map --hook && find && rootnoverify (fd0) && map --harddrives=1
map --floppies=1
chainloader /io.sys
clear
title ³ 5 Boot MS-DOS as Hard Disk 0 ³\n\n Boot from this USB drive as Hard Disk C: with the real hard disk as 2nd disk
map --unhook
map --unmap=0:0x82
#Next line checks if we booted as a floppy drive (0) - if so we cannot convert to a hard disk
checkrange 0x00 read 0x8280 && clear && find && echo Sorry - cannot map this floppy device as a hard disk! && pause && configfile (bd)/menu.lst
rootnoverify (hd0,0)
chainloader /io.sys
clear

title ³ 6 Boot MS-DOS as Hard Disk 1 ³\n\n Boot from this USB drive as Hard Disk C: with the real hard disk as first disk
map --unhook
map --unmap=0:0x82
#Next line checks if we booted as a floppy drive (0) - if so we cannot convert to a hard disk
checkrange 0x00 read 0x8280 && clear && find && echo Sorry - cannot map this floppy device as a hard disk! && pause && configfile (bd)/menu.lst
#Next line checks to see if we booted as a hard disk (80) and if so swaps the boot device with the 2nd hard disk
checkrange 0x80 read 0x8280 && map (hd0) (hd1) && map (hd1) (hd0) && map --hook
rootnoverify (hd1,0)