Introduction
The BIOS of a PC is a piece of software that’s built-in to the machine, usually by being stored in a flash ROM on the motherboard.
The BIOS has effectively two purposes. The first is the one we’re directly concerned with here: taking the machine from its initial power-on state to the point where it can run GRUB. The second purpose, and the source of the BIOS’s name, is to provide a set of rudimentary device drivers for some of the hardware in the machine, so that bootloaders, and OSes that don’t know any better, have slightly easier lives.
Set up hardware (motherboard and expansion cards) Test hardware
Start bootloader
Provide services to bootloader and OS
Slide 103: BIOS responsibilities
BIOS startup
and not PCs in general. Nonetheless, there follows a brief description of the subject.
The first responsibility of the BIOS is to set up various aspects of the motherboard chipset so that the machine will behave like a normal PC. Modern PCs have a reasonably flexible and sensible hardware architecture, but when the operating system starts, it expects the system to look more-or-less like it belongs in 1983. This includes things like setting the PCI interrupt routing to look like an ISA bus, turning on the A20 gate (so the machine appears to have 1 Mb of memory) and so forth. When Linux starts, it will, of course, reverse a fair chunk of this brain-damage, but it’s all necessary for backward compatibility.
Having set up the motherboard, the BIOS will call upon the BIOS on any expansion cards to initialise. Usually this only means the video card, which sets itself up to look like a VGA card, and provides a few software routines for writing to the screen (The original PC BIOS predated VGA, so it needed a separate BIOS).
BIOS stores information in non-volatile RAM Configuration program built into BIOS
Slide 104: BIOS configuration
BIOS configuration
The BIOS stores the information it needs for starting up in battery-backed-up memory on the motherboard, infor- mally referred to as “CMOS”. The contents of this memory is what the “BIOS setup” program (usually built into the BIOS these days) modifies.
The Debian GNU/Linux installation manual3has some hints on BIOS configuration for running Linux.
BIOS booting
The next phase of the BIOS’s job is to start up the operating system. How it does this is slightly variable, but it usually consists of looking around the system for a bootable disc, loading one sector (512 bytes), known as the “boot sector” from it into a particular address in memory and starting execution there. Historically, the disc chosen was the first floppy drive (if it had a disc in it), or the first hard disc if that failed. Modern BIOSes have support for a wider range of boot devices (notably including CD-ROMs), and for disabling certain devices (so the students can’t boot the machines from floppy).
You might think that the BIOS’s job is finished once it loads the boot sector, but it isn’t. Because the boot sector (like bootloaders in general) is so small, it doesn’t contain any code to control the PC’s hardware. Instead, the BIOS provides facilities for using its code (which already has to exist to get this far) to access the hardware. Some primitive operating systems (notably MS-DOS) always use these BIOS drivers.
Interfaces grow less quickly than hardware
Very old BIOSes have a 64 MB RAM limit (e.g.mem=128Mmay help) Very old BIOSes have a 1024-cylinder (8.4 GB) disc limit
Old BIOSes have a 32 GB disc limit
Slide 105: BIOS limits
BIOS limits
Because the PC BIOS interface dates (ultimately) from 1983, it tends to contain assumptions about the scale of computer hardware which aren’t valid any more. It seems that generally, when one of these limits is reached, PC manufacturers come up with a means of extending the interface which is good for a few more years, before that in turn runs out of steam.
The two main fields in which this is seen are in disc and memory sizes. While the PC BIOS has an interface for determining the size of system memory, it has an upper limit on the size it can report (apparently at 64 Mb). There are newer BIOS interfaces for determining memory size, but on old machines with lots of RAM it may be necessary to explicitly tell Linux how much memory you’ve got. The Linux BootPrompt-HowTo has some information on this4.
The disc-size limitation is in a way more serious. The PC BIOS has, at various points, had limits on the size of disc it can address. As with memory, these limits have increased over the years, but a large disc in an old machine is liable to be problematic. This is a serious problem because the Linux bootloader has to use the BIOS to access the disc, so any part of the disc that will be used by the bootloader must be within the part of the disc the BIOS can address. As mentioned in the installation section, this is generally worked around by keeping a small partition (traditionally called/boot) that is within the BIOS-addressable range and contains everything necessary to load the kernel.