CentOS system Boot Process 1-10 detailed description

Source: Internet
Author: User

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.



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, 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 main boot records, it is 512 bytes in size, it holds 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 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 the applet, we can initialize the hardware device, set up the mapping of the memory space, so as to bring the system's hardware and software environment to a suitable state, so as to prepare for the final call of the operating system 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 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,first oneThe program that runs is/sbin/init, which reads the/etc/inittab file and initializes it based on this 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
There is a lot of learning about/etc/inittab files.

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/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
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. :)

CentOS system Boot Process 1-10 detailed description

Related Article

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.