Android Startup analysis-init Process &init.rc

Source: Internet
Author: User
Android Start Analysis-init process &init.rc[turn]

This article turns from: http://h1372865100.blog.163.com/blog/static/210429103201292911399594/

First, the INIT process starts

(Some native services started)

such as: ServiceManager start

Zygote start

Sysytemserver started, in

Init1

Start the Android service in the Init2 function

After the init process is up, parse init.rc and init.xxx.rc to establish basic services

After entering the loop, and not exiting

The main implementation process of init.c@/system/core/init analysis

...

mkdir ("/dev", 0755)//Create a writable directory "/dev"

。。。

Log_init (); Initializing log system

。。。

Parse_config_file ("/init.rc"); /* Parse init.rc file, parse_config_file This function is implemented in the/system/core/init/parse.c class, the analysis of the resulting service information stored in

Service_list This data deconstruction * *

Get_hardware_name ();

snprintf (TMP, sizeof (TMP), "/init.%s.rc", hardware);

Parse_config_file (TMP); /* Parse init.xxx.rc, and hardware-related * *

Action_for_each_trigger ("Early-init", Action_add_queue_tail);

Drain_action_queue (); /* Implementation of the resolution of the "Early-init" action*/

INFO ("Device init/n");

DEVICE_FD = Device_init (); /* The initialization of the device. Mount node pour/dev down and download.

firmwares*/

Property_init ();

。。。 /*property Initialization * *

/* Read/initlogo.rle (a bitmap), if the success of the/dev/graphics/fb0 display Logo, if the failure will be/dev/tty0, set to text mode and open the/dev/tty0, output text ANDROID. Concrete implementation can be seen

/system/core/init/log.c

*/

if (Load_565rle_image (Init_image_file)) {

FD = open ("/dev/tty0", o_wronly);

if (FD >= 0) {

。。。

。。。

}

/* To determine the parameters in the CmdLine and set the arguments in the property system:

* 1, if Bootmode is

*-factory, set ro.factorytest value to 1

*-Factory2, set ro.factorytest value to 2

*-Other ro.factorytest values are 0

* 2, if there are serialno parameters, then set Ro.serialno, otherwise ""

* 3, if has the Bootmod parameter, then sets Ro.bootmod, otherwise is "unknown"

* 4, if has the baseband parameter, then sets Ro.baseband, otherwise is "unknown"

* 5, if has the carrier parameter, then sets Ro.carrier, otherwise is "unknown"

* 6, if has the bootloader parameter, then sets Ro.bootloader, otherwise is "unknown"

* 7, set Ro.hardware and ro.version through global variables (previously extracted from/proc/cpuinfo).

*/

if (Qemu[0])

Import_kernel_cmdline (1);

if (!strcmp (Bootmode, "Factory"))

Property_set ("Ro.factorytest", "1");

else if (!strcmp (Bootmode, "Factory2"))

Property_set ("Ro.factorytest", "2");

Else

Property_set ("Ro.factorytest", "0");

Property_set ("Ro.serialno", Serialno[0]? Serialno: "");

Property_set ("Ro.bootmode", Bootmode[0]? Bootmode: "Unknown");

Property_set ("Ro.baseband", baseband[0]? Baseband: "Unknown");

Property_set ("Ro.carrier", Carrier[0]? Carrier: "Unknown");

Property_set ("Ro.bootloader", Bootloader[0]? Bootloader: "Unknown");

Property_set ("Ro.hardware", hardware);

SNPRINTF (TMP, Prop_value_max, "%d", revision);

Property_set ("Ro.revision", TMP);

Action_for_each_trigger ("Init", action_add_queue_tail);

Drain_action_queue (); /* Execute the parsed init action * *

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.