Five steps in the Linux boot process

  
                

We all know that Linux system startup is very fast, so what content does the Linux system load during the boot process? The following small series will introduce you to the detailed process of starting the Linux system, so that you have a detailed understanding.

press the power button until after the welcome page out, linux altogether to do can be divided into five steps to complete.

1. BIOS power-on self-test:

Power-on self-test, detecting hardware devices. Then search for the bootable device in the active state in the order above cmos. It can be an optical drive, a floppy disk, a USB, or the like.

2. Load the master boot loader (MBR):

The master bootloader is a 512-byte image. There is a little machine code and a small partition.

The main bootloader's task is to find and load the secondary bootloader on the hard disk partition. The active partition is found through the partition table, and the secondary boot loader in the active partition is read into memory and run.

3, load the secondary boot record program (GRUB)

The secondary boot loader is only loaded with the Linux kernel.

After the last phase, the bootloader will run in memory. The GRUB graphical interface will appear, allowing the user to choose which kernel to load.

4, linux kernel image:

After the user selects the kernel to be loaded, the secondary boot loader (GRUB) will be based on the information set in the /boot/grub.conf configuration file. Read the Linux kernel image from the partition where /boot/is located, then load the kernel image into memory and give control to the Linux kernel.

After the Linux kernel gains control, it starts its own business

1), detects hardware

2), decompresses itself and installs the necessary drivers

3), initialize the virtual device related to the file system, LVM or RAID

4), load the root file system, hang under the root directory

5), after completion, linux in the process space Load the init program inside, the following is the init work

5, init process

init is the initiator and controller of all processes, all processes are derived from this.

After the init process gains control, it executes the /etc/rc.d/rc.sysinit script, sets environment variables, networks, starts swap, checks and mounts the file system, and executes other programs based on the code inside. Initialize the work.

At this point, the Linux boot is complete.

Let's summarize it a bit:

The first is the BIOS power-on self-test, after loading the main boot loader, the secondary boot loader, and finally the linux kernel image, and then hand over control to init Process, complete the initialization work.

What is the swap partition?

Similar to the virtual memory in the windows system, when the physical memory is not enough, use the memory in the swap.

The above is the introduction of the detailed process of booting up the Linux system. Usually you may not pay serious attention when booting. In fact, the Linux system does a lot of things when booting.

Copyright © Windows knowledge All Rights Reserved