This article mainly takes CentOS as an example, tells the whole Linux system boot process, including grub boot, INITRAMFS process,/sbin/init executes rc.sysinit and RC general flow.
In addition, this article has an example of running an entire operating system on an instance of memory (the system uses a single physical disk to store the operating system by default).
1 Overview
Linux system from the software point of view, the general process of booting is as follows:
1) Hardware and BIOS loading, find the MBR through the boot entry, read the boot loader in the MBR, which is our common grub tool.
2) boot loader, load kernel (vmlinux), Initramfs, and run init in Initramfs by using the root device (such as grub.conf) specified.
3) switch to True root FS, execute/sbin/init, execute rc.sysinit.
4) Execute the/ETC/RC3.D service script.
The reference document [1] describes what ROOTFS is and is more understandable.
[1]: What is the root file system (ROOTFS) http://www.crifan.com/what_is_root_filesystem/
2 Grub
Grub startup parameters, such as Title,timeout, Google a lot of search, it is not described here.
There is also a function of grub, that is, when you start the kernel, pass parameters to the kernel, such as our common root= ..., is to pass to the kernel the true root FS device, that is, root device.
Other parameters can be passed to the kernel, specifically in the reference kernel source directory has documented its role: Documentation/kernel-parameters.txt (in the kernel 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/).
Its function is equivalent to modifying the corresponding parameter value under/proc/sys/kernel/, taking/proc/sys/kernel/panic as an example.
[Email protected] ~]# Cat/proc/sys/kernel/panic
0
[Email protected] ~]# vim/boot/grub/grub.conf
......
Root (hd0,0)
kernel/boot/vmlinuz-2.6.32-71.el6.5.vsds.x86_64 ro root=uuid=212c95a4-56d0-44fc-93ce-73b5f3e8cf2a 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
......
[[Email protected] ~] #reboot
[Email protected] ~]# Cat/proc/sys/kernel/panic
2
For more information, see [2].
[2]: Acceptable parameters for the Linux kernel | Passing parameters to the kernel via grub
The next section will talk to the small partners about initramfs those things, and I'm going to change the system from running to RAMDisk by simply modifying Initramfs.
Linux system boot details (i)