Linux boot process analysis

Source: Internet
Author: User
Article Title: Linux boot process analysis. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Have you paid attention to the Linux boot process after installing Linux? This article attempts to describe this process and related situations in a popular language. After understanding the Linux boot process, you can be aware of the various problems that occur during the Linux boot process.
  
An attractive feature of Linux is that users can customize the entire system by themselves. However, you can run a "mini" Linux with only 1 MB of space or a powerful Linux with several GB of space. Regardless of the Linux operating system, you start from the boot program. Most common users run Linux on their PCs. PC, also known as PC, is a common computer that uses Intel or AMD chips. When we connect the power of the PC, the CPU will execute the first command. The first command usually enables the CPU to jump to the BIOS entry address, and then the BIOS starts to perform self-check upon startup, this includes checking the memory and other hardware. If other devices have their own BIOS (such as SCSI or RAID settings), they will also be executed. After the self-check is completed, the BIOS starts the real operating system based on the set boot device and boot sequence, such as Linux (this article uses Linux as an example ).
  
For PCs, the following types of devices can be used as startup devices:
  
1) Hard Disk
This is the most common boot device. The hard disk has two types of interfaces: IDE interface and SCSI interface. Because the IDE hard disk is much cheaper than the SCSI hard disk, most PCs use IDE hard disks. A pc may have multiple hard disks. You can set which hard disks to start first in the PC's CMOS.
  
2) floppy disk
A floppy disk is one of the essential devices for a PC. It is often used for system installation or as an emergency system disk. There are also many Linux systems on a floppy disk.
  
3) optical drive
The disc drive is also one of the essential devices for PCs, including CDROM, DVDROM, and various recorders. Currently, most users install Linux through the optical drive.
  
4) USB disk
With the emergence of USB disks, many motherboard also began to support starting the system from a USB device. USB disk capacity is much larger than that of floppy disk. At present, there is a tendency to replace floppy disk.
  
5) Boot ROM of the NIC
Some NICs have Boot ROM chips that can write Boot information into Boot ROM. Many motherboards support Boot from Boot ROM. It is often used in diskless work disk environments.
  
No matter which boot device the system selects, it will read the content of the device's start address into the memory. If your boot device is an IDE hard disk, the system will read the first sector of the hard disk (this sector is usually called the Main Boot Sector, also known as MBR), read the content of this sector into the memory, and then run it. At this step, it is critical to guide the Linux operating system. This step will try to start the Linux boot program. If the boot program cannot be found, it will not be able to guide Linux. When many people cannot start Linux, most of them are caused by corruption or improper configuration of the boot program.
  
So what is a Bootstrap program? In fact, when you open your computer every day, the first program you are exposed to is the boot program. It is responsible for loading the operating system kernel software and transferring control to it. For Linux, the boot program is responsible for importing Linux Kernel when the computer is started, giving control of the computer to the Kernel, and then the Kernel further initializes the remaining operating system, the user logon screen is displayed in Linux. It can be seen that the boot program is very important for an operating system. Linux boot programs include lilo and grub.
  
1) lilo
Lilo is a flexible and versatile boot program for Linux. It does not depend on a specific file system. It can boot the Linux kernel image from a floppy disk or hard disk. Of course, it can also boot other operating systems. Before grub appeared, lilo was the best choice for Linux boot programs. At present, many people are still using it.
  
2) grub
Grub is a powerful boot program than lilo. It is dedicated to handling the coexistence of Linux and other operating systems. It can boot Linux, OS/2, Windows series, BeOS, Solaris, FreeBSD, NetBSD, and so on. It supports large hard disks, boot screens (up to X images), menu options, and does not need to be reconfigured after the partition location is changed, making it easy to use. Most of the new Linux versions use grub as the default boot program.
  
3) Other boot programs
If you haven't installed lilo or grub, or your lilo or grub is corrupted (for example, you accidentally overwrite MBR), you won't be able to directly boot Linux. Fortunately, at this time, you can also use other methods to boot, such as Linux boot disks, or use programs such as loadin and syslinux to load Linux from ms-dos.
  
  
If the boot program succeeds, the Linux kernel takes over the system and starts the Linux Startup Process (this article introduces the Linux Startup Process ). But what if an error occurs during the boot process?
  
1. Analyze the error information displayed on the screen
  
The error messages displayed by the Bootstrap program are meaningful and need to be carefully read. For example:
  
Lilo error message
  
When lilo is started, the "lilo" string is displayed on the screen. In fact, each letter corresponds to a specific operation. If lilo has an error in a part, we can infer the cause of the fault based on the current letter on the screen. For example, if nothing appears on the screen, it may indicate that lilo has not been installed or the partition where lilo is located is not set to active. The screen displays "li", which indicates that the first part of the lilo boot loader can load the second part of the lilo boot loader, but cannot be executed. This may be because the hard disk parameters are improperly set or because the map installer is not running during mobile/boot. B. The screen displays "lil", which may be due to a media fault or an improper hard disk parameter setting. The Descriptor Table cannot be loaded from the map file ......, detailed error information can also be found on the relevant website.
  
Grub error message:
  
It is better to understand grub information than lilo because it is expressed directly in English rather than using symbols. For example: "Hard Disk Error" and "Read
Error "," Selected disk doesn't exist "," Disk geometry error "," Device
String unrecognizable "," Attempt to access block outside
Partition "," Partition table invalid or partition upt ", etc. Detailed error information can also be found on the relevant website.
  
2. boot to the system through a CD or floppy disk to repair the original boot program
  
After analyzing the error information displayed on the screen, you can find out the cause of the error of the original boot program. At this time, you can boot the system through a CD or a floppy disk. Many Linux release discs can be started. For example, slackware is a good boot disc. After entering the system, you can reinstall or reset the boot program.
  
Related Article

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.