Red Hat Linux Startup Process details

Source: Internet
Author: User

In LinuxCommunityI saw this article.ArticleYou have to learn about the startup!

Main Startup Process

Initialize BIOS → execute the boot loader → load the kernel → start the init Service

Bios

1.1 detect all peripherals

Detect peripherals and peripheral errors

1.2 find the Startup Device

Find the boot devices (CD-Rom, IDE-HDD, floppy…) based on the boot sequence set in the BIOS ....)

Start the loader

After the BIOS finds the boot device, start the operating system of the device. The BIOS will try to find the Boot Sector in the following order, that is, the magnetic zone of the Master Boot Record (MBR.

2.1 find the first sector of the hard disk, that is, the Master Boot Record.

2.2 If the operating system is not stored in the Master Boot Record, find the operating system in the first sector of the disk marked as the boot partition.

Whether it is the primary Boot Record sector or the first sector in the boot partition, the storage operating system space is only 446 bytes. The current operating system cannot be crowded into such a small space. If there is no way to store the operating system kernel in the sectors mentioned above, it will make the BIOS unable to start up. In order to avoid re-customizing BIOS rules and enable the BIOS to smoothly start the operating system kernel stored in other locations, people come up with a way to write a smallProgramTo the first 446 bytes of space in the startup sector. Then, the applet loads the operating system stored in other locations.

This small program is "Start Loader" (grub by default in Linux)

Start the kernel

After the BIOS starts the loader smoothly, the loader looks for the operating system stored in other sectors and starts it. After the Linux kernel is started, the following tasks are performed:

3.1 check all hardware devices

The kernel queries the BIOS for all hardware information about the computer and takes over these hardware devices for system use.

3.2 drive hardware

Next, the Linux driver hardware

To drive a hardware device, you must load its driver. Linux drivers are divided into static drivers compiled in the kernel and dynamic drivers of the kernel module. The dynamic driver is stored in the file system.

Because no file system is mounted at this time, you can only use static drivers to drive some programs that can drive them. Other hardware cannot be driven until the root file system is mounted.

Mount the root file system in read-only mode

Next, the Linux kernel tries to mount the root file system, which has two directories.

Install appropriate kernel modules to drive certain hardware devices or enable certain functions.

Start the init service stored in the root file, so that the init service can take over subsequent startup work.

Start the init Service

The last action after the kernel is started is to start the init service. The Linux kernel runs as follows:

To find the init service.

Find/sbin/whether the init service exists

Find/etc/init

Find/bin/init

If none of them are found, run/bin/sh.

Initialize the system environment

When the init service is started, the init service reads the/etc/inittab file and initializes the system environment according to the file settings. This file defines that the init service must execute the following scripts in sequence during Linux Startup.

/Etc/init. d/rc. sysinit

/Etc/init. d/RC

/Etc/init. d/rc. Local

The following describes what these rcscripts have done.

/Etc/init. d/rc. sysinit

Start udev and SELinux subsystems

Set Kernel Parameters

Set system time

Load the keyboard table

Enable virtual memory space

Set Host Name

Detect and mount all file systems

Initialize hardware

Enable software disk array and LVM

Initialize the serial port

Clear expired locked files and IPC files

Reset hard disk Parameters

/Etc/rc. d/RC

This is used to establish the runlevel environment.

/Etc/rc. d/rc. Local

Store user-initiated scripts

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.