[Linux] Flow from power-on to PC startup
Rough flow
- The BIOS goes to read the master boot record
- Start the boot loader in it. (Boot loader: Program for booting the OS)
- Refer to the partition table which boot sector the boot loader reads (which OS to boot)
- Read the boot selector because you know the OS to boot by looking at the partition
- When the boot sector is read, the program for booting the OS starts.
- OS boot program boots the OS
Linux systems run in the following order
- Check the boot memory of the BIOS, load the hardware settings, check the boot device, and run the boot loader stored in the boot device's MBR.
- Load the bootloader kernel into memory and pass control to the OS. GRUB2 and GRUB are often used as boot loaders used in Linux, but LILO is used in older directory views. In addition, SYSLINUX is used for live media booted from DVD or USB.
- Kernel and initramfs memory load First, load the kernel. The kernel then mounts the initramfs and loads the kernel modules stored in the initramfs. By loading the kernel module, you will be able to load all the necessary drivers and mount the root file system.
- Mount the root file system Find, check for errors, and mount the root file system.
- Starting the init process The process init with process ID 1 is started to initialize the system. After that, start the service according to the runlevel.