Booting DOS From a USB Flash Drive

Published on December 2016 | Categories: Documents | Downloads: 70 | Comments: 0 | Views: 806
of 5
Download PDF   Embed   Report

Booting DOS From a USB Flash Drive

Comments

Content


Booting DOS from a USB flash drive
USB flash drives also called USB keys, pen drives and an assortment of other names can make
quite handy reusable boot disks. Today I found myself in need of a DOS boot disk to upgrade the
firmware on some hard drives and CD/DVD drives but didn't want to burn a bunch of bootable
CDs or try to find a USB floppy disk drive. I remembered that most newer BIOSs including the
one on this system support booting from USB drives so I thought I would investigate that as an
option. Unfortunately I found that, being an afterthought, boot support is not an easy thing to do
and presents several challenges.
First and foremost is that while there is some information on how to accomplish this on the
Internet, there is comparatively little and what information does exist is not as clear or definitive
as would be useful. Secondly, there are a number of different methods and tools for
accomplishing this and not all methods work with all BIOS implementations of bootable USB.
For example, USB flash drives may be booted as fixed disks, floppy drives or USB-Zip drives
each of which requires different methods of preparation and the requisite support in the BIOS.
Both of the methods I will describe hear treat the flash drive as a fixed disk which seems to be
the best method if your BIOS supports it and appears to be becoming the standard for new
BIOSs. While these methods are based on readings of other guides and howtos I was unable to
find something as simple as I describe here so this method was developed on my own though
research based trial and error (and lots of reboots) over the better course of a day.
In its simplest description booting from a flash drive as a fixed disk works almost exactly like
booting from a hard disk does. The BIOS invokes the boot sector and master boot record (MBR)
on the flash drive which loads the operating system kernel. It would initially seem that it should
be no problem to make this work, after all DOS based operating systems worked this way for
years. The trick is getting the boot sector and MBR on the flash drive. In ye old DOS days when
you wanted to install DOS from a floppy disk onto a fixed disk it was common to invoke the
FDISK and SYS commands to create a MBR, boot sector and copy the required system files. The
problem is that in most cases the USB flash drive is being prepared from within a recent copy of
Windows such as Windows XP which no longer has these commands available for this use. On
the other hand if you booted DOS from a floppy disk or bootable CD and had access to FDISK
and SYS you would not (normally, without drivers) have access to the USB flash drive to install
the files.
After reading the information that was available on the Internet I determined it would be
reasonably easy to create a bootable DOS USB flash drive in Linux and possible, yet convoluted
and confusing to do so from Windows. I wanted to avoid requiring the use of Linux because the
average user of such a drive may not have access readily available to a Linux system. Most of
the solutions for creating the drive in Windows either used a creation utility from HP
(questionable availability and suitability) or a slew of command line utilities and requiring a
floppy drive (or emulator) which seemed like an unnecessary and complicated hack to me. The
solutions I present may require you to download a few software packages from the Internet but
each only requires one command line utility and should be fairly straightforward. As an added
bonus all of the software is free and open source.
Note that these methods were specifically designed for installing FreeDOS, an open source DOS.
Similar methods may work for installing MS-DOS, DRDOS or other DOSs; however you will
need to obtain the boot sector (probably either from source or via extraction from a floppy disk
or disk image) and system files specific to your version of DOS. I recommend using FreeDOS
whenever possible as it is generally compatible and provides many additional features not found
in vintage DOSs.
The first method described is the FreeDOS direct booting method. The advantages of this
method are that the drive boots directly into FreeDOS and requires no files on the flash drive
root other than the FreeDOS system files (kernel.sys and command.com). The disadvantage is
that you must download an additional software package and FreeDOS is the only OS you may
boot from the flash drive.
The second method is the SYSLINUX chained booting method. Advantages to this method
include more configuration and customization options and the ability to boot floppy disk images
and/or other OSs from the same flash drive using a boot loader menu and chained boot loading.
None of these enhancements are covered here, this document will only help you get FreeDOS up
and running, for information on booting other OSs from the same drive see the SYSLINUX
documentation. The disadvantages of this method include three additional files in the flash drive
root (can be moved into other directories, see SYSLINUX documentation) and a slightly more
complicated (though transparently so) boot process.
Follow up:
Instructions for the FreeDOS direct boot method:
1. Download and extract the makebootfat and SYSLINUX software packages.
2. Download and extract (or burn the CD image) a copy of the FreeDOS system (such as the
"fdbasews" cd image) which includes the kernel source code.
3. Create a working directory on your system which you can use to assemble all the files
needed. You'll also need a subdirectory called "root" which will become the root of your
flash drive.
4. Copy the "makebootfat.exe" file from the makebootfat package into your working
directory.
5. Copy the "mbr.bin" file from the "mbr" subdirectory of the SYSLINUX program into
your working directory. Note that there is a MBR file which comes with makebootfat but
in my experience that file did not work correctly.
6. From the FreeDOS kernel source code package (if using the fdbasews distribution this is
in "FREEDOS\PACKAGES\SRC_BASE\KERNELS.ZIP" file) copy the "fat12.bin",
"fat16.bin" and "fat32lba.bin" files into your working directory. Rename each of these
three files so the extension is .bss instead of .bin
7. From the FreeDOS distribution copy at least the "command.com" and "kernel.sys" files
(may be found in "FREEDOS\SETUP\ODIN") into the "root" directory under your
working directory. You can include other files from FreeDOS or DOS applications here
now or copy them directly to the USB drive at a later time.
8. Format your flash drive from the command line:
FORMAT F: /fs:FAT32
Where F is the drive letter assigned to your flash drive. Note that some BIOSs do not
support booting from FAT32, in these cases you can run through this procedure again
substituting
FORMAT F: /fs:FAT
instead.
9. Remove all other USB drives (hard drives as well as other flash drives) from the
computer. Failure to do so may cause them to be damaged as FreeDOS is installed to
them instead. Then run the makebootfat program from a command line inside of your
working directory.
makebootfat -o usb -E 255 -1 fat12.bss -2 fat16.bss -3 fat32lba.bss -m mbr.bin root
Note that you may be able to read the makebootfat documentation and change the "-o
usb" option to install FreeDOS while other USB drives are attached to the system but that
is beyond the scope of this document.
FreeDOS should now be installed on the USB flash drive and with the BIOS set to boot from a
USB flash drive you should be able to boot into a working FreeDOS environment. Other
applications, FreeDOS programs and configurations files may be added to the environment
simply by copying them onto the flash drive as you would normally do. As long as the
command.com and kernel.sys files are in the root of the drive and the MBR and boot sector are
not rewritten the drive should remain bootable.
Instructions for the SYSLINUX chained booting method:
1. Download and extract the SYSLINUX software package.
2. Download and extract (or burn the CD image) a copy of the FreeDOS system (such as the
"fdbasews" cd image) which includes the kernel source code.
3. Create a working directory on your system which you can use to assemble all the files
needed. You'll also need a subdirectory called "root" which will become the root of your
flash drive.
4. Copy the "syslinux.exe" file from the "win32" folder of the SYSLINUX package into
your working directory.
5. Format your flash drive from the command line:
FORMAT F: /fs:FAT32
Where F is the drive letter assigned to your flash drive. Note that some BIOSs do not
support booting from FAT32, in these cases you can run through this procedure again
substituting
FORMAT F: /fs:FAT
instead.
6. From the FreeDOS kernel source code package (if using the fdbasews distribution this is
in "FREEDOS\PACKAGES\SRC_BASE\KERNELS.ZIP" file) copy the "fat32lba.bin"
file into the "root" directory under your working directory. Rename each of this file so
the extension is .bss instead of .bin Note that if you have formatted the flash drive as FAT
instead of FAT32 you'll need the "fat16.bin" file instead of the "fat32lba.bin" file and
rename it with the .bss extension. You will also need to substitute fat16.bss for
fat32lba.bss in the "syslinux.cfg" file created below.
7. From the FreeDOS distribution copy at least the "command.com" and "kernel.sys" files
(may be found in "FREEDOS\SETUP\ODIN") into the "root" directory under your
working directory. You can include other files from FreeDOS or DOS applications here
now or copy them directly to the USB drive at a later time.
8. Create a text file in the "root" folder under your working directory called "syslinux.cfg".
The file must contain:
timeout 1
default fdos
prompt 0
label fdos
BSS fat32lba.bss
append -
Later on you can add and expand this file to include other operating systems and options
for booting. Save and close the file.
9. Run the syslinux program from a command line inside of your working directory.
syslinux -ma F:
Where F is the drive letter assigned to your flash drive.
10. Copy the files from the "root" folder under your working directory to the root of your
flash drive.
FreeDOS and the SYSLINUX boot agent should now be installed on the USB flash drive and
with the BIOS set to boot from a USB flash drive you should be able to boot into a working
FreeDOS environment. Other applications, FreeDOS programs and configurations files may be
added to the environment simply by copying them onto the flash drive as you would normally
do. As long as the command.com, kernel.sys, syslinux.cfg, ldlinux.sys and fat32lba.bss files are
in the root of the drive and the MBR and boot sector are not rewritten the drive should remain
bootable.
Regardless of the method you may notice a warning during the FreeDOS boot process "Warning:
using suspect partition ... with calculated values ... instead of ..." My understanding is that this
comes from the flash drive not having the cylinders, heads and sectors (CHS) drive geometry
expected from a fixed disk by FreeDOS though it has caused no problems for me and FreeDOS
works as expected.

Sponsor Documents

Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close