Introduction to the computer startup process and basic knowledge of BIOS

1. BIOS

BIOS introduction:

BIOS (Basic Input/Output System) is the abbreviation for Basic Input/Output System. BIOS can provide the lowest level and most direct hardware control and support for the computer, and it is the bridge connecting the lowest level hardware system and software system. In order to prevent the BIOS from being lost after shutdown, the early BIOS is stored in ROM, and its size will not exceed 64KB; and the current BIOS is mostly 1MB to 2MB, so it will be stored in the flash memory (Flash Memory).

 

The BIOS setup program is a set of programs that are solidified into the ROM chip on the computer motherboard. Its main function is to provide the computer with the lowest and most direct hardware settings and control. BIOS is usually integrated with the
hardware system (in the ROM or EEPROM of the computer motherboard), so it is also called  firmware

 

How to run

The BIOS is stored in a ROM that will not lose its contents after a power failure, which ensures that the situation of "pulling yourself up by the shoelace" will not happen. As soon as the system is powered on or reset, the address of the first instruction to be executed by the processor will be located in the BIOS memory, and the initialization will start to run. In the X86 system, the CPU jumps to the fixed physical address 0xFFFF0 of the BIOS after power on.
Turn on the power of the computer, the computer will first load the BIOS, including

CPU相关信息
设备启动顺序信息
硬盘信息
内存信息
时钟信息
PhP特性
...

Hardware self-test (Power-On Self Test, POST)

If there is a problem with the hardware, the motherboard will beep with different meanings and the startup will be aborted. If there is no problem, the screen will display CPU, memory, hard disk and other information. After the BIOS performs hardware self-check and initialization, it will copy itself to the physical memory starting from 0xA0000 and continue execution.

BIOS 代码包含诊断功能,以保证某些重要硬件组件,像是
键盘、磁盘设备、输出输入端口等等,可以正常运作且正
确地初始化。

2. Read MBR

MBR-full name is Master Boot Record (Master Boot Record or Master Boot Record), which is a 512byte sector located in a fixed position on the disk. It is called "Master Boot Record" because it exists in a special sector at the beginning of the drive. This sector contains the installed operating system boot recorder and the logical partition information of the drive. After the BIOS completes POST and initialization, it will select the boot device according to the order set in CMOS. This device can be a U disk or a hard disk. If it is set to a hard disk, the BIOS will read the MBR. The MBR contains a boot program, a partition table and Magic Number.

3. Start Boot Loader

 

​ **Linux Boot Process**

Boot Loader

Also known as the OS kernel loader, a kernelsmall program that runs before running. Through this program, hardware devices can be initialized, memory space mapping can be established, and the system software and hardware environment can be brought to an appropriate state. It is convenient to call the operating system kernel in the future.

 

4. Load the kernel

There are two main steps:

  1. According to the path of the kernel image set by grub, the system reads the memory image and decompresses it
    .

  2. The system places the decompressed kernel in the memory, initializes functions and initializes various devices, and completes
    the establishment of the Linux kernel environment.

Take the Linux system as an example, first load the kernel under the /boot directory.

After the kernel is loaded successfully, the first program to run is /sbin/init. It generates the init process according to the configuration file (/etc/initab in Debian system). This is the first process after Linux starts. The pid process is numbered 1, and other processes are its descendants.

Then, the init thread loads the various modules of the system, such as window programs and network programs, until the /bin/login program is executed, and the login interface is jumped out, waiting for the user to input username and password.

At this point, the entire startup process is complete.

 

 

 

Guess you like

Origin blog.csdn.net/wwxy1995/article/details/113830429