To crop a system, you must first understand the entire startup process of the system and the configuration files required by the system. In this way, you can understand what you are doing and what you need to do.
Startup Process details
POST --> BIOS (Boot Sequence) --> MBR reads BootLoader ---> Kernel ~ Initrd ~ --> Init (/etc/inittab)
The computer itself will not execute the program. The system will map the program in a ROM to the address space that the cpu can address and allow the cpu to execute the commands, these commands are used to complete system detection. After the detection is complete, if the core hardware has no problems, then find the MBR on the corresponding device according to the startup process set in the BIOS; if the MBR exists, it will read the Bootloader In the MBR. the Bootloader configures the location of the kernel of all the boot operating systems, then loads the kernel into the memory, decompress it, and complete kernel initialization, bootloader gives control to the kernel
Kernel Initialization
Work completed by kernel initialization; hardware probe --> load driver --> mount the root file system --> start the first process (init) of the user space ). The configuration file of init is/etc/inittab. The Red Hat 6 is upstart (also called init. The configuration file of upstart is in/etc/inittab and/etc/init /*. conf file
Introduction to initrd
The initialization of the kernel depends on the driver. If these drivers are not directly in the kernel, You need to load the driver to a file path, when the kernel accesses the root file system device, but the device driver is not directly loaded to the kernel, the kernel first needs to find the device driver on the file system, but the file system is not mounted, initrd is the intermediary between the kernel and the file system. Initrd has an additional device driver on which the kernel depends, the most important thing is that the driver kernel of the root file system uses initrd to provide the kernel with the basic driver required to access the real file system. Therefore, initrd is an auxiliary transitional middle layer, it can connect the kernel with the real file system. After the connection, the work is completed.
Main work completed by init
The init function is defined in the inittab configuration file. It mainly includes setting the default running level and system initialization script (dependent script/etc/rc. d/rc. sysinit), run the service script at the specified level (the service script is in/etc/rc. d/init. d/directory, these service scripts are linked to/etc/rc. d/rc #. in the d/directory, # indicates the system running level (rc0.d -- rc6.d) and the last running script rc. The significance of setting ctrl + alt + delet in local is to set the program in case of sudden power failure to set the program after power recovery and then start the virtual terminal. (With the default running level and initialization script, the system can run)
/Etc/rc. d/rc. sysinit Main Functions
In the inittab, the second step is to execute/etc/rc. d/rc. run the sysinit script program to detect and remount the root file system in read/write mode; set the host name; detect and mount other file systems in/etc/fstab; and activate swap partitions; enable the swap partition to initialize the driver of the peripheral hardware device. According to/etc/sysctl. conf sets kernel parameters to activate udev and selinux; activates lvm and RAID devices to clear expired locks and FID files