Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

A brief introduction to the boot process of Linux

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Computer booting is a mysterious process. We simply press the power button and see progress bars or line-by-line output on the screen until we get to the login screen. However, booting a computer is an incredibly fragile process, and the login interface we're hoping for may not appear, but rather a command line or error message. Understanding the computer boot process helps us fix problems that may occur during boot.

initial phase

When we turn on the computer power, the computer will automatically read the programs stored in it from the BIOS(Basic Input/Output System) of the motherboard. This program usually knows some hardware directly connected to the motherboard (hard disk, network interface, keyboard, serial port, parallel port). Most BIOS now allows you to boot your computer from a floppy disk, CD, or hard drive.

Next, the computer will read the initial 512 bytes from the storage device of your choice (e.g. 512 bytes when the CD is opened, if we boot from the CD). This 512 bytes is called the MBR (master boot record). MBR tells the computer to load the boot loader from a partition of the device. Boot loader stores information related to the operating system (OS), such as the name of the operating system, the location of the operating system kernel (kernel), etc. Common boot loaders are GRUB and LILO.

The boot loader then helps us load the kernel. A kernel is actually a program used to operate a computer. It is the kernel of a computer operating system. Its main task is to manage the hardware resources of the computer and act as an interface between software and hardware. Any operation on the operating system must be communicated to the hardware through the kernel. Windows and Linux each have their own kernel. Operating system in a narrow sense refers to kernel, while operating system in a broad sense includes kernel and various applications on kernel.

(Linus Torvalds is not so much the father of Linux as the father of the Linux kernel.) He is still responsible for the development and maintenance of the Linux kernel. As for Ubuntu, Red Hat, they are both based on the same kernel, and include different applications and interfaces to form a more complete operating system version.)

In fact, we can install boot loaders in multiple partitions, each boot loader corresponding to a different operating system, and select the boot loader we want to start when reading the MBR. This is how multiple operating systems work.

Summary: BIOS -> MBR -> Boot Loader-> Kernel

kernel

If we load the Linux kernel, the Linux kernel starts working. The kernel first reserves the memory space it needs to run, and then detects the computer hardware through drivers. This way, the operating system knows what hardware it has available. The kernel then starts an init process. It is process number 1 in Linux (Linux does not have process number 0). At this point, the kernel completes its work during the startup phase of the computer and hands it over to init for management.

Summary: Kernel-> init process

https://article.pchome.net/content-2105360.html

init process

(Depending on the boot loader option, Linux can now enter single user mode.) In this mode, the initial script has not yet begun to execute, we can detect and fix possible errors in the computer)

Init then runs a series of startup scripts, which are shell scripts common in Linux. These scripts perform the following functions:

Set computer name, time zone, detect file system, mount hard disk, empty temporary files, set network…

By the time these initial scripts are ready, the operating system is completely ready, it's just that no one can log in yet. init will give you a login dialog box or a graphical login interface.

Enter a username (say vamei) and password, DONE!

For the rest of the process, you will operate the computer as user vamei. In addition, depending on the settings you set when you create users, Linux will also put you into a group, such as the Stupid group or the Vamei group.

So you will be user vamei and a member of the vamei group. (Note that group vamei and user vamei are just duplicate names, just like you can call Dell and be the boss of Dell.) You can also be user vamei and a member of Stupid group)

summary

BIOS -> MBR -> Boot loader-> Kernel-> init process -> login

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report