Linux boot-up sequence
The first step: Of course, the power is on.
Step two: Load the BIOS settings and select the Startup disk. This is because the BIOS contains information about the CPU, device boot sequence information, hard disk information, memory information, clock information, PNP features, and so on. After that, the computer has a spectrum and knows which hardware device to read. After the BIOS has given control of the system to the first sector of the boot drive, Linux has started to control the system.
Step three: Load the grub from the MBR in the disk
MBR (Master boot Record): The primary boot partition, which is the first 512 bytes of the boot disk, with pre-boot information and partition information stored. The first 446 bytes, that is, the Grub boot program after 66 bytes is the partition table information
Fourth step: Load the Linux kernel system into memory and run the Super process/sbin/init process. In a Linux system, the process number of the INIT process is always 1, that is, the parent process of all processes in the system is the INIT process. You can view it using the command pstree.
Fifth step: Load the configuration file. After the INIT program starts, it reads the/etc/inittab file to determine the operating level of the system, with a Linux system running at 7, from 0-6
# 0-shutdown mode (do not set the Initdefault to 0, otherwise you will never be able to open the machine)
# 1-Single user mode (this mode is equivalent to rescue mode, kernel corruption, root forgotten password, etc. can be restored using this mode.) Equivalent to Safe mode under Windows)
# 2-Multi-user, but no NFS
# 3-Full multi-user mode (Text command line interface, general server is this mode)
# 4-Leave unused
# 5-Graphical Desktop (after the system is booted into a graphical desktop system)
# 6-Reboot (never set Initdefault to 6)
What we usually use is 1,3,5. Can be toggled using init 3, init 5. After the run level is determined, the appropriate configuration file is loaded. The first user-level file is the/etc/rc.d/rc.sysinit script, which does a lot of work, including setting the path, setting the network configuration (/etc/sysconfig/network), starting the Swap partition, setting the/proc, and so on.
Sixth step: Load the kernel module, depending on the/etc/modules.conf file or the file in the/ETC/MODULES.D directory to load the kernel module.
Seventh step: According to the operating level, the system will run RC0.D to rc6.d the corresponding script, to complete the corresponding initialization work and start the corresponding services.
Eighth step: Start the system process under INIT.D
Nineth Step: The screen of login system appears.
At this point, Linux on startup is complete.
This article is from "Linux rookie" blog, please be sure to keep this source http://ludihua.blog.51cto.com/4601284/1596129
Linux Boot Sequence overview