Yesterday, a predecessor asked me, Liunx system is if the start, I just said a probably, but the specific process did not understand thoroughly, today deliberately found on the internet below the flowchart, and according to the diagram, carried out a detailed description, if there are problems, please point out.
650) this.width=650; "src=" http://blog.chinaunix.net/attachment/201209/23/26495963_1348382510SRUx.png "border=" 0 " height= "402" width= "474" style= "border:0px;" alt= "26495963_1348382510srux.png"/>
Start the first step --load the BIOS
When the device is power up, BIOS information is loaded first, and the BIOS information is important. The first boot is because the BIOS contains information about the CPU, device boot sequence information, hard disk information, memory information, clock information, PNP features, and so on. After that, the computer has a spectrum and knows which hardware device to read.
start the second step -read MBR
as we all know, on hard diskThe first sector of the No. 0 track is called the MBR, which is the master boot record, which is the primary boot recording, is 512 bytes in size, storing pre-boot information and partition table information.
when the system locates the MBR of the hard disk specified by the BIOS, it is copied to the physical memory where the 0X7C00 address resides. Actually the content that is copied to the physical memory is boot Loader, and specifically to your device, that is LILO or grub.
start the third step --boot Loader
Boot Loader is a small program that runs before the operating system kernel runs. Through a small program, we caninitializing the hardware device, establishing a map of the memory space, which willThe system's hardware and software environment is brought to a suitable state, so thatprepare for the final call to the OS kernel.
Boot Loader is available in several ways, including Grub, Lilo, and Spfdisk, which are common loader.
let's take grub as an example to explain, after all, there are not many people with Lilo and Spfdisk.
The system reads the GRUB configuration information in memory (typically menu.lst or grub.lst) and launches a different operating system according to this configuration information.
start the fourth step --load the kernel
The system reads the memory image and does the decompression according to the path of the kernel image set by Grub. At this point, the screen will generally output "uncompressing Linux" prompt. When the decompression core is complete, the screen output "OK, booting the kernel".
The system will decompress the kernelplaced in memory, andCall the Start_kernel () functionto start a series of initialization functions and initialize the various devices to complete the Linux core environment. At this point, the Linux kernel has been established, Linux-based programs should be able to run properly.
start the fifth step -User layer init sets the operating level according to the Inittab file
after the kernel is loaded,first oneThe program that runs is/sbin/init, the file willRead/etc/inittabfile and initialize it according to this file.
in fact, the main function of the/etc/inittab file isset the Linux operating level, which is set in the form ": Id:5:initdefault:", which indicates that Linux needs to run on level 5. Linux runs at the following levels:
0: Turn off the machine
1: Single-user mode
2: Multi-user mode with no network support
3: Multi-user mode with network support
4: Reserved, not used
5: Multi-user mode with network support with X-window support
6: Reboot the system, that is, restart
There is a lot of learning about/etc/inittab files.
start the sixth step --init Process Execution Rc.sysinit
after the operating level has been set, the Linux system performsfirst user-level fileis that/etc/rc.d/rc.sysinitscripting, it does a lot of work, including setting path, setting network configuration (/etc/sysconfig/network), starting swap partition, setting/proc, and so on. If you are interested, you can go to/ETC/RC.D to see the Rc.sysinit file, inside the script enough to see you for a few days
start the seventh step --Start the kernel module
specific is based on/etc/modules.conffile or/ETC/MODULES.Dfiles in the directory to load the kernel modules.
start Eighth step --execute scripts with different RunLevel
depending on the runlevel, the system will run the appropriate script from RC0.D to RC6.D to perform the appropriate initialization and start the appropriate service.
start the nineth step --Execute/etc/rc.d/rc.local
If you open this file, there is a word, read it, you will be the role of this command at a glance:
# This script is executed *after* all and the other init scripts.
# can put your own initialization stuff in here if you don ' t
# want to does the full Sys V style init stuff.
Rc.local is the place where Linux is left to the user for personalization after all initialization work. You can put the things you want to set up and start up here.
start Tenth step --Execute/bin/login program, enter login status
at this time, the system has entered the waiting for the user input username and password, you can already use your own account login system. :)
The long start-up process is over, everything is quiet ...
in fact, behind this, there is a more complex underlying function calls, temporarily have not learned, and later for everyone to do the record.
This article is from the "Useful Notes" blog, so be sure to keep this source http://qiuyt.blog.51cto.com/1229789/1606083
Centos-----System Boot Process detailed description