Shallow solution to Linux startup process

Source: Internet
Author: User
Tags terminates


    • Load BIOS (Basic Input and Output System)

The system must complete the bootstrap at the start of the machine, and there is a cured instruction in the hardware to accomplish this. It can automatically load the contents of a piece of hardware into memory at boot, the BIOS program is mapped into the linear address space or physical address space that the CPU can find, and the first paragraph of the instruction information in the memory ROM mainly completes the system hardware health check, such as whether there is a video card, the video card is normal, there is no memory device, Whether the CPU fan is working or not. If checked, the Bois runtime follows the CMOS (the chip that holds the basic boot information of the computer is a parallel or serial flash chip that can read and write on the BIOS, The order in which to save the computer's hardware configuration and user settings for the dictation parameters to search for devices that are active and bootable: either a floppy disk, a partition on the hard disk, a device on the network, or even a USB flash. Typically, Linux boots from the hard disk, where the master boot record MBR (master boot Records) contains the master boot loader. The MBR is a 512-byte sector in the first sector on the disk (0 0 Cylinder 1 sectors), and when the MBR is loaded into RAM, the BIOS gives control over to the MBR.


    • Read MBR

The Master boot record holds the system pre-boot information, partition table information. After the system has found the MBR of the hard disk specified by the BIOS, it is copied to physical memory, boot Loader. (Boot loader divided into grub,lilo,spfdisk, etc.)


    • Boot Loader

Boot loader is a small program that runs before the kernel runs, the first real software that runs during computer startup and is responsible for loading the operating system in the boot partition. Typically, each operating system writes its own boot bootloader to the hard disk during the installation process so that it can boot itself.

Boot Loader can initialize the hardware device, set up the mapping of the memory space, thus bring the system's hardware and software environment to a suitable state, and prepare for the final call of the operating system kernel.


    • Load kernel

based on the path of the kernel image set by grub, the system reads the kernel image and makes a decompression operation. When the memory image is loaded into memory, the kernel phase begins. The kernel image is not an executable kernel, but a compressed kernel image. In front of this kernel image is a routine that implements a small set of hardware settings, extracts the kernel contained in the kernel image, and then puts it into high-end memory. If there is an initial RAM disk image, it is moved into memory and is marked for later use. Next, the routine calls the Start-kernel () function, launches a series of initialization functions, initializes the various devices, and completes the creation of the Linux core environment. At this point, the Linux kernel has been set up.


    • Init Process Execution

The init process is the starting point for all processes in the system, and after the kernel is booted inside, the init process is loaded in this thread (process) space, and the process number is 1. The init process is the initiator and controller of all processes. In Linux, it is the first process to run, so the init process is numbered 1. If there is a problem with the Init process, the rest of the system is not available.

The INIT process has 2 functions: one, which plays the role of the parent process. Since the init process never terminates, if a process is terminated before the child process it derives from terminates, the INIT process must be used as a reference, that is, the child processes that lost the parent process will have Init as their parent process. Second, run the appropriate program when you enter a specific runlevel to manage the various runlevel.

There are 7 types of Linux operating levels:

0: Turn off the machine

1: Single-user mode

2: Multi-user mode with no network support

3: Multi-user mode with network support

4: reserved, not used

5: Network support, multi-user mode with X-window support

6: Restart


    • Init Process Execution Rc.sysinit

after setting the run level, Linux executes the first user layer file is the/etc/rc.d/rc.sysinit script program, including setting path, setting the network configuration (/etc/sysconfig/network), starting the Swap partition, setting/ Proc and so on.


    • Booting the kernel module

load the kernel modules according to the files in the/etc/modules.conf file or the/ETC/MODULES.D directory.


    • Executing scripts at different run levels

Depending on the runlevel, the system will run RC0.D to the appropriate script in RC6.D to perform the appropriate initialization and start the appropriate service.


    • Executive/etc/rc.d/rc.local

Rc.local is the place where Linux is left to personalize the user after everything is initialized, so you can put things you set up and start up here.


    • Execute/bin/login program and enter login status.

at this point, the system has entered the waiting time for users to enter username and password.

This article is from the "True Water No Fragrance" blog, please be sure to keep this source http://chengyanli.blog.51cto.com/11399167/1787101

Shallow solution to Linux startup process

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.