In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
Linux system start-up detailed explanation is what, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.
1. BIOS power-on self-test
BIOS (Basic Input Output System, basic input and output system) refers to a group of programs solidified on a ROM chip on the motherboard in the computer. It stores the most important basic input and output programs of the computer, the self-test program after boot and the system self-startup program. It can read and write the specific information of the system settings from CMOS. Its main function is to provide the lowest and most direct hardware setting and control for the computer.
When the computer is powered on (started), the first software, BIOS, is loaded. As with all operating systems, BIOS is designed to initialize the hardware. POST (Power On self Test), as the main component of BIOS, is used to check whether the basic function of computer hardware is normal. If POST fails, the computer will not be used and the boot process will be interrupted.
When the BIOS power-on self-test succeeds and confirms that the basic function of the hardware is normal, a BIOS interrupt INT 13H will be generated, which will turn to the first sector of the first hard disk, namely MBR (Master Boot Record, master boot record).
Bootstrap loader
Stage 1: when the POST is finished, BIOS loads the master boot record MBR of the jump into memory and starts executing the code. Control is transferred from the BIOS to the master boot record code.
The master boot record code must be very small because it must be placed in the first 512-byte sector of the hard disk together with the partition table. In traditional conventional MBR, the actual space occupied by the master bootstrap is 446 bytes, which is usually called boot image (boot.img), which does not contain the partition information of the device (4 × 16 bytes), and the partition is generally added to the boot record separately.
Because the boot record must be very small, it cannot be very smart and cannot understand the file system structure. So the only function of stage 1 is to locate and load the code of stage 2 (start and end disk information in the paging item to find the corresponding storage area). To accomplish this task, the code for stage 1 must be located between the boot record and the first partition of the device. After the stage 2 code is loaded into memory, control is transferred from stage 1 to stage 2.
-MBR structure composition diagram-address name function 0000-0088 master bootstrapper master bootstrap 0089-01BD error information data area data area 01BE-01CD partition item 1 (16 bytes) partition table 01CE-01DD partition item 2 (16 bytes)
01BE-01CD partition entry 3 (16 bytes)
01DE-01ED partition entry 4 (16 bytes)
01FE55 end flag 01FFAA
-content and meaning of paging entry (16 bytes)-Storage byte content meaning 1st byte boot flag:
80H-active partition
00H-inactive partition 2, 3, 4 byte starting number, sector number, column number of this partition:
Magnetic number-second byte
Sector number-the lower 6 bits of the third byte
Column number-3rd byte high 2 bits + 4th byte 8 bits 5th byte partition type character:
00H-indicates that the partition is not used (that is, not specified)
06H-FAT16 basic Partition
0BH-FAT32 basic Partition
05H-extended Partition
07H-NTFS partition
0FH-(LBA mode) extended partition
The ending head number, sector number and column number of the 6th, 7th, 8th byte of the 83H-Linux partition:
Magnetic head number-6th byte
Sector number-the lower 6 bits of the 7th byte
Column number-high 2 bits of 7 bytes + 8 bytes 9, 10, 11, 12 bytes of this partition before the total number of sectors used 13, 14, 15, 16 bytes of this partition
Stage 2: since the first sector leaves 62 512-byte sectors (31744 bytes in total), this area is used to store stage 2 code mirrored core.img files. The file size is 25389 bytes, so there is enough space in the area to store core.img files.
Because there is more storage space for stage 2, and enough space to accommodate some general file system drivers, such as standard EXT and other Linux file systems, such as FAT and NTFS, and so on. GRUB2's core.img is far more complex and powerful than the older GRUB1 in stage 2. This means that GRUB2's stage 3 can be placed in a standard EXT file system, but not in a logical volume. Therefore, stage 3 files can be stored in the / boot file system, usually in the / boot/grub2 directory.
Note: the / boot directory must be placed on a file system supported by GRUB (not all file systems are available). The function of stage 2 is to start executing the driver of the / boot file system where the stage 3 files are stored, and load the relevant drivers.
All stage 3:GRUB stage 3 files are stored in the / boot/grub2 directory and its subdirectories. There is no mirror file similar to stage 1 and stage 2 at this stage. Accordingly, this phase mainly requires loading some kernel runtime modules from the / boot/grub2/i386-pc directory.
The main function of GRUB stage 3 is to locate and load the Linux kernel into memory and transfer control to the kernel. Kernel-related files are located in the / boot directory, and these kernel files can be identified by their filenames, all with the prefix vmlinuz (kernel files). You can list the contents of the / boot directory to see which kernels are currently installed in the operating system.
GRUB2, like GRUB1, supports booting from one of the Linux kernels of choice. The Red Hat package Manager (DNF) supports the retention of multiple kernel versions in case the latest version of the kernel fails to start, and the older version of the kernel can be restored. By default, GRUB provides a preboot menu for the installed kernel, including the problem diagnosis menu (recuse) and the recovery menu (if the configuration has already set the recovery image).
Initialize the kernel
Kernel files are stored in a self-extracting compressed format to save space, along with an initialized memory image and storage device mapping table stored in the / boot directory.
After the selected kernel is loaded into memory and starts execution, the kernel file must first extract itself from the compressed format before it can do any work. Once the kernel self-extracting is complete, load the systemd process (which is a replacement for the init program for older System V systems) and transfer control to systemd.
This is the end of the boot process. At the moment, the Linux kernel and systemd are running, but because there are no other programs executing, they cannot perform any functional tasks related to the user.
4. Start systemd
Systemd is the parent of all processes. It is responsible for bringing the Linux host to a user-operable state (which can perform functional tasks). Some of the functions of systemd are much richer than the old init programs, and it can manage many aspects of the running Linux host, including mounting the file system and opening and managing the system services of the Linux host.
Systemd mounts the file system configured in / etc/fstab, including memory swap files or partitions. Accordingly, systemd must be able to access the configuration files located in the / etc directory, including its own. With the help of its configuration file / etc/systemd/system/default.target, systemd decides which state (or target state target) the Linux system should boot up to.
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.