In-depth introduction-Android system migration and platform development (4)-Android Startup Process

Source: Internet
Author: User

1. Start the Android init process

Start with Linux. Linux is loaded into the memory by bootloader and starts to run. After the Linux runtime environment is initialized, Mount ramdisk. img root file system image, run the init program, which is also the first user program in Linux, and its pid is 1. The following article describes how to start the init process.

 

Ii. Launch of Android local services

After the init process is started, initialize and start the Dalvik virtual machine. You have done some work before the Dalvik virtual machine is started. Please refer to the following article.

 

 

Android startup summary:

The init process can be divided into the following stages:

Prepare for startup: create the basic directory of the file system, enable the standard input, standard output, standard errors, and initialize the log function.

Parsing the init. rc and init. hardware. rc files: parses the rc files into Action or Service lines by line. The parsed actions and services are stored in the action_list and service_list linked lists respectively. Each Action corresponds to one or more Commands, and each Commands attached to the Action is maintained by a linked list. Www.2cto.com

Add early-initAction to the action_queue queue and wait for execution.

Add the init Action to the action_queue queue and wait for execution.

Add the Action of other conditions to the action_queue queue.

Enter an endless loop

O extracts each Action from the action_queue queue and executes the Commands in the Commands linked list maintained by the Action.

O restart service_list as SVC_RESTARTING Service

O listens to system attribute status change events, sub-process signals, and Keychord combination key events.

Note: There is no clearly running service code in service_list in the Code. Each Service has a class attribute, which determines the service category. In init. the on boot Action of the rc file last has two commands:

On boot

...

...

Class_start core

Class_start main

The class_start command is used to run a certain type of service. It first starts the service whose class is core, and then starts the service whose class is main.

Services whose class is core in init. rc include:

Service name
Corresponding program and Parameters
 
Ueventd
/Sbin/ueventd
 
Console
/System/bin/sh
 
Adbd
/Sbin/adbd
 
Servicemanager
/System/bin/servicemanager
 
Vold
/System/bin/vold
 

 

Services whose class is main include:

Service name
Corresponding program and Parameters
 
Netd
/System/bin/netd
 
Debugadh
/System/bin/debugadh
 
Ril-daemon
/System/bin/rild
 
Surfaceflinger
/System/bin/surfaceflinger
 
Zygote
/System/bin/app_process-Xzygote/system/bin -- zygote -- start-system-server
 
Drm
/System/bin/drmserver
 
Media
/System/bin/mediaserver
 
Bootanim
/System/bin/bootanimation
 
Bytes
/System/bin/logs-daemon -- system -- nofork
 
Thd
/System/bin/define thd-n
 
Installd
/System/bin/installd
 
Flash_recovery
/System/etc/install-recovery.sh
 
Racoon
/System/bin/racoon
 
Mtpd
/System/bin/mtpd
 
Keystore
/System/bin/keystore/data/misc/keystore
 
Dumpstate
/System/bin/dumpstate-s
 

 

 

 

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.