Android startup research (2)

Source: Internet
Author: User

When Android is started, the kernel of the kernel is automatically loaded into the memory for running. Its main function is to initialize the drivers of various devices, such as cameras, Bluetooth, and telephones.


Start the system process according to the init. rc file after the startup.


The path of init. rc is platform/system/core/rootdir/init. rc. Now, this file is analyzed.


The following format is displayed in this file:


Service zygote/system/bin/app_process-Xzygote/system/bin -- zygote -- start-system-server

Socket zygote stream 66

Onrestart write/sys/android_power/request_start wake

Onrestart write/sys/power/state on

Onrestart restart media

Onrestart restart netd


This format indicates that a series of system-level services are to be started,


Service zygoet: a zygote service is started,

/System/bin/app_process: The specific path of the Process binfile. zygote corresponds to the app_process process,

The remaining parameters will be explained later,


The path of the app_pocess file is/platform/frameworks/base/cmds/app_process/app_main.cpp. Open this file,

We can see the main () function in this file. We can conclude that this main () function is the entry to the zygote service,

Then, the parameters in the service in init. rc just now will be clear.

Main (int argc, const char * const argv []) parameters are used.


In addition, this file also has an important class, which is defined as follows:

Class AppRuntime: public AndroidRuntime {}


The path of the AndroidRuntime class is/platform/frameworks/base/core/jni/AndroidRuntime. cpp.


This class is used to start the java Runtime Environment. The most important code is:


Main (int argc, const char * const argv []) {

.....

AppRuntime runtime;

Runtime. start ("com. android. internal. OS. Zygoteinit", startSystemServer );

......


}


Execute the ZygoetInit class to initialize the Zygote service. The following describes the ZygoteInit class:

 

 

 

 

 

 

 

 

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.