Linux operating system startup process one

Source: Internet
Author: User
Tags function definition

Linux system Start-up process:

POST--Bootsequence (BIOS)--bootloader--Kernel [-->RAMFS]--rootfs[ro]-->/sbin/init--Set default Operating level--system initialization--parallel execution Ctrl+alt+del hotkey function definition, system service on and off, power management, Dbus management--Login prompt

During the startup process of our Linux system, we have hit to introduce the contents of each process.


post--power-on self-test procedure

Second, bootsequence--start sequence

The boot order determines which hardware device to load the operating system on, and it finds each boot device in the order specified, the first

The device that is found to have the boot program is the device to be used for this boot

Bootloader: bootloader, boot loader, program

MBR: Master boot Record, located on first track, first sector

The MBR describes the logical partitioning information, including the file system and how it is organized. In addition, the MBR also contains executable code for the computer to load the operating system in the second phase of startup or a boot record that connects each partition. This MBR code is often referred to as the bootloader


In a total of 512 bytes of the primary boot sector (master boot record MBR):

Master Boot Program (bootloader) was 446 bytes

Partition table (parition table), dpt:64 bytes

Magic Number:2 Byte, 55AA (fixed)


There are specific main boot programs in our Linux:

Grub:grand Uniform Bootloader, Global unified boot loader;

The Centos6:grub version number format is: 0.x.x:grub legacy

Booting the operating system boot program, mainly divided into two stages

1.stage1, Master Boot program (bootloader), 446 bytes, just to find Stage2

2.stage2: Disk boot partition (/boot), Stage2 and kernel core must be placed on the same basic disk partition

Features provided by Stage2:

Basic Features:

1. Load operating system kernel core files

Extended Functionality

2. Provide a menu and interactive interface

3. Allow user to Edit menu contents

4. Command-line interface operation mode

5. Identity authentication mechanism to ensure menu editing and kernel security


In addition, there is a 1.5stage between the start and Stage1 and Stage2

A number of sectors after the MBR, generally speaking, more than 20 sectors are used to save the stage 1_5,

Its function is: Lets stage1 in the bootloader program to be able to recognize stage2 the partition the file system


Centos7:1.x:grub 2

Features provided by Grub:

1, to provide users with a menu, the menu is listed in each of the operating system kernel can be launched

2. User-selected kernel core files can be loaded into RAM, decompressed and expanded to transfer system control to the kernel

3. Interactive command-line interface

4. Menu and Kernel boot security

To install Grub:

Grub-install--root-directory=/mnt/path/to/

Common commands for the GRUB command line interface:

Grub>

Help + Command: Displays detailed assistance for a specific command

Root + (hd#,#): The specified partition of the specified disk as the root device of the GRUB program

hd#: Disk number, #一般是从0开始的数字: If hd0 represents the first disk

#: Number of partitions, 0 means first partition

For example: (hd0,0): The first partition of the first disk on the current computer

Find (hd#,#): Searches for files from the specified partition and shows where the files are located

Kernel/path/to/kernel_core_file: Set the absolute path of the kernel file used in this boot, and additional kernel parameters can be added in the kernel command for kernel boot.

Example: Kernel/vmlinux ro root=/dev/sdb3 selinux=0 init=/bin/bash

Initrd/path/to/initramfs-version-release

Configuration file for Grub:/boot/grub/grub.conf

The meaning of each field in the Grub configuration file:

[Email protected] ~]# ls-l/etc/grub.conf

lrwxrwxrwx. 1 root root 22 March 23:38/etc/grub.conf. /boot/grub/grub.conf


Default=0: Sets the default Startup menu item, and all the title in the entire menu item is numbered starting at 0

Timeout=5: After how long the user has not made a selection, grub will automatically boot the default menu to the corresponding kernel's timeout period

Splashimage= (hd0,0)/grub/splash.xpm.gz:grub the corresponding path to the background image

Hiddenmenu: Hide Grub's boot menu

Password--md5 crypted_password: Keep the password above in order to protect the menu, to prevent random entry into single-user mode

Protecting the boot of the operating system kernel

Title CentOS 6 (2.6.32-573.el6.x86_64):

Define individual identities in a menu item, you can define multiple title entries, and at least one

Root (hd0,0)

Specifies the root device of grub, which is typically the partition used to install Grub

kernel/vmlinuz-2.6.32-573.el6.x86_64 ro root=/dev/mapper/volgroup-lv_root nomodeset rd_NO_LUKS Rd_NO_MD rd_LVM_LV= Volgroup/lv_swap Crashkernel=auto LANG=ZH_CN. UTF-8 rd_lvm_lv=volgroup/lv_root keyboardtype=pc keytable=us rd_no_dm rhgb quiet:

The menu corresponding to the kernel to be launched and the parameters passed to the kernel

Initrd/initramfs-2.6.32-573.el6.x86_64.img

The RAMDisk file that corresponds to the kernel



Linux operating system startup process one

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.