The Linux Boot Process
This document is some very rough Personal Notes. As such, some information in this may not be correct. Any errors or omissions introduced into this information would be my mistake, so that should not be held against any sources I have used to help put this together.
Terms of Use:
Any “fair use” quoted text remains the property of the original source. As such, the Terms of Use from the original document would apply to that. The rest is covered under the
CC Attribution-Share Alike 3.0 Unported terms selected for this wiki.
Power ON
BIOS
Basic Input Output System (First written for the original IBM PC.)
MBR/EFI Bootstrap
From the saying/concept “to pull yourself up by your bootstraps.” … 1st access of the Drives or Boot Media
the BIOS/MBR method:
On IBM PC-compatible computers, the BIOS bootstrapping firmware loads and executes the master boot record.
The MBR is the initial boot loader (Bootstrap Loader) which resides in the first 512 byte sector of the storage device.
Bootstraping the system in this manner examines the partition table and finds a bootable partition, then searches for the installed Boot Loader package – to select & load the desired
OS.
the EFI/UEFI method:
the UEFI firmware reads its Boot Manager data to determine which UEFI application is to launch from where.
The firmware then launches the UEFI application (the Boot Loader) as defined in the boot entry for this boot firmware.
GRUB 2 and elilo serve as conventional, full-fledged standalone UEFI boot managers for Linux. Once loaded by UEFI firmware, both can load kernel images from all devices, partitions and file systems they support.
“UEFI (Unified Extensible Firmware Interface) was developed among others to support hard-disks larger than 2TB in sizes, an impossible achievement by using the traditional BIOS-MBR method, which limits the filesystem sizes to maximum 2TB and and the maximum number of primary partitions to three (with the fourth being extended). UEFI works hand-in-hand with GPT partition table on hard drives no matter of what size the hard drive has, as long as the system is booted from UEFI mode, making impossible to use MBR once the system was started in UEFI mode. You can use GPT on UEFI systems only if the system in started in BIOS Legacy Mode by tampering with UEFI settings. Also, all partitions from a GPT table layout are now primary by default and can support up to 9.4 zettabytes in sizes with a number of 128 partitions.”
Boot Loader
“A number of boot loaders exist for Linux; the most common ones are GRUB (for GRand Unified Boot loader) and ISOLINUX (for booting from removable media). Most Linux boot loaders can present a user interface for choosing alternative options for booting Linux, and even other operating systems that might be installed.”
Kernel for Linux OS
“The boot loader loads the selected kernel image (in the case of Linux) and passes control to it. Kernels are almost always compressed, so its first job is to uncompress itself. After this, it will check and analyze the system hardware and initialize any hardware device drivers built into the kernel.”
Intial initramfs RAM Disk
initramfs
is the temporary ramdisk image, which contains all the files required for the kernel to initialize the hardware and mount the root filesystem.
udev (for User Device) is responsible for figuring out which devices are present, locating the needed drivers, and loading them.
All partitions and/or volumes for the root filesystem are found, checked for errors (as appropriate), then mounted.
Then the mount program notifies the
OS that each part of the filesystem is ready for use, and associated with the proper mount point in the filesystem hierarchy.
Once the root filesystem has been mounted, initramfs is cleared from RAM, and the init
program on the root filesystem (/sbin/init
) is executed
/sbin/init and Services
After the kernel has initialized all the hardware, and mounted the root filesystem, then the kernel runs /sbin/init
init
is the parent or 1st process (PID 1) which starts the other processes needed to get the
OS running.
Only kernel processes (the inner workings of the
OS) are handled directly by the kernel – instead of
init
init
is also the “manager of last resort” – which keeps the system running in a clean & properly functioning manner.
When a user logs in or out, init
will also start or restart user login services.
Command Shell via getty
“Near the end of the boot process, init starts a number of text-mode login prompts (done by a program called getty). These enable you to type your username, followed by your password, and to eventually get a command shell.”
X Windows System
If used, loading the X Window System is the final step in the boot process
The Display Manager service keeps track of the displays being provided, and loads the X server
The Display Manager handles graphical logins, then starts the appropriate desktop environment after a user login.