650) this.width=650; "title=" image "style=" border-top:0px;border-right:0px;background-image:none;border-bottom:0 px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px; "border=" 0 "alt=" image "src=" http:// S3.51cto.com/wyfs02/m01/73/e5/wkiom1yjm2qd-mkqaafnynffypk969.jpg "height=" 428 "/>
POST--Boot Sequence (BIOS)--Boot Loader (MBR)--Kernel (RAMDisk)--rootfs--Switchroot In/init---/etc/inittab,/etc/init/*.conf--Set default run level--system initialization script--Shut down or start service at the corresponding level--start terminal
POST
Power-on self-test
BOOT Sequence
In order to find the boot device, the first device with a boot program is the device for this boot
MBR boot
MBR records are generally in Disk 0 tracks 1 sectors, a total of 512 bytes. The first 446 bytes are bootloder, after 4*16 64 bytes is the storage partition information, the last 2 bytes is the checksum information, is generally 55AA
Start Bootloder
Grub: Provides a menu that allows the user to select a system to boot or a different kernel version, to load a user-selected kernel into a specific space in memory, unzip, expand, and transfer control of the system to the kernel
Load kernel
After the kernel is loaded, the operating system takes over the hardware and then initializes itself
Detect all hardware devices that can be identified
Load Hardware Drivers
Mount the root file system as read-only
The first application running user space:/sbin/init
Where Init has different types in different CentOS versions
Sysv:init, CentOS 5 configuration file:/etc/inittab
Upstart:init, CentOS 6 configuration file:/etc/inittab,/etc/init/*.conf
SYSTEMD:SYSTEMD, CentOS 7 configuration file:/usr/lib/systemd/system,/etc/systemd/system
Another/sbin/init is divided into 7 operating levels
0: Turn off the machine
1: Single user mode (root, no login required), one, maintenance mode
2: Multi-user mode, will start the network function, but will not start NFS; Maintenance mode
3: Multi-user mode, normal mode, text interface
4: Reserved level, can be same as 3 level
5: Multi-user mode, Normal mode, graphical interface
6: Restart
The INIT process first reads the file/etc/inittab configuration file
Each row defines an action and the process that corresponds to it
Id:runlevel:action:process
Action
Wait: Switch to this level to run once
Respawn: This process terminates and the restart is
Initdefault: Setting the default runlevel; process omitted
Sysinit: Sets the system initialization mode, where the specified/etc/rc.d/rc.sysinit is typically
/etc/rc.d/rc.sysinit: System Initialization script
(1) Set host name
(2) Setting welcome information
(3) Activate Udev and SELinux
(4) Mount the file system defined in the/etc/fstab file
(5) Detecting the root file system and re-mounting the root filesystem in read and write mode
(6) Setting the system clock
(7) Activate swap device
(8) Set kernel parameters according to/etc/sysctl.conf file
(9) Activating LVM and software RAID devices
(10) Loading drivers for additional devices
(11) Cleaning operation
Each run level under/etc directory has a corresponding subdirectory that specifies the program to load
/etc/rc0.d
/etc/rc1.d
/etc/rc2.d
/etc/rc3.d
/etc/rc4.d
/etc/rc5.d
/etc/rc6.d
Set up a login terminal