Linux boot (bootstrap)

Source: Internet
Author: User

Author: vamei Source: http://www.cnblogs.com/vamei welcome reprint, please also keep this statement. Thank you!

 

Computer boot is a mysterious process. We only press the open key to view the progress bar on the screen or the output of a row until we reach the logon interface. However, starting a computer is an abnormal and fragile process. We don't expect a logon interface, but a command line or error message. Understanding the computer boot process helps us fix possible problems during boot.

 

1) initial stage:

When we power on the computer, the computer will automaticallyBios(Basic Input/Output System) readProgram. This program usually knows some hardware that is directly connected to the motherboard (hard disk, network interface, keyboard, serial port, and parallel port ). Most BIOS allows you to select one from a floppy disk, CD, or hard disk to start the computer.

Next, the computer will readThe starting 512 bytes(For example, if the CD is 512 bytes, if we start it from the CD). These 512 bytes are called the Master Boot Record (MBR ). MBR will tell the computer from this deviceA partition(Partition) to loadBoot Loader). Boot Loader stores information about the operating system (OS), such as the operating system name and the operating system kernel location. Common boot loaders include grub and Lilo.

Then, boot loader will help usLoad Kernel. Kernel is actually a program used to operate computers. It is the kernel of computer operating systems. Its main task is to manage computer hardware resources and act as interfaces between software and hardware. Any operation on the operating system must be transmitted to the hardware through the kernel. Windows and Linux have their own kernel.Narrow Operating SystemIt refers to the kernel,Operating System in a broad senseIncluding various applications on the kernel and the kernel.

(Linus Torvalds is not so much the father of Linux as the father of Linux kernel. He is still responsible for the development and maintenance of Linux kernel. For Ubuntu and red hat, they are all based on the same kernel and include a more complete operating system version composed of different applications and interfaces .)

In fact, we can install boot loader in multiple partitions. Each Boot Loader corresponds to a different operating system. When reading MBR, select the boot loader we want to start. This is the principle of multiple operating systems.

Summary: BIOS> MBR> Boot Loader> kernel

 

2) Kernel

If we load Linux kernel, Linux kernel starts to work. Kernel reserves the requiredMemory spaceAnd then use the driver)Computer Hardware Detection. In this way, the operating system can know which hardware is available. Then, the kernel startsInitProcess. It is a process no. 1 in Linux (there is no process no. 0 in Linux ). At this point, the kernel completes the work in the computer startup phase and handed over to init for management.

 

Summary: Kernel-> INIT process

 

3) INIT process

(According to the boot loader option, Linux can enter single user mode ). In this mode, the initial script has not started execution. We can detect and fix possible computer errors)

Later, init will run a seriesInitial script(Startup scripts). These scripts are common shell scripts in Linux. These scripts perform the following functions:

Set the computer name, time zone, check the file system, mount the hard disk, clear temporary files, set the network ......

When these initial scripts, the operating system hasFully preparedNo one can log on !!! Init will provideLogin(LOGIN)Dialog box, or a graphical logon interface.

 

Enter the user name (such as vamei) and password, done!

In the subsequent process, you will operate your computer as a user vamei. In addition, according to the settings you set when creating a user, Linux will also include you to a group, such as stupid group or vamei group.

Therefore, you will be a user vamei and a member of the vamei group. (Note: The group vamei and user vamei are just named again, so you can call it Dell, just like the boss of Dell. You can also be a user vamei and a stupid group member)

 

Summary:

BiOS> MBR> Boot Loader> kernel> INIT process> Login

User, group.

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.