① Press the Power key, the computer hardware will read the BIOS to load hardware information (such as: CPU and Interface Device communication frequency, disk size and type, system time, peripheral bus, disk I/O, etc.) and the BIOS self-detection,
② the first bootable device based on BIOS setup, reads and executes the first boot device MBR master boot record (MBR a total of 512 bytes, including 446 bytes of boot loader,64 byte partition table, 2 byte 55AA check digit) within the boot Loader (commonly used such as: Grub. Grub Boot process: Divided into two stages, by Stage1 and stage2 two files to control, Stage1 exists with the MBR, the file is smaller than 446 bytes, the main role is to boot the main program Stage2;stage2 mainly load all the configuration files, including grub.conf, etc. there is a problem here: the kernel-related files are in the/boot directory, the/boot directory is the first partition of the first disk (SDA1, which can be viewed by df-h), but how does grub recognize the first partition of the first disk? In fact GRUB has its own grub device number specific to the disk (hd0,0): Represents the first partition of the first disk )
③ depending on the configuration in the grub.conf file, the boot loader specifies which kernel file to use to start the Loading kernel files (such as: vmlinuz-2.6.32-431.el6.i686) into memory to extract and execute, after loading the kernel, the kernel detects all hardware information (such as: disk, CPU, NIC, sound card, etc.) and loads the hardware driver (the operating system is running on the PC) (Note: There is a problem loading the hardware driver, all the hardware drivers are in the/lib/modules/directory, at this time does not mount the root directory, so unable to read the contents of the/lib/modules/directory, can not load the hardware driver, how to do? The virtual file System file (initramfs-2.6.32-431.el6.i686.img) is used, the bootloader loads it into memory and extracts it, extracts it into a simulation root directory, and provides an executable program that the kernel uses to load the most needed modules (drivers), and then Release the virtual file system, mount the real root directory )
④ after the hardware driver is loaded, the kernel invokes the first process init process (then the INIT process is working)
The ⑤init process reads/etc/inittab This file to get the system's boot level (7 levels: 0 off, 1 single user, 2, 3 character interface, 4,5 GUI, 6 restart)
⑥ executes/etc/rc.d/rc.sysinit This script to initialize the system environment (such as: Host type, network environment, SELinux, system time, etc.)
⑦ read the/etc/fstab file and mount it accordingly
⑧ Start Network (note: service can start after network boot )
⑨ Start the system service, assuming that the system start level is 3 (character interface), from/ETC/RC.D/RC 3 to get all the scripts in the/etc/rc3.d/directory, start with K stop off, Start with S start up (note: This directory of files are kxx or sxx beginning of the file, XX represents a number, the meaning of this number is only representative of the order that the file is executed, the larger the number is executed later, such as the/etc/rc.d/rc.local corresponding file for S99local, indicating that the file is the 99th executed and start up, which is the last file executed)
⑩ finally executes the/etc/rc.d/rc.local file (we can write some of the service's boot-up commands to this file.) Note: We can write the absolute path of a script file (just the file name of the absolute path) to this file, which is executed when the/etc/rc.d/rc.local file is read, such as adding a line to the/etc/rc.d/rc.local file/usr/ Local/bin/bash.sh, then the bash.sh script will be executed )
Additional:
The role of bootloader:
① provides a menu: the user can choose a different kernel to launch
② Loading the kernel
③ Transfer the boot loader function to the other bootloader
Installation of dual systems: You must install Windows before installing Linux, because:
Windows Bootloader does not have the ability to transfer the boot loader functionality to other bootloader , and Linux has this feature, so after installing Windows and then installing Linux, Will first read the bootloader,linux of Linux bootloader will launch the load function to the bootloader of Windows, and then perform the next steps
Grub Device Number:
(hd0,0): Must have parentheses; start with HD; represents the first partition of the first disk, corresponding to the SDA1
This article is from the "See" blog, please be sure to keep this source http://732233048.blog.51cto.com/9323668/1618943
Linux Start-up process