Linux boot process

Source: Internet
Author: User

Linux boot process brief

     start first step --load the Span style= "Word-wrap:normal" >bios

When you turn on the computer power , the computer will first load bios information, bios information is so important, So that the computer must find it at the very beginning. This is because bios contains information about cpu , device boot sequence information, Hard disk information, memory information, clock information, pnp features, and more. After that, the computer has a spectrum and knows which hardware device to read.

start Step two -read mbr

It is well known that the first 0 the first sector of the track is called mbr , which is master boot Record , which is the master boot recording, its size is 512 Byte, although the place is not big, But it contains pre-boot information, partition table information.

system found mbr of the hard disk specified by the "Word-wrap:normal" >bios , it will be copied to 0X7C00 the address of the physical memory in which it 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 step three --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 There are several kinds, where grub , lilo and spfdisk The is a 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

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, theLinux 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 /etc/inittab file and perform initialization work based on this file.

in fact /etc/inittab file is to set the operation level of linux . It is set in the form : id:5:initdefault:" , which indicates The span style= "Word-wrap:normal" >linux needs to be run on the level 5 . linux is set as follows:

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 Sixth step --init Process Execution

After setting the run level, linux the first user layer file executed by the system is /etc/rc.d/rc.sysinit script program, it does a lot of work, including setting path , set the network configuration (/etc/sysconfig/network ), start swap partition, set /proc , and so on. If you are interested, you can go to /etc/rc.d for a look at 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 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 the other init scripts.
# can put your own initialization stuff in here if you don ' t
# want to do the full Sys V style init Stuff.

rc.local is the place whereLinux 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. :)

Linux boot process

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.