Overview
The Startup Process of the operating system has been vague. Think about how to check the hardware, load the operating system, and load
User Environment and other processes, but they are actually complicated. After all, we only understand and master the startup process, instead
The startup process is designed and encoded, so the introduction below is relatively simple, and it is just a few minutes away. If you want to learn more
Xi's colleagues can perform Code debugging on some or some part of the problem.
The following uses Debian Linux as an example to describe how to start the operating system.
The process is as follows:
POST ----> run bios ----> load system partition table data (MBR enabled)
Starting from 512 bytes) ----> loading the boot program (such as grub) ----> loading the Linux kernel -----> initializing the system environment -----
-------> User Environment Initialization
POST)
This part has nothing to do. After the computer is connected to the power source, the user presses the start button and the computer detects the CPU,
Whether the memory, hard disk, and other hardware devices are in the available status. If you can use it, continue to the next step, that is, the right to run
Send it to the BIOS; otherwise, use the peak hour for alarm. This is also the computer repair expert based on the buzzer alarm sound judgment system there is
The basis of the problem.
Execute basic input/output (BIOS)
BIOS (Basic Input Output System) Basic Input Output program. This program completes the most basic hardware location
Process and set hard interruptions. Then, the initial MBR program is transferred to the CPU for running, and the operation right is handed over to the MBR.
MBR Loading
MBR (Master boot record) is the first 512 bytes to start the disk. It contains the partition information and
Boot Program. The partition information records the partition information of the disk. The Boot Program is a familiar Grub, LiLo, etc,
Used to guide the kernel program from where it is loaded.
Bootstrap load Grub (GRand uniied Bootloader)
During configuration, Grub specifies the partition where the kernel is loaded. grub versions earlier than Grub2 are
If there are two or more loading processes, the stage1, stage1_5, and stage2 files will be loaded.
/Boot/grub directory. These files are generated because they can only load 512 bytes at a time, too
Multiple files can only be loaded in batches.
Now the file cannot be found in Grub2, and the loading and guiding process will be introduced separately.
Kernel Loading Process
Since the specific location of the kernel is recorded in Grub, after Grub is run, it starts to load the kernel.
To the kernel.
The kernel receives the running permission and starts to test the hardware of the system and load the drivers corresponding to the hardware (some drivers run in modules,
Is to mount the file system to load), then mount the file system, read data from the file system.
The process is as follows:
Kernel probe hardware ------> load the driver (initrd) ------> mount the root file system ------> rootfs (/sbin/init)
System initialization
Finally, the permission is assigned to the/sbin/init program to start running the initialization script content. (To be continued)