wiki.allensmith.net

Personal "Rough Notes" & Useful Links

User Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
kb:linux:bootprocess [2015/02/09 00:54]
Allen Smith Deleted (deleting "rough drafts" to remove excessive quoting )
kb:linux:bootprocess [2016/01/14 01:35] (current)
Line 1: Line 1:
 +====== The Linux Boot Process ======
 +{{INLINETOC}}
  
 +**References:​**\\ ​
 +edx.org → [[https://​www.edx.org/​course/​introduction-linux-linuxfoundationx-lfs101x-2 | LinuxFoundationX:​ LFS101x.2 Introduction to Linux]] » Chapter 03 → Section 2: The Boot Process\\
 +Wikipedia →[[wp>​Master_boot_record|Master boot record]] and [[wp>​EFI_System_partition|EFI System partition]]\\ ​
 +[[http://​www.bytelinux.com/​install-ubuntu-14-10-server-with-custom-partition-layout-using-lvm-on-uefi-systems/​ | Install Ubuntu 14.10 Server with Custom Partition Layout using LVM on UEFI Systems]]
 +
 +{{page>​data:​personalnotes&​noheader&​nofooter&​noeditbtn}}
 +<note important>​**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 [[http://​creativecommons.org/​licenses/​by-sa/​3.0/​ | CC Attribution-Share Alike 3.0 Unported]] terms selected for this wiki.</​note>​
 +
 +===== Power ON =====
 +  * Pushing the Power Button (or something else like Wake-on-Lan) sequences the electronics to the "fully on" state.
 +
 +===== BIOS =====
 +**Basic Input Output System** (First written for the original IBM PC.)
 +  * POST -- Power On Self-Test
 +    * Detects devices and performs some very basic tests that the hardware is functional
 +    * initializes the hardware, including the screen and keyboard
 +  * The BIOS provides primitive access to hardware such as Drive Media & Networking (so the system can boot)
 +
 +===== MBR/EFI Bootstrap =====
 +From the saying/​concept ​ "to pull yourself up by your bootstraps."​ ... 1st access of the Drives or Boot Media
 +  * Once the POST is completed, the system "​Bootstraps"​ to pass control from the BIOS to the Boot Loader.
 +    * for MBR (Master Boot Record), the **1st sector** on a hard drive contains the code needed to load the Boot Loader
 +    * for more recent Extensible Firmware Interface (EFI) or Unified Extensible Firmware Interface (UEFI) systems, the code to load the Boot Loader is found in the EFI partition
 +
 +  * 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**.
 +      * This must be the **1st sector of the device**, and **not** the 1st sector of a partion, etc..
 +    * 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.
 +      * usually this means identifying on which disk and partition the EFI partition can be found.
 +    *  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.
 +
 +<​note>"​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."</​note>​
 +
 +===== 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."​
 +
 +  * when booting Linux the Boot Loader needs to load both the **kernel image** and the **initial RAM disk**
 +    * In the Linux directory structure, the Boot Loader resides under **''/​boot''​**
 +    * a (text based) splash screen may be displayed, to choose which Operating System (OS) or even which kernel version to boot
 +    * for Linux, the Boot Loader loads the (selected) kernel, **and also loads** the initial RAM-based file system (**''​initramfs''​**) into memory -- so that can be used directly by the kernel
 +
 +===== 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 **U**ser **Dev**ice) 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.
 +    * it provides the ability to terminate or restart any non-kernel processes (programs and services) that stop responding
 +  * 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.