Linux Startup Simple Analysis

Source: Internet
Author: User

1. Overview

The main process from bootloader to Init program is as follows

++++++++++++++    ++++++++++++++++++    ++++++++++++++++++++++++++++++++++++++++++++++++++|            | Kernel_entry () | | Start_kernel (), Rest_init (), Kernel_init () |==============, ==================, =================== ===============================| BootLoader | |    MIPS        |                    Kernel                      |++++++++++++++    ++++++++++++++++++    

Kernel_init () first attempts to execute the command arguments passed from bootloader rdinit=, init=
If it fails, it will attempt to execute/sbin/init,/etc/init,/bin/init,/bin/sh,

The following is a command-line instance passed from Uboot
such as console=ttys0,115200 Root=/dev/ram RW INIT=/LINUXRC

2. BusyBox

In an embedded system, the INIT program is usually the BusyBox
And LINUXRC is a symbolic link to busybox.

BusyBox's init program, the Init_main function

Init_main (), Parse_inittab (), Run_actions (Sysinit)
3. Inittab

File/etc/inittab is a very important file for Linux startup

Reference </etc/inittab file analysis > or <linux/etc/inittab file >

Here's a look at the following action-Sysinit lines
The script specified by the line will complete the system initialization process

In Ttylinux, the behavior

:: Sysinit:/etc/rc.d/rc.sysinit

The work done by Rc.sysinit is mainly
Set environment variables, load file system ...

One notable concern is the start-up service

~~~~~~~~~~~~~ part of/etc/rc.d/rc.sysinit ~~~~~~~~~~~~~# ********************************* # Start the services.# *********************************************** for  P in /etc/rc.d/rc.startup/* ;    do  [[-X ${p}]] && ${p} startdone; unset p~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 

And the Rc.startup directory contains the following script

$ ls-al/etc/rc.d/rc.startuptotal 8drwxr-xr-x 2 root root 4096 Jul 07:33. drwx R-xr-x 5 root root 4096 Jul 29 07:33.. lrwxrwxrwx 1 (root root) 07:33 00.random. /init.d/randomlrwxrwxrwx 1 (root root) 07:33 01.firewall. /init.d/firewalllrwxrwxrwx 1 (root root) 07:33 05.syslog. /init.d/sysloglrwxrwxrwx 1 (root root) 07:33 10.network. /init.d/networklrwxrwxrwx 1, root root 07:33 20.sshd. /init.d/sshdlrwxrwxrwx 1, root root 07:33 30.inetd. /init.d/inetdlrwxrwxrwx 1 root root 07:33 85.gpm. /init.d/gpmlrwxrwxrwx 1, root root 07:33 90.crond. /init.d/crond 

You can see that Ttylinux started the service specified in the script in turn

Linux Startup Simple Analysis

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.