Linux startup process

Source: Internet
Author: User

650) this.width=650; "src=" "border=" 0 " height= "402" width= "474" style= "border:0px;" alt= "26495963_1348382510srux.png"/>

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, on hard diskThe first sector of the No. 0 track 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 big, 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. With this little 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 brief flow is as follows:

POST-To-BIOS (Boot Sequence)--MBR (bootloader)--Kernel (CENTOS5:INITRD, Centos6:initramfs)--/sbin/ini T (Centos5:/etc/inittab, Centos6:/etc/inittab,/etc/init/*.conf)-->/etc/rc.d/sysinit/--> shut down and enable service at the corresponding level-- Start the terminal


CentOS 6 and CentOS 5 are different places

Init program Type:

The CENTOS5 init program is: SYSV, its configuration file:/etc/inittab

The CENTOS6 init program is: Upstart, its configuration file:/etc/inittab,/etc/init/*.conf

Note: The/etc/init/*.confi file syntax follows the upstart configuration file Syntax format

RAMDisk: One of the attributes in the kernel: using cache and cache to access file on disk

CENTOS5 initrd, tool program: MKINITRD

CENTOS6 Initramfs, tool program: Mkinitrd,dracut

Linux startup process

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