Home >Operation and Maintenance >CentOS >centos6 startup process

centos6 startup process

王林
王林Original
2020-03-31 13:56:583105browse

centos6 startup process

centos6 startup flow chart:

centos6 startup process

1. POST power-on self-test

Load the BIOS hardware information and obtain the first boot device. Self-test is mainly to check whether the hardware device exists and can operate normally.

For example, the BIOS will check whether the CPU, memory and I/O devices can operate normally. If it is a personal computer, it may also check the monitor. As soon as the power is turned on, the CPU will automatically load the BIOS program on the ROM chip. This is how it is implemented. After the detection is completed, the hardware device is initialized.

2. MBR boot loading

When there is no problem with the hardware self-check in the first step, here is the BIOS as an example. The BIOS will go directly to the first step of the hard disk. sector, find the first 446 bytes, and load the MBR into the memory. The MBR will tell the program where to find the system grub boot in the next stage.

This stage belongs to the first stage of grub. The previous BIOS reads and executes the bootloader in the MBR of the boot device. The function of the bootloader is to provide a menu for the user to select the system or different kernel versions to start, because there may be more than one on a hard disk. operating system. Then the kernel version selected by the user is loaded into a specific space in RAM, then decompressed and expanded in RAM, and then system control is handed over to the kernel.

(Recommended tutorial: centos tutorial)

3. Load the system kernel kernel and execute system initialization information

When the Bootloader starts to read the operating system kernel file, it will decompress the kernel file and install it into the memory, and then start loading each device according to the functions provided by the kernel. Each operation here is completed by the kernel, and our kernel files are usually stored in the /boot directory and are files starting with vmlinux. As shown in the figure below:

[root@centos6 ~]# cd /boot
[root@centos6 boot]# pwd
/boot
[root@centos6 boot]# ls
config-2.6.32-696.el6.x86_64           lost+found
efi                                    symvers-2.6.32-696.el6.x86_64.gz
grub                                   System.map-2.6.32-696.el6.x86_64
initramfs-2.6.32-696.el6.x86_64.img    vmlinuz-2.6.32-696.el6.x86_64
initrd-2.6.32-696.el6.x86_64kdump.img

However, the kernel program has not been loaded to the disk at this time. How to read the kernel file? If you want to load the disk first, you need a disk driver, and the driver is on the hard disk, which will lead to an infinite loop. So we have to use something called a virtual file system to solve this problem. Similarly, this file system is also placed under /boot and is a file starting with initrd, as shown in the figure above.

Boot Loader can load the kernel and initrd, and then decompress the initrd into the root directory. Then the kernel can load the driver on this virtual root file system, then release the root file system, and finally start the normal startup process. .

4. Start init

For CentOS6, the init configuration file is: /etc/inittab, /etc/init/*.conf, that is, upstart will The configuration file is split into multiple files. The files ending with conf in the /etc/init/ directory are all upstart-style configuration files, while /etc/inittab is only used to set the default run level. The run level is set for the purpose of system operation or maintenance, and is divided into 0-6, with a total of seven levels:

     0:关机(shutdown);
     1:单用户模式(single user):不需要通过认证,登录进去之后为root用户身份;
     2:多用户模式(multi user):会启动网络功能,但不会启动NFS;
     3:多用户模式(multi user):为完全功能模式,提供文本界面;
     4:预留级别,目前无特别使用目的;
     5:多用户模式(multi user):为完全功能模式,提供图形化界面;
     6:重启(reboot),reboot;

Usually we use the default level 3 or 5, and pages of different levels can be switched. The switching method is: init[0-6], use the runlevel command to view the current running level.

5. User login

Recommended related video tutorials: linux video tutorial

The above is the detailed content of centos6 startup process. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn