- The x86 BIOS: Its Limits and Capabilities
- 16- and 32-Bit Code
- The BIOS as Driver for DOS
- Modern Uses of the BIOS
- What BIOS Do You Have?
- Add-On Card BIOSs
- Video BIOSs
- Boot BIOSs for SCSI and Networking
- Additional BIOSs
- BIOS Updates
- EIDE and SCSI Hard Disk Handling
- Understanding CHS Geometry Limits
- Getting Around the 1024-Cylinder Limit
- Common BIOS Disk Utilities
- The Handoff to the OS
The Handoff to the OS
Perhaps the most important aspect of what the BIOS does is to transfer control of the computer to programs stored on some other medium. These programs are simple boot loader programsprograms that boot one or more OSs. Boot loaders can exist on several different media:
Floppy diskWhen you boot from a floppy disk, the BIOS loads the boot loader from the first sector of the floppy disk. This sector is often referred to as the boot sector.
Hard diskA hard disk's boot sector is referred to as the master boot record (MBR). It contains information beyond that normally stored in a floppy disk's boot sector, such as information on how the disk is partitioned.
Network boot serverIf a computer is configured as a diskless workstation, it can retrieve its boot files from a network server.
CD-ROMBootable CD-ROMs have become common in recent years. Typically, these contain a disk image that's identical to a boot floppy, complete with boot sector, along with special CD-ROM structures. This combination is known as an El Torito boot CD-ROM.
High-capacity removable mediaLS-120 disks, Zip disks, and so on can be made bootable, following either the floppy disk model of a boot sector or the hard disk model of using an MBR.
In all cases, the BIOS must support the specific boot medium. In the mid-1990s, most BIOSs supported only floppy disk and hard disk boots, and SCSI hard disks required support from a SCSI host adapter's boot BIOS. Today, support for bootable CD-ROMs and at least some varieties of removable media is common, as is an ability to switch which device to try first. Network boots and boots from SCSI devices still require boot BIOSs on the respective adapter cards. In the case of SCSI CD-ROM drives, the SCSI host adapter must support booting from El Torito CD-ROM media. Some SCSI host adapters support booting from removable media devices such as Zip drives by using an option to treat removable devices as if they were fixed (non-removable) disks.
In any event, the BIOS loads the first sector (512 bytes) of the disk and uses that as a loader program. By today's standards, 512 bytes is very little space, so boot loader programs are necessarily quite simple. Some boot loaders rely on additional code stored elsewhere on the hard disk to function properly. All of them rely on additional programs to set boot options. These external programs can be as simple as DOS's FDISK, which can rewrite a bare-bones MBR, or as complex as dedicated third-party boot loader utilities such as System Commander.
After the BIOS has loaded the boot loader code, the BIOS runs that code. What happens then varies depending on the boot loader, but ultimately, an OS is loaded into memory and takes over control of the computer. Depending on the OS, the BIOS might then play no further role in the operation of the computer.
Boot loader programs aren't the only ones to use the boot sector or MBR. Some varieties of virus also hijack this portion of the disk. These viruses are known as boot sector viruses, and they work by taking over the computer before the OS has a chance to load. The virus must then load the OS and hide evidence of what it's done. Viruses of this type often spread themselves on floppy disks because the boot sector can be executed even on non-boot floppies, especially if the disk is left in the computer accidentally. Most boot sector viruses are written for DOS or Windows 9x, and when they infect a computer that runs another OS, they might fail to boot the OS or can be wiped out by the OS during the OS's boot process.