650) this.width=650; "src=" Http://blog.chinaunix.net/attachment/201303/23/23069658_1364022276448d.gif "alt=" 23069658_1364022276448d.gif "/>
Start the first step-load the BIOS
When you turn on the computer, the computer loads the BIOS information first, and the BIOS information is so important that the computer must find it at the very beginning. This 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, the first sector of the No. 0 track on the hard disk is called the MBR, that is, the master boot record, which is the master boot records, it is 512 bytes in size, although the place is not small, but it is stored in the pre-boot information, 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 computer, 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 this small program, we can initialize the hardware device, set up a map of the memory space, so as to bring the system's hardware and software environment to a suitable state, in order to finally call the operating system kernel ready to do everything.
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 step fourth-load the kernel
Based on the path of the kernel image set by grub, the system reads the memory image and does the decompression operation. 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 places the extracted kernel in memory and calls the Start_kernel () function to 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, the first program to run is/sbin/init, which reads the/etc/inittab file and initializes it based on the file.
In fact, the main function of the/etc/inittab file is to set the Linux operating level, which is set in the form of ": 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
About the/etc/inittab file of learning, in fact, there are many, in the post-second article designed to sell a Xiaoguanzi, please look forward to, hehe
Start the sixth step--init process Execution Rc.sysinit
After setting the operating level, the Linux system executes the first user layer file is the/etc/rc.d/rc.sysinit script, it does a lot of work, including setting path, setting the network configuration (/etc/sysconfig/network), Start swap partitions, set/proc, and so on. If you are interested, you can go to the/ETC/RC.D to see the Rc.sysinit file, inside the script enough to see you for a few days: P
Start the seventh step--Start the kernel module
The kernel modules are loaded according to the files in the/etc/modules.conf file or the/ETC/MODULES.D directory.
Start step eighth-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 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 to personalize 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 ...
This article is from the "people ugly should read more" blog, please be sure to keep this source http://mayun.blog.51cto.com/10088968/1650001
Linux boot process