Summary: Linux system startup process

Source: Internet
Author: User

Knowledge Reserve: Bootloader is the first code of the embedded system after power-on, after it completes the initialization of the CPU and related hardware, then the operating system image or the solidified embedded application is loaded into memory and then jumps to the space where the operating system is located, starting the operating system running

Running Gnu/linux systems on dedicated embedded boards has become increasingly popular. An embedded Linux system can usually be divided into four levels from a software perspective:
1, boot loader program. Includes the boot code (optional) that is cured in the firmware (firmware), and the bootloader two parts.
2, the Linux kernel. Custom kernel and kernel startup parameters specific to the embedded board.
3, File system. Includes the root file system and the file system built on the flash memory device. RAMDisk is usually used as a rootfs.
4, the user application program. User-specific applications. Sometimes an embedded graphical user interface may also be included between the user application and the kernel layer. Commonly used embedded GUI are: Microwindows and Minigui and so on.

Note: 1 CPU found bootloader, start running bootloader, in bootloader define the Linux kernel parameters, Bootloader will be based on these addresses and parameters to carry out the corresponding things, so

2 Linux kernel to boot the appropriate file system

Flow chart:

Process Introduction:

Linux system boot process, boot loader,init system boot process to DEBIAN6 for example 1 load BIOS hardware information and self-test, and get boot device (such as hard disk, CD, Flash) 2 read and execute boot loader ( such as grub, etc.) 3 based on boot loader settings load Kernel,kernel start to detect hardware and driver 4 hardware driver success, kernel will actively call the INIT program, and INIT will get run-level information 5 init execution/etc/ INIT.D/RC script to prepare the working environment for software execution (e.g. network, time zone, etc.) 6 init execution run-level of each service start (scipt mode) 7 init execution/etc/rc.d/rc.local file 8 Init execution terminal starts the login program, waiting for the user to log on to boot loader1 each hard disk MBR has only one 2 per file system (filesystem, or partition) will retain a boot sector (boot sector) 3 Each operating system installs boot loader to the boot sector of his own file system by default 4 boot loader can be installed in MBR, boot loader can also be installed in boot Sector 5 boot Loader can transfer management to other boot loader init programs and their configuration files/etc/inittab/sbin/init The main function is to prepare the environment for software execution, including system hostname, network settings, language processing, The file system format is the startup of the other services/etc/inittab is the/sbin/init configuration file, which resembles script and requires step-by-step init processing, which is/etc/inittab to perform step 1Set the default RunLevel id:2:initdefault: 2system startup init script Si::sysinit:/etc/init.d/rcs 3run a script with RunLevel 2 L2:2:WAIT:/ETC/INIT.D/RC 2 4set Ctrl+alt+del combination to restart ca:12345:ctrlaltdel:/sbin/shutdown-t1-a-R now5Set Power Management PF::p owerwait:/etc/init.d/powerfail start 6start terminal tty1 1:2345:respawn:/sbin/getty 38400 tty1 Step detailed analysis 1 on table 2nd step call RSS is actually called/ETC/INIT.D/RC S, on table 3rd step is also called/ETC/INIT.D/RC 22 view/ETC/INIT.D/RC script, This script calls the corresponding RunLevel script according to the parameter runlevel the path of the script corresponding to RunLevel is/ETC/RC$RUNLEVEL.D/3/etc/rc$runlevel.d/path under which the script is executed sequentially, starting or shutting down the corresponding service/ Etc/rc$runlevel.d/s* the service that needs to be turned on/etc/rc$runlevel.d/k* the service that needs to be shut down 4/etc/init.d/rc.local script is last executed under/etc/rc$runlevel.d/path/etc/ Init.d/rc.local script for user-defined system startup scripts/etc/inittab the primary Syntax/etc/inittab by: (colon) to separate 4 Part 1 IDs. A maximum of 4 characters, representing the primary work of Init, is simply a description of 2 runlevel. Represents the runlevel under which the initialization action runs 3 action. Represents the initialization of the special Action 4 process. Represents a command that needs to be made, usually some script more detailed reference to the man Inittab action initialization special action Initdefaultrepresents a preset set of RunLevel valuesSysinitrepresents the system initialization actionCtrlaltdelrepresents whether the 3 keys can be restarted by pressing theWaitrepresents the subsequent process command must be completed before continuingRespawn represents a subsequent process command that can be regenerated indefinitely. For example Getty start Login, logout, this action will also start login RunLevel execution level runlevel role is to specify the system using different services to start, according to the purpose of setting the appropriate working environment different versions of Linux also need to view/etc/ Inittab0Halt System direct shutdown 1single-user Single-use maintenance mode, used in case of system problems 2Multi-User without NFS multi-user text mode, no NFS service 3Full multi-user multi-user plain text mode with network capabilities 4unused system retention 5X11 Multi-user graphical interface, loading using x Window 6reboot restartRelated Documents/boot/vmlinuz-$ (UNAME-R)Linux Core Files/boot/initrd-$ (UNAME-R)virtual file system at startup/boot/grub/*Boot loader program/etc/inittabinit configuration file/etc/init.d/rcInitializing the system startup script/etc/rc$runlevel.d/*corresponding RunLevel system startup script/etc/init.d/rc.localuser-defined system startup scripts

Summary: Linux system startup process

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.