The DOS Boot Process
The system boot sequence is the series of steps that the system performs
when it is turned on (or rebooted with the reset switch, for example). This
always starts with the special boot program software that is in the system
BIOS ROM. The BIOS has several steps that it must perform to test the system
and set it up, before any operating system can be loaded.
Once the BIOS has completed its startup activities, the last thing it does
is to begin the process of loading the operating system. It does this by
searching for a boot device containing boot code to which it can hand off
the boot process. It will search for boot devices in the order specified
by the BIOS setting that controls the boot sequence. If it cannot find a
boot device it will terminate with an error.
Assuming that the BIOS finds a boot sector on a device, the process of loading
DOS begins. The process below outlines booting from the hard disk. Booting
from the floppy disk differs only in the first few steps, because the floppy
disk's structures are slightly different. Floppies cannot be partitioned,
and hence have no master boot record or partitions. This means that the steps
where the master boot record are searched are skipped.
Here are the steps in the DOS boot process:
-
The BIOS, having completed its functions, loads the boot code in the master
boot record and transfers control to it. The master boot record code begins
execution. If the boot device is a floppy disk, the process continues with
step 6.
-
The master boot code examines the master partition table. It is searching
for two things. First, it must determine if there is an extended DOS partition.
Second, it must determine if there is a bootable partition specified in the
partition table.
-
If the master boot code finds an
extended partition on the
disk, it loads the extended partition table that describes the first logical
volume in the extended partition. This extended partition table is examined
to see if it points to another extended partition table. If it does, then
that table contains information about the second logical volume in
the extended partition, so it is loaded and examined. (Recall that logical
volumes in the extended partition have their extended partition table chained
one to the next.) This process is continued until all of the extended partitions
have been loaded and recognized by the system.
-
After loading the extended partition information (if any), the code attempts
to boot the primary partition that is marked active (bootable). If there
are no partitions marked active, then the boot process will terminate with
an error. The error message is often the same one that occurs if the BIOS
finds no boot device, and is generally something like "No boot device", but
can be the infamous "NO ROM BASIC - SYSTEM HALTED".
-
If there is a primary partition marked active, the code will boot it. The
rest of the steps assume this is a DOS primary partition.
-
The volume boot sector is loaded into memory and tested, and the boot code
that it contains is given control of the remainder of the boot process.
-
The volume boot code examines the structures on the disk that it is booting
to ensure that everything is correct and in the right place. If not, the
boot process will end in an error here as well.
-
The code searches the root directory of the device being booted for the operating
system files that contain the operating system. For a system running MS-DOS
these are the files "IO.SYS", "MSDOS.SYS" and "COMMAND.COM".
-
If the operating system files are not found, the boot program will display
an error message, which is usually something like "Non-system disk or disk
error - Replace and press any key when ready". Some people think that this
message means the system was never booted, that the BIOS examined the floppy
disk for example and just rejected it because it couldn't boot it. As you
can see from this description of the boot process, the volume boot code was
indeed loaded and executed, and in fact it is what prints the message when
it can't find the operating system files!
See here for an explanation of
why this distinction is so important.
-
If the operating system files are found, the boot program will load them
into memory and transfer control to them. These larger files contain the
more complete operating system code that loads and initializes the rest of
the operating system structures. For MS-DOS, this means loading the command
interpreter and then reading and interpreting the contents of the CONFIG.SYS
and AUTOEXEC.BAT system control files.
At this point the operating system code itself has control of the PC. In
the case of an operating system like Windows 95 the initial operating system
files control the loading and execution of many more routines as the boot
progresses. In fact, it is surprising in some ways just how many different
pieces of code have a hand in starting up the PC.
Next:
Boot Sector Viruses