Booting is the process of findling, loading and
initializing the
operating system. All operating systems have similar booting
sequences. I will use an
Intel box running
Windows NT for most of my examples.
Computers retain only items like date, time and hardware information between boot sessions. ROM gives the processor code to execute. BIOS contains routines for some hardware access (like drives, keyboards, etc), OS location and loading. CMOS contains editable information about the machine, like drive types, IRQs, etc.
To bootstrap an operating system (like WinNT):
- BIOS loads a sector from the hard disk that is reserved for booting. This sector is called the Master Boot Record (MBR) or the Boot Block.
- BIOS loads an internal program called the Master Boot Record Program (MBRP).
- The MBRP loads a larger program called the Operating System Loader Program (OSLP). In Linux, this is usually called LILO. If an operating system cannot be found, you get an error message.
- After the Operating System Loader Program is loaded, the OS is considered running. In NT, the OSLP also prepares the memory, CPU and I/O devices. The CPU in particular is set to 32-bit mode.
You can have different systems occupy the MBR, which will allow you to select from different operating systems. A word of advice: if you load a Microsoft operating system, it automatically takes over the MBR because Bill Gates assumes you want to use Microsoft products. One of my systems has WinNT, Win95 and BeOS available on boot-up.
Hehehe, Hardware Wars.
- Trikyguy - Good point, I should've included it.
- Funnytoes - Nice addition. I didn't back up to the power-on point like you did, I started from where the system was ready to load the OS.
- ccunning - You also had a large volume of pre-booting information (and another excellent node, to boot). But... the actual "process" is still similar. If I had said, "This is how a machine starts up from when you apply power", you would be correct and my writeup would be wrong. My writeup starts up where the Trampoline code starts in your writeup. I was avoiding the hardware issues alltogether, since (as you noted) hardware tends to be very specific as to what it does and how it does it. It is still "similar" - some code is run from (Intel = hard disk, Mac = firmware), a loader is run (Intel = MBRP, Mac = firmware code), an OS loader is run (OSLP/LILO for Intel, Trampoline for Mac) and the OS is considered running post-OS loader (Intel pushes Win/Linux, which does its thing, Mac pushes its MacToolbox, which does its thing). Not similar at first glance, but actually very similar when looked at with a wider perspective. Great writeup!