Introduction to linux startup process

We all know that because of the stability of Linux, it is usually used as a server system. If you want to be called a PHP master, Linux is a required course. So what happened in the middle of the Linux system from booting to booting? This article briefly discusses the mysterious process in the middle.

1. BIOS power-on self-test

  BIOS is the abbreviation of "Basic Input Output System" in English. In fact, it is a set of programs solidified on a ROM chip on the motherboard of a computer. The computer will load the BIOS information first, because the BIOS contains CPU-related information, device boot sequence information, hard disk information, memory information, clock information, and so on. After this, the computer has a spectrum in its mind and knows which hardware device to read.

2. Load the master boot loader (MBR)

  MasterBootRecord, that is, the master boot record, its size is 512 bytes, regardless of the location, but it stores pre-boot information, partition table information. The master boot program is a 512-byte image. Contains a little machine code and a small partition. The task of the primary boot program is to find and load the secondary boot program on the hard disk partition. Find the active partition through the partition table, and read the secondary boot loader in the active partition into the memory to run.

3、 boot loader   

  The bootloader is a small program executed before the operating system kernel runs. Through this small program, hardware devices can be initialized and a map of memory space can be established, so as to bring the system's software and hardware environment to an appropriate state and prepare for loading the kernel. Common bootloaders are Grub, Lilo and spfdisk

4. Load the linux kernel image   

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

  After the linux kernel gains control, it starts to do its own thing   

  (1) Testing hardware   

  (2) Unzip yourself and install the necessary drivers   

  (3) Initialize virtual devices related to the file system   

  (4) Mount the root file system and hang it under the root directory   

  (5) After completion, linux loads the init program in the process space, and init's turn is next. 5. The init process init is the initiator and controller of all processes, and all processes are derived from it. After the init process gains control, it will execute the /etc/rc.d/rc.sysinit script, set environment variables, network, start swap, check and mount the file system, and perform other initialization tasks based on the code inside.

  6. Self-customized startup program /etc/rc.local rc.local is the place where Linux leaves the user to customize the startup after all the initialization work. You can put the things you want to set up and start here.

  7. Execute the /bin/login program to enter the login state

The copyright belongs to the author. For commercial reprints, please contact the author for authorization, and for non-commercial reprints, please indicate the source. In the Internet + era, always keep learning, and join hands with Qianfeng PHP, Dream It Possible.

Guess you like

Origin blog.csdn.net/chengshaolei2012/article/details/72669102