Booting Process
Booting Process
Booting is starting up a computer or computer appliance until it can be used. It can be initiated by hardware such as
a button press or by software command. After the power is switched on, the computer is relatively dumb and can
read only part of its storage called read-only memory (ROM).
There, a small program is stored called firmware. It does power-on self-tests and, most importantly, allows
accessing other types of memory like a hard disk and main memory.
The firmware loads bigger programs into the computer's main memory and runs it. In general purpose computers,
but additionally in smartphones and tablets, optionally a boot manager is run.
The boot manager lets a user choose which operating system to run and set more complex parameters for it. The
firmware or the boot manager then loads the boot loader into the memory and runs it.
This piece of software is able to place an operating system kernel like Windows or Linux into the computer's main
memory and run it.
Afterwards, the kernel runs so-called user space software – well known is the graphical user interface (GUI), which
lets the user log in to the computer or run some other applications.
The whole process may take seconds to tenths of seconds on modern-day general-purpose computers.
Windows Booting Process:
The following is a summary of the boot process in a PC:
1. The power button activates the power supply in the PC, sending power to the
motherboard and other components.
3. The PC displays information on the attached monitor showing details about the boot
process. These include the BIOS manufacturer and revision, processor specs, the
amount of RAM installed, and the drives detected.
Many PCs have replaced displaying this information with a splash screen showing the
manufacturer's logo. You can turn off the splash screen in the BIOS settings if you'd
rather see the text.
4. The BIOS attempts to access the first sector of the drive designated as the boot
disk. The first sector is the first kilobytes of the disk in sequence, if the drive is read
sequentially starting with the first available storage address.
The boot disk is typically the same hard disk or solid-state drive that contains your
operating system. You can change the boot disk by configuring the BIOS or interrupting
the boot process with a key sequence (often indicated on the boot screens).
5. The BIOS confirms there's a bootstrap loader, or boot loader, in that first sector of
the boot disk, and it loads that boot loader into memory (RAM). The boot loader is a
small program designed to find and launch the PC's operating system.
6. Once the boot loader is in memory, the BIOS hands over its work to the boot loader,
which in turn begins loading the operating system into memory.
7. When the boot loader finishes its task, it turns control of the PC over to the
operating system. Then, the OS is ready for user interaction.
Linux Booting Process:
1. BIOS
BIOS stands for Basic Input/Output System
Performs some system integrity checks
Searches, loads, and executes the boot loader program.
It looks for boot loader in floppy, cd-rom, or hard drive. You can press a key (typically F12 of
F2, but it depends on your system) during the BIOS startup to change the boot sequence.
Once the boot loader program is detected and loaded into the memory, BIOS gives the control
to it.
So, in simple terms BIOS loads and executes the MBR boot loader.
2. MBR
MBR stands for Master Boot Record.
It is located in the 1st sector of the bootable disk. Typically /dev/hda, or /dev/sda
MBR is less than 512 bytes in size. This has three components 1) primary boot loader info in 1st
446 bytes 2) partition table info in next 64 bytes 3) mbr validation check in last 2 bytes.
It contains information about GRUB (or LILO in old systems).
So, in simple terms MBR loads and executes the GRUB boot loader.
3. GRUB
GRUB stands for Grand Unified Bootloader.
If you have multiple kernel images installed on your system, you can choose which one to be
executed.
GRUB displays a splash screen, waits for few seconds, if you don’t enter anything, it loads the
default kernel image as specified in the grub configuration file.
So, in simple terms GRUB just loads and executes Kernel and initrd images.
4. Kernel
Mounts the root file system as specified in the “root=” in grub.conf
Kernel executes the /sbin/init program
Since init was the 1st program to be executed by Linux Kernel, it has the process id (PID) of 1.
initrd stands for Initial RAM Disk.
initrd is used by kernel as temporary root file system until kernel is booted and the real root file
system is mounted. It also contains necessary drivers compiled inside, which helps it to access the
hard drive partitions, and other hardware.
5. Init
Looks at the /etc/inittab file to decide the Linux run level.
Following are the available run levels
0 – halt
1 – Single user mode
2 – Multiuser, without NFS
3 – Full multiuser mode
4 – unused
5 – X11
6 – reboot
Init identifies the default initlevel from /etc/inittab and uses that to load all appropriate
program.
6. Runlevel programs
There are the runlevel programs, executed from the run level directory as defined by your run
level.
Depending on your default init level setting, the system will execute the programs from one of
the following directories.