$keywords = 'Linux,booting,post,startup'; $descrip = 'The Linux Boot Process'; $up_txt = 'Peter\'s Linux Notes'; $up_url = ''; require_once('../_includes/include.php'); myHeader('Booting the Linux Operating System'); ?>
The first part of booting involves running code stored in the computer's ROM (Read Only Memory). This code is called BIOS (Basic Input/Output System). BIOS has only two functions:
You turn the computer on and the BIOS begins to execute. The first part of BIOS that runs is dubbed POST (Power-On Self Test). Basically, the computer runs diagnostic routines to check the existence and functioning of memory and other devices hooked up to the system. After posting, the rest of BIOS begins to execute.
One storage device is called the boot disk; this is the device that holds your operating system. Usually, if there is a disk in your floppy disk, your floppy disk will be the boot disk. Otherwise, the boot disk may be your CD drive or most commonly, one of your hard drives. The point is, BIOS will choose some device attached to your computer and call that the boot disk. That boot disk contains the operating system that will eventually be loaded.
After posting, BIOS will begin to read the 1st physical sector from the boot disk. This is head 0, track 0, sector 1. The computer will begin executing the code contained in this sector. At this point, the next thing that happens depends on whether you're talking about a partitioned boot disk (like a hard drive) or a non-partitioned boot disk (like a floppy or CD drive).
The boot disk's first logical sector is called a boot sector. The boot sector must contain a boot record. The boot record is 512 bytes long (the size of a sector) and is organized as:
0x000 - 0x002 A jump instruction to 0x0XX 0x003 - ... Disk parameters used by BIOS 0x0XX - 0x1FD Bootstrap Program 0x1FE - 0x1FF Holds 0xAA55 (the magic number for BIOS)
The "disk parameters" contain things like the number of tracks per disk, the number of sectors per track, etc. These numbers are stored at well known offsets, so all BIOS's know where to get the pertinant information.
The CPU executes the first line of the boot record, which is a jump to address 0x0XX where XX=3E for Linux and 1E for MS DOS. The bootstrap program loads a more sophisticated loader from elsewhere on the bootdisk. This second loader will then load the operating system.
Hard disks have an additional abstraction, called disk partitioning. In a partitioned hard disk, each partition (logical disk) is treated like a physical disk. A hard drive can have 4 such logical disks (partition). If a partition is a bootable partition then its first sector (logical sector 0. Remember there can be up to 4 sector zero's on a hard drive!) is a boot sector.
In a partitioned disk the physical head 0, track 0, sector 1 contains a partition sector rather than a boot sector. The partition sector proves information that describes the drive's partitioning.
Most Unix systems can boot into either automatic mode or manual mode. Automatic boot is what you're normally used to. Manual boot is the single-user mode that you go into when there's a problem bringing the system up.
In automatic mode, the system brings itself up using initialization and configure scripts without help from the user. In manual mode the system follows the automatic process up to a point but then gives control to the user. Most of the system is non functional and it's in single user mode.
There are 6 steps in the boot process:
Memory: 128128k/131072k available (984k kernel code, 412k reserved, 1508k data, 40k init)
parport0: Printer, Hewlett-Packard HP LaserJet 6MPDevice information at this point is usually underspecified so the kernel tires to determine the other information it needs by probing the bus for devices and asking the appropriate drivers for information. The drivers for devices that are missing or that don't respond to a probe are disabled. Even if a device is later connected to the system, it will not be accessible to unix processes until the machine has been rebooted.