Linux Boot Sequence
1. CPU Initialization
Initialization of the CPU itself. Take the instruction from a fixed location (0XFFFFFFF0) and run it as a jump instruction. Jump to the header of the BIOS code.
2. Load the BIOS
The BIOS is cured in a ROM on the motherboard, which starts with a self-test (POST) and then loads into the kernel boot program.
The post phase detects the system hardware. Includes memory detection, system bus detection, and so on.
3. Read MBR
After post. The BIOS reads the first sector (MBR) of the boot device, which is a 512-byte message. The MBR preserves the starting part of the kernel boot program. The BIOS loads it into memory and runs it.
The master bootstrapper in the MBR. Includes 446-byte program code and a 64-byte partition table.
4. Load the system kernel
Run the MBR in the main bootstrapper program. The partition table is scanned. Looking for an active partition, the boot record for the active partition has a secondary boot, which is loaded into memory and running, which is responsible for loading the Linux kernel image and handing control over to the kernel.
The kernel image is stored in a compressed form and cannot be run, and it is loaded into memory and is first self-extracting.
5. Kernel initialization
The kernel starts the first program. The Init,init process is the origin of all processes in the system, and the process number is always 1. The init process generates the Getty process, and the Getty process generates the login process, after the login succeeds. The login process generates a shell process. We use the shell to generate other processes. Init works according to the file/etc/inittab file to complete.
6. Run the/etc/rc.d/rc.sysinit script
/etc/rc.d/rc.sysinit is the first script that Init runs. Its role is to initialize the Linux system, including environment variables. Network configuration, check file system and so on.
7. Run the Run-level script
The run-level of the system has been determined in/etc/inittab, and the corresponding command script/ETC/RC.D/RCX.D is run.
8. Start other modules
For example, memory management, hard disk Management, and so on.
9. Run the/etc/rc.d/rc.local script
/etc/rc.d/rc.local the last script to initialize the system. Users can join the system startup service here, for example httpd.
10. Running/bin/login
This program prompts the user to enter username and password, correctly handing over control to the shell process.
11. Shell Startup
Linux Boot basic process