CentOS system startup process and system initialization

Source: Internet
Author: User

1. Linux Startup Process

1234 POST --> BIOS (Boot Sequence) --> MBR(bootloader) -> Kernel (CentOS5: initrd, CentOS6: initramfs) -> /sbin/init (CentOS5: /etc/inittab , CentOS6: /etc/inittab , /etc/init/ *.conf)


II startup details

(1) POST self-check


123456 POST self-check: the first step is to power up the CPU and then address, and the Code commands required for CPU addressing From ROM> hardware manufacturers (memory is divided into ROM + RAM), how to find the CPU Command code? The idea of hardware design is that the CPU can find a specific location. Code, and the code stored by ROM should be in a specific location. POST self-check at the same time It also detects memory, motherboard, video card, sound card, network card, and other I /O Device, wait for nothing The POST self-check is completed! Hand over the work to BIOS for processing


(2) BIOS

123 BIOS: (Boot Sequence) load the selectable Boot device-> firmware manufacturer Manufacturing The Bios stores information parameters of various I/O devices, system time, and startup search sequence. Therefore, you must check whether the Bios is normal. The first hard disk device will be loaded later


(3) MBR

123 MBR: The Master Boot Record of the hard disk, which exists in 0 Track No. 0 Slice, total 512 Bytes. Among them, Bootloader occupies 446 Byte, occupied by the partition table 64 Byte, occupied by magic num 2 Bytes. MBR will load Bootloader to start Subsequent work


(4) Bootloader


123456789 The Bootloader (kernel loader) is located at the frontend Side Of The 0th track, 0th sectors, and 446 bytes 446 bytes! Working Mechanism of Bootloader: bootloader can access the file system While the kernel exists as a file. Therefore, bootloader can access kernel files, In depth, when a bootloader accesses a kernel file, it stores the Kernel File Vmlinz The entire partition is accessed as the root, such /Vmlinz Root "/" Its location It is determined by the Kernel File. (Because each file must have its own starting path) Can you understand this logic? The common kernel loader in Modern Times is grub (Grand uniied Bootloader) Use grub to load the kernel. What grub did before loading the kernel

Step 1) grub loads the kernel files Vmlinz and grub to/boot,

The driver xxx. imgfile of all modules is also stored on/boot.

Use ll/boot to view

2) Next let's check what is stored in the grub directory.

The grub. conf configuration file is stored in the grub directory. The device. map disk map (ing partition/boot AND/root partition)

You will see stage1 stage2 and various stage1.5

1234567 1st stage: Located in MBR, to guide 2nd stage 1.5 stage: Located in the basic boot disk partition. The file system where the Kernel File is located provides the file system recognition extension (because the above It is mentioned that grub can only identify basic file systems, but the kernel file cannot be Therefore, grub must be assigned with the ability to identify the extended kernel advanced file system. Function) 2nd stage: Located in the basic boot disk partition, the GRUB boot program


3) view the content of the grub. conf file and the content of the device. map File.


Step 2 1) We have mentioned that the grub directory contains the device. map disk ing partition. Next we will check

Mapped root partition/path of various modules in (truly mounted partitions of the kernel)

2) Next, view the module. ko files in the path.

(5) Kernerl

123 Linux is a single-core system: composed of Kernel and various peripheral modules After the grub kernel is loaded, the kernel starts to decompress and work. Call init through the Virtual root file system initrfs



(6)/sbin/init take CentOS6 as an Example


123 /sbin/init The program is called by the first kernel, so the init PID is 1 Init calls its configuration file /etc/inittable And Startup Script /etc/init/rcS .conf Start each sub-process

/Etc/inittable


The/etc/rc. d directory contains the 123456 running directory.

Take rc3.d as an example. The directory contains processes, the running level, and the process status (K is enabled, and S is disabled) -->

Init is to control whether the process is a K or a S Manager (when the system switches between 1 2, 3, 4, and 6, the parent process fork comes from

The sub-process will switch between K and S)

PS: The above is my personal understanding of the Linix startup and initialization process. If you have any questions, please kindly advise




Rope life is so wonderful ~


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.