Linux system startup (1) and linux system startup
This article uses Centos as an example to describe the entire Linux system startup process, including grub boot, initramfs process, and the general process of executing rc. sysinit and rc in/sbin/init.
In addition, this article provides an example to illustrate how to run the entire operating system in the memory (the system uses a physical disk storage operating system by default ).
1 Overview
From the software perspective, the process of starting a Linux system is as follows:
1) hardware and BIOS loading. Find the MBR through the startup Item and read the boot loader in the MBR, which is our commonly used grub tool.
2) boot loader, load kernel (vmlinux) and initramfs through the root device specified (such as grub. conf), and run init in initramfs.
3) switch to the real root fs, execute/sbin/init, and execute rc. sysinit.
4) run the service script under/etc/rc3.d.
For more information about what rootfs is, see [1.
[1]: What is the root file system (rootfs) http://www.crifan.com/what_is_root_filesystem/
2 grub
Grub startup parameters, such as title and timeout, are not described here when google searches for them.
Grub also plays a role in transferring parameters to the kernel when the kernel is started, for example, our common root = ..., It is the device that transmits the real root fs to the kernel, that is, the root device.
Other parameters that can be passed to the kernel, specific reference in the kernel source code directory has a document to describe its role: Documentation/kernel-parameters.txt (internal core src. rpm, after installing the source package, its kernel source code in/root/rpmbuild/BUILD/kernel-2.6.32-71.el6/linux-2.6.32-71.el6.x86_64 /).
The function is equivalent to modifying the corresponding parameter values under/proc/sys/kernel/. Take/proc/sys/kernel/panic as an example.
[Root @ localhost ~] # Cat/proc/sys/kernel/panic
0
[Root @ localhost ~] # Vim/boot/grub. conf
......
Root (hd0, 0)
Kernel/boot/vmlinuz-2.6.32-71.el6.5.vsds.x86_64 ro root = UUID = export rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG = en_US.UTF-8 SYSFONT = latarcyrheb-sun16 KEYBOARDTYPE = pc KEYTABLE = us panic = 2
Initrd/boot/initramfs-2.6.32-71.el6.5.vsds.x86_64.img
......
[Root @ localhost ~] # Reboot
[Root @ localhost ~] # Cat/proc/sys/kernel/panic
2
For more information, see [2].
[2]: acceptable parameters in the linux Kernel | pass parameters to the kernel through grub
Next we will talk to our friends about initramfs, and modify the system from running on disk to running on ramdisk by modifying initramfs.