CentOS 6 system startup Guide

Source: Internet
Author: User

CentOS 6 system startup Guide

POST --> BootSequence (BIOS) --> BootLoader --> Kernel (ramdisk) --> rootfs -->/sbin/init

Step 1. Load BIOS

BIOS is responsible for initializing hardware, checking hardware functions, and guiding the operating system. In the early stage, BIOS also provided a set of runtime service programs for the operating system and applications. The BIOS program is stored in a read-only memory that will not be lost after power-off. When the system is powered off or reset (reset), the address of the first instruction of the processor is located in the BIOS memory, let the initialization program start running.

Stage 1

Power On Self Test ):

After the power is pressed, the First Command of the CPU points to the BIOS chip (ROM read-only memory; Generally, it is read-only, and the BIOS program can be upgraded. There are two BISO chips on the mid-end high-end server, prevent the BIOS program from being rolled back after the BIOS upgrade fails. the BIOS program is loaded into the memory for running. The BIOS (abbreviation of Basic Input/Output System, Chinese: Basic Input/Output System) after the program runs, it identifies and detects various hardware.

If some hardware problems are detected:

1. The related hardware indicator will change color (red or orange)

2. shield problematic hardware and proceed to the next step; if the critical point is reached, the next step will not be available; (for example, some industrial standard servers have multi-processor, multiple memory disks... set the slot where the faulty hardware is located to disabled)

Stage 2: Boot Sequence

After the bios program self-check is completed, the BIOS settings (time, password, startup Item, etc.) in the CMOS chip (random Memory RAM) will be loaded );

Boot Sequence (BIOS) sets the Boot Sequence for the user to start the computer, such as the disc drive, hard disk, floppy disk, and USB flash disk. The Boot Sequence is set according to the Boot Sequence, traverse the device's 0th cylinder 0th track 1st sectors (also called MBR). If the sector 0xAA559 is found to end, the BIOS considers it as a bootable sector and enters the third stage; otherwise, find the next device set in the next startup Item until it is found. If no BIOS exists, the system will be prompted.

Stage 3: Boot Loader)

When the BIOS determines which boot device to start, it will load the 0th-byte content program from the 0th-cylinder 1st track 512 sectors to the memory address 00000: 7c00, and then jump to 00000: at 7c00, the control is handed over to this Code. At this point, the computer is no longer controlled by the programs inherent in the BIOS, but this small program (446) is used to control the computer for the next step (refer: implementation of an operating system: Yu Yuan)

MBR:

Located in the hard disk's 0-core, 0-head, 1st-sector name as the Main Boot Sector (also known as the Master Boot Record MBR), the size is 512 bytes

Part 1 boot loader occupies 446 bytes

The second partition table information occupies 64 bytes (a partition occupies 16 bytes, so it can only be divided into 4 primary partitions)

The third part is that magic numb occupies two bytes to verify MBR information.

The program in Boot Loader does not belong to any operating system. It is only for the computer to Boot the Operating System (kernel). Therefore, it doesn't matter which operating system is used as long as this program can Boot the corresponding operating system. Boot Loader finds the kernel and loads it into the memory. The computer is no longer in charge of the Boot Loader,

Common linux Boot Loader:

1. LILO

2. GRUB

GRUB has powerful functions. Many linux systems use GRUB as the boot loader. It can guide both the linux kernel and windows

The content of grub is as follows:

123456789101112131415161718[root@www~]#cat/boot/grub/grub.conf#grub.confgeneratedbyanaconda##Notethatyoudonothavetorerungrubaftermakingchangestothisfile#NOTICE:Youhavea/bootpartition.Thismeansthat#allkernelandinitrdpathsarerelativeto/boot/,eg.#root(hd0,0)#kernel/vmlinuz-versionroroot=/dev/mapper/VolGroup-lv_root#initrd/initrd-[generic-]version.img#boot=/dev/sdadefault=0# The first kernel started by defaulttimeout=5# Timeoutsplashimage=(hd0,0)/grub/splash.xpm.gz# Background imagehiddenmenutitleCentOS6(2.6.32-573.el6.x86_64)# Titleroot(hd0,0)kernel/vmlinuz-2.6.32-573.el6.x86_64roroot=/dev/mapper/VolGroup-lv_rootrd_NO_LUKSLANG=en_US.UTF-8rd_NO_MDrd_LVM_LV=VolGroup/lv_swapSYSFONT=latarcyrheb-sun16crashkernel=autord_LVM_LV=VolGroup/lv_rootKEYBOARDTYPE=pcKEYTABLE=usrd_NO_DMrhgbquiet# Specify the directory where the kernel is located to mount the root file in read-only mode setting language for us UTF-8 swap partition...initrd/initramfs-2.6.32-573.el6.x86_64.img

Please view (http://blog.chinaunix.net/uid-24774106-id-3497929.html)

Stage 4: Kernel

After the Kernel is loaded into the memory, it will decompress it and run it to mount the file system in read-only mode to detect and control various hardware. Which of the following is the role of the initrd/initramfs-2.6.32-573.el6.x86_64.img parameter that kernel receives from grub startup? After the kernel starts running, it needs to access the root file system. To access the root file system, it must load the device where the root file system is located, and the root file system is not mounted, to mount the root file system, you must first use the driver of the root file system. This is a typical problem! To solve this problem, GRUB also loads initrd into the memory and runs the kernel, So what role does initr play, in fact, the initrd file is actually a virtual root file system, which contains root directories such as bin, lib, lib64, sys, var, etc, sysroot, dev, proc, and tmp, its function is to establish a connection between the kernel and the real root. The kernel loads the driver of the root file system through it, and then mounts the content defined in/etc/fstab in read/write mode. So far, the kernel has been loaded.

123456789101112[root@wwwtmp]#pwd/tmp[root@wwwtmp]#ls[root@wwwtmp]# Cp/boot/initramfs-2.6.32-573.el6.x86_64.img./# copy to the current directory[root@wwwtmp]# Zcatinitramfs-2.6.32-573.el6.x86_64.img | cpio-id # Extract145377blocks[root@wwwtmp]#lsbinemergencyinitqueue-finishedlibpre-mountproctmpcmdlineetcinitqueue-settledlib64pre-pivotsbinusrdevinitinitqueue-timeoutmountpre-triggersysvardracut-004-388.el6initqueueinitramfs-2.6.32-573.el6.x86_64.imgnetrootpre-udevsysroot[root@wwwtmp]#

Stage 5: Run/sbin/init

After the system kernel is started, the first user process to be started is/sbin/init. The system master permission is assigned to/sbin/init for system initialization!

The programs run in the user space include/sbin/init -->/etc/inittab (set the default level) -->/etc/rc. d/rc. sysinit->/etc/rc3.d/S * (or/etc/rc5.d/S *) -->/etc/rc. sysinit --> set the default running level --> system initialization script --> close or start the service at the corresponding level --> Start the terminal

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.