Hi,
Most people here seem to think that when the computer starts the BIOS should load a boot sector, which should load the kernel, which has to handle everything during boot. IMHO this thinking is wrong (unless kernel is capable of containing every device driver imaginable).
Let me illistrate an (again IMHO) much better way of booting - I'll explain each step after...
A) Somehow a "boot image" gets into memory
B) Some startup code is copied from the boot image into memory
C) The startup code is started
D) The startup code copies the kernel from the boot image into memory
E) The startup code starts the kernel
Ok, at first glance it looks like a lot of work for nothing, but...
Step A involves many different little utilities that all load the boot image into memory (I call these little utilities "boot loaders"). One for 1.44 Mb floppies, another for raw DOS, another for hard-drives, one for ethernet/TFTP, one for GRUB, one for serial ports/SLIP, one for bootable CD-ROM, etc. So here's the first 2 benefits: the OS doesn't have to care how the boot image gets into memory, and the OS can boot from ANYTHING.
The boot image contains FILES, where each file has a header that keeps track of the the file size, name, access flags, etc. This means that once the boot image is in memory all boot code can use it to "load" any files needed for boot. This includes the startup code, kernel/s, any device drivers, scripts, CLI/GUI, etc. This gives additional benefits: the kernel doesn't have to include every device driver imaginable, the boot image can contain multiple kernels, and the OS can work without ANY device drivers.
Step C (the startup code) gives the OS the ability to run code in real mode before the OS starts. Benefits include: sucking heaps of info out of the BIOS/s, handling a boot menu, setting up a video mode properly, letting the user change settings, selecting which kernel to boot (automatically or by user selection).
After the kernel has started, the boot image remains in memory. As soon as the virtual file system is working files are transfered from the boot image into the VFS cache, which behaves like a ram disk. Now you've got the kernel and full file IO working - the OS can continue booting while loading files like normal (even though there's still no device drivers). At this stage the OS might load a configuration script, a device manager, some generic device drivers, or seomthing else. Because any/all of these would be coming from RAM it makes the OS boot much faster
. Sooner or later the OS will load devices drivers to enable it to access files that aren't in the boot image (e.g. networking or hard-disk or something).
Once the OS has booted (and the storage device drivers, file systems, etc are running), the VFS code can write the cached files from the boot image to disk/network/whatever (if they aren't already there). This simplifies OS installation, as you can have a boot image that contains multiple kernels and heaps of device drivers which all end up automatically copied to disk (or wherever). Once this is done the OS can create a customized boot image (containing only the files needed to boot a specific computer), which can be used specifically for that computer in conjunction with any of the boot loaders mentioned in "step A".
It also makes it easy to produce a "demo disk" which allows a potential end-user to try out the OS without installing it, or an "application specific disk" which allows an end-user to use a specific application without installing the OS (e.g. someone could write a game for the OS and distribute the OS and game on a bootable CD - put it in the CD-ROM drive and restart your computer to play).
Cheers,
Brendan
PS. sorry for posting a long rant that doesn't actually answer the question asked...