Overview of the Linux system startup process

Note: The following is a general description of running "man boot" in Centos6 (the translation level is limited, please bear with me ^_^), other branches may be slightly different.

The Linux system startup process can be roughly divided into the following five steps:
1. Hardware startup.
2. System boot.
3. Start the kernel.
4. Run the init process.
5. Call the startup script.

Now let's follow the process together!
1. Hardware startup (Note: the case of network startup is not discussed)
    After power-on or hardware reset, the first program that the system runs is called BIOS, which is stored in ROM. The job of reading boot parameters from memory. It executes the system bootloader pinned to the boot device and transfers control to it.

Second, the system boot
    system boot program is generally located in the first sector on the boot device, usually called MBR (Master Boot Record), but its size is limited (including the file partition table is only 512 bytes), so it is also There is a second bootloader, usually lilo or grub on linux. Their main job is to locate the kernel on disk, load and run it, allowing interactive use.

3. Start the kernel
    After the kernel is loaded, it will initialize the driver device, start the swapper kernel process, mount the root file system, and finally create the first user process (PID=1) through the /sbin/init program.

Fourth, run the init process
    When the init process starts, it first reads the /etc/inittab file to determine the system running level, and finally calls the startup script to start the corresponding management service.

5. Call the startup script
    Each management service is stored in the /etc/init.d directory in the form of a startup script. In order to facilitate starting/stopping the corresponding services under each operating level, the directory /etc/rc[0-6S].d contains A symbolic link script for each service under each run level is provided, where the one starting with S represents the start of the service, and the one starting with K is the stop of the service. In addition, in order to better set the startup parameters, linux provides the /etc/sysconfig directory, which contains the parameter configuration files required by each service startup script.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326445638&siteId=291194637