Linux boot process and custom gurp

Source: Internet
Author: User

Linux startup process

POST BIOS (Boot sequence) selects the boot device sequence in the MBR to see if there is a bootstrapper,----> MBR (bootloader) provides a list of cores-------> Loads the selected KERNEL,INITRD ( Memory emulated disk device requires cache), Initramfs (cache)----> get to root filesystem and mount, run Init

Bootloadler the loading process after the start

1, when the system reads bootloader, mount the kernel partition, do not recognize more advanced disk partition, can only be placed on the basic disk partition, and only support read1, so the kernel and the root is not on the same partition, we usually attach the basic disk partition of the kernel is mounted on the boot partition.

2, the final bootloader at the time of the launch is temporarily mounted/down to find Vminuz

3, in order to save disk space Vmlinuz is compressed, save space and ensure the IO speed. When using the kernel needs decompression, at this time Vmlinuz is divided into 2 segments, one is no compression (decompression algorithm), the other end is compressed.

After decompression bootloader read Initramfs, the control is completely given to kernel, the kernel completes its own initialization, the loading of the disk after the start of Init

Question 1:/lib/modules in the file system, how is kernel mounted? How can I find the driver for this drive without mounting?

/lib/modules/is the location of all the modules required for Linux, but kernel now does not know what our device hardware is, kernel it is impossible to put all the modules in the kernel because there are too many hardware devices and function modules. So I put it in the/lib/modules. But/lib/modules is also in the file system. Then how can kernel find the drive module of the hard disk to complete and load it? Because the module at this point is on the root filesystem, we need to mount it before we can find all the modules. This is the reason why you need to place a initrd file in the boot partition. This is the temporary root filesystem mounted after loading kernel on startup.

Question 2: Who detected the model of your hard drive, and put the corresponding driver module in the Initramfs file to provide to bootloader?

is to install the operating system, the installation program when installing the operating system can detect your hard disk is what device, need to boot program, made Initramfs file into the bootloader can read to the root file system, so kernel can through this file to load the root file system, You can then read the/lib/modules/load all the other required modules.

This is the file, so it is possible to install the same operating system, but the drive is different. Causes the drive to swap and not start.

INITRD is a file system that helps kernel complete initialization. The kernel wants to mount it, take this as root, mount it here to load the driver module of the real root filesystem, after loading INITRD a program can replace with the file system, replace the real root file system with INITRD, replace the end of this application, Self-termination is the NO. 0 process that the system starts. After that, you'll visit/sbin/init.

/sbin/init: function

/etc/inittab

/etc/rc.d/rc.sysinit Script

Init features:

Centos 5 INIT:SYSTEMV format: The boot sequence is serialized, the initialization program is executed one by one

Centos 6 Init:upstart: The program is still dependent, but does not wait for the dependent program to complete initialization (the startup initialization program communicates with each other through Dbus), and System V compatibility is not good.

Centos 7:SYSTEMD, compatible with SYSV. and refer to the process of parallel initialization in OS X

Start the application: Define the application to the start level

0: Turn off the machine

1: Single-user mode

2: Multi-user mode, NFS input system not supported

3: Full multi-user mode

4: Reserved level

5: Full Multi-user mode: Graphics mode

6: Restart

Linux boot process and custom gurp

Related Article

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.