Linux foundation of Centos7 system startup


Keywords: boot linux centos7 process grub2 kernel initialization systemd


0. mind map Overview

Here Insert Picture Description


1. The system firmware initialization

1.1 powered

  • POST

1.2 Search bootable device

1.3 GRUB2 loaded from disk

1.4 transmit control to GRUB2



2. The boot loader GRUB2

2.1 Starting GRUB2

  • Load configuration from disk
  • GRUB menu is displayed to the user
  • Startup item is selected

2.2 kernel is loaded with initramfs

  • Loaded from disk

  • Loaded into ram

  • initramfs is a cpio archive

    • Necessary kernel modules
    • Initialization script
  • Transmit control to kernel

    • Pass kernel command line options
    • In the position of the ram initramfs


3. Linux kernel initialization

3.1 systemd to start working copy from initramfs

  • /sbin/init
  • pid=0

3.2 initramfs of systemd start initrd.target

  • All units
  • Including the dependent unit

3.3 kernel to find all the hardware initialization process in the initramfs

  • Initializes the hardware

3.4 initrd-root-fs.target the system root file system is mounted

  • As read-only
  • Mount / sysroot

3.5 execution initrd.target target other unit

3.6 initrd-switch-root.target switched root file system

  • From the initramfs root file system
  • The actual root file system to system

3.7 control to the systemd instance on the actual root file system



4. Perform the local system first process systemd

systemd copy installed 4.1 systemd using the system on their own re-run

  • systemd copy (PID = 1)

4.2 systemd find the system configuration from the kernel command line, or transfer the default destination

4.3 systemd start all units of the default target default.target

  • Automatically resolve dependencies between units

  • If the default destination is multi-user.target

    • Enable text login screen
  • If the default destination is graphical.target

    • Enable graphical login screen

Reference Documents

"Linux Fundamentals and Applications Guide" - Liangru Jun, etc.

Published 204 original articles · won praise 59 · Views 140,000 +

Guess you like

Origin blog.csdn.net/baidu_34122324/article/details/105169920