Linux server boot process

Linux server boot process sequence:

Power -> the BIOS -> Master Boot Record (MBR) -> grub boot -> load the kernel -> the init process -> read / etc / inittab (run level) -> / etc / init. d -> user Login -> Login shell

1, boot BIOS self-test, check the cpu, hard drives and other hardware information.

  After the computer is first powered by the BIOS self-checking, that is POST (Power On Self Test), and then read from the hard disk, floppy disk or CDROM boot sequence in accordance with the BIOS setup "Boot Block." 0xFFFF0 boot Linux from an address at the start of the BIOS. The first step is the BIOS Power On Self Test (POST). POST job is to detect the hardware. The second step is the BIOS enumeration and initializes the local device. After the BIOS functions to set different usage, BIOS, it consists of two parts: POST code and runtime services. When POST is completed, it is cleared from memory, but the BIOS runtime services still remain in memory, the target operating system can use these services.
  To boot an operating system, it will be provided in order to search for the definition of a CMOS active runtime BIOS boot device and may. Boot device can be a floppy disk, CD-ROM, a partition on a hard disk, a device on the network, or even a USB flash memory. Typically, Linux is booted from the hard disk, wherein the master boot record (MBR) contains a primary boot loader. MBR is a 512-byte sectors, the first sector is located on the disk (sector 0 0 1 cylinder). When MBR is loaded into RAM, BIOS passes control to the MBR.

2, reads the master boot record (MBR), for guiding MBR

Is well known, a hard disk's first sector of the first track 0 is referred to as the MBR, i.e. Master Boot Record, the master boot record, its size is 512 bytes, storing the pre-boot information, partition table information. After the system finds the hard disk MBR BIOS specified, it will copy it to the physical memory 0x7c00 address is located. In fact, is copied to the contents of the physical memory is "boot loader (Boot Loader)", and specific to the server that lilo or grub up.

3, grub guide, determine load an operating system.

Boot loader (Boot Loader) is a small program that runs before the operating system kernel to run. Through this small program, you can initialize the hardware devices, the establishment of memory space map, so the system hardware and software environment to bring an appropriate state, in order to make everything ready for the final call to the operating system kernel. Boot Loader There are several species, including Grub, Lilo and spfdisk are common Loader. We Grub an example to explain it, after all, lilo and spfdisk not many people. Grub system reads memory configuration information (or generally menu.lst grub.lst), and in accordance with the configuration information to start a different operating system.

4, load the kernel

The kernel image grub set the path, the system reads the memory image, and decompression operation. The system will be decompressed kernel is placed in memory, and call start_kernel () function to start a series of initialization function and initialization of various devices to complete the establishment of the Linux kernel environment. So far, Linux kernel has been established, Linux-based program should be a normal operation.

 5, the init process runs

  The init process is the starting point of all processes of the system, the kernel boot after the completion of the nucleus, init program that is loaded in this thread (process) space, its process number is 1. The init process is the initiator of all processes and controllers. Because in any Unix-based systems (such as Linux), the process which is the first running, so the number (Process ID, PID) init process is always 1. Init If there is a problem, the rest of the system along with it collapsed.
  init process serves two purposes. The first role is to play the role of the end of the parent process. Because the init process is never terminated, so the system can always be sure of its existence, and to use it as a reference when necessary. If a process is terminated before the end of it all derived from the child process, the situation must be init will appear as a reference. At this point those who have lost a child process to the parent process will be to init as their parent process. Rapid implementation of what ps -af command can list many parent process ID (Parent Process ID, PPID) for the process to 1.
  Run the appropriate program init when the second role is to enter a specific run-level (Runlevel), in order to run on a variety of levels of management. Its role is defined by the / etc / inittab file.

6, initialized by the / etc / inittab file

Init work was performed according to / etc / inittab appropriate script for system initialization, such as a keyboard is provided, the font, the loader module, network settings, and the like.

 

Guess you like

Origin www.cnblogs.com/liuzgg/p/11690608.html