ImageVerifierCode 换一换
格式:DOCX , 页数:53 ,大小:586.72KB ,
资源ID:24229088      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/24229088.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(Android初始化流程简要分析.docx)为本站会员(b****4)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

Android初始化流程简要分析.docx

1、Android初始化流程简要分析Android初始化流程简要分析 liranke TABLE OF CONTENTS1 Init process 21.1 Main function(引自sdk参考文档) 21.1.1 Process step: 21.1.2 Start services: 31.2 Flow chart: 41.2.1 Flow chart: 41.3 Analyse: 51.3.1 FD: 51.4 System status 71.4.1 rocess list 72 Adbd 93 Servicemanager 93.1 Introcuce 93.2 Compiler

2、 103.3 Flow: 103.3.1 Main of Frameworksbasecmdsservicemanagerservice_manager.c 103.4 Main_runtimer.cpp 164 Mountd 174.1 Analyse 175 Debuggerd 185.1 Chart 186 Rild 186.1 Chart 186.1.1 RIL Architecture: 186.1.2 RIL Flow: 197 zygote 207.1 Introduce 207.2 app_process 217.2.1 compile: 217.2.2 Class chart

3、: 227.2.3 Flow chart: 227.3 ZygoteInit 247.3.1 compile: 247.3.2 ZygoteInit Main function flow chart 248 system_server 268.1 Compile: 268.2 Analyse: 278.2.1 Server Class chart 278.2.2 Syste_init 288.2.3 startSystemServer 298.2.4 runSelectLoopMode 298.2.5 context = ActivityManagerService.main(factoryT

4、est)的执行过程 369 Media 3810 Bootsound 3811 Dbus 3812 Installd 3812.1 Chart 3812.2 Analyse 391 Init processInit is the first process after kernel is started. Init code local at system/core/init(Android) dir, main function is included init.c. Init is called by kernel_init function localling at init(kerne

5、l) dir, via execve function.1.1 Main function(引自sdk参考文档)Init is the first process after kernel is started. Init code local at system/core/init(Android) dir, main function is included init.c. Init is called by kernel_init function localling at init(kernel) dir, via execve function.1.1.1 Process step:

6、1. Mount basic file system, and nitialize log system. 2. Parse /init.rc and /init.%hardware%.rc. 3. Execute early-init action in init.rc. 4. Device specific initialize. 5. Initialize property system, and load android image, then print” ANDROID”. 6. Execute init action in init.rc. 7. Start property s

7、ervice. 8. Execute early-boot and boot actions in init.rc. 9. Execute property action in init.rc. 10. Enter into an indefinite loop to wait for device/property set/child process exit events. For example, if an SD card is plugined, init will receive a device add event, so it can make node for the dev

8、ice. Most of the important process is forked in init, so if any of them crashed, init will receive a SIGCHLD then translate it into a child process exit event, so in the loop init can handle the process exit event and execute the commands defined in *.rc(it will run command onrestart). 1.1.2 Start s

9、ervices:The .rc file is a script file defined by Android. The default is device/system/rootdir/init.rc. We can take a loot at the file format(device/system/init/readme.txt is a good overall introduction of the script). Basically the script file contains actions and services. Init.rc will run the fol

10、lowing services:console: star a shell. The source is in device/system/bin/sh. adbd: start adb daemon. The source is in device/tools/adbd. By default is disabled. servicemanager: start binder system. The source is in device/commands/binder. mountd: mount all fs defined in /system/etc/mountd.conf if s

11、tarted, receive commands through local socket to mount any fs. The source is in device/system/bin/mountd. debuggerd: start debug system. The source is in device/system/bin/debuggerd. rild: start radio interface layer daemon. The source is in device/commands/rild. zygote: start Android Java Runtime a

12、nd start system server. Its the most important service. The source is in device/servers/app. media: start AudioFlinger, MediaPlayerService and CameraService. The source is in device/commands/mediaserver. bootsound: play the default boot sound /system/media/audio/ui/boot.mp3. The source is in device/

13、commands/playmp3. dbus: start dbus daemon, its only used by BlueZ. The source is in device/system/Bluetooth/dbus-daemon. hcid: redirect hcids stdout and stderr to the Android logging system. The source is in device/system/bin/logwrapper. By default is disabled. hfag: start Bluetooth handsfree audio

14、gateway, its only used by BlueZ. The source is in device/system/Bluetooth/bluez-utils. By default is disabled. hsag: start Bluetooth headset audio gateway, its only used by BlueZ. The source is in device/system/Bluetooth/bluez-utils. By default is disabled. installd: start install package daemon. Th

15、e source is in device/servers/installd. flash_recovery: load /system/recovery.img. The source is in device/commands/recovery/mtdutils.1.2 Flow chart:1.2.1 Flow chart:1.3 Analyse:1.3.1 FD: FD Include : device _fd, property_set_fd, signal_recv_fd, signal_fd(global value) ufds: struct pollfd ufds4 = de

16、vice _fd , property_set_fd , signal_recv_fd , keychord_fd 1. device_fd 2. property_set_fd(1) (2) Property_set_fd C/S chart:#define PROP_SERVICE_NAME property_service3. signal_recv_fdsignal_recv_fd and signal_fd:/* create a signalling mechanism for the sigchld handler */ if (socketpair(AF_UNIX, SOCK_

17、STREAM, 0, s) = 0) signal_fd = s0; signal_recv_fd = s1; fcntl(s0, F_SETFD, FD_CLOEXEC); fcntl(s0, F_SETFL, O_NONBLOCK); fcntl(s1, F_SETFD, FD_CLOEXEC); fcntl(s1, F_SETFL, O_NONBLOCK); /read signalread(signal_recv_fd, tmp, sizeof(tmp);while (!wait_for_one_process(0); /阻塞4. signal_fd( see to signal_re

18、cv_fd)1.4 System status1.4.1 rocess list USER PID PPID VSIZE RSS WCHAN PC NAMEroot 1 0 548 196 c00b8c14 0000d5cc S /initroot 2 0 0 0 c006bf70 00000000 S kthreaddroot 3 2 0 0 c005cc50 00000000 S ksoftirqd/0root 4 2 0 0 c007e408 00000000 S watchdog/0root 5 2 0 0 c0068eec 00000000 S events/0root 6 2 0

19、0 c0068eec 00000000 S khelperroot 10 2 0 0 c0224f90 00000000 S suspend/0root 81 2 0 0 c0068eec 00000000 S kblockd/0root 89 2 0 0 c01f2f7c 00000000 S kseriodroot 111 2 0 0 c0068eec 00000000 S kmmcdroot 117 2 0 0 c0068eec 00000000 S btaddconnroot 118 2 0 0 c0068eec 00000000 S btdelconnroot 135 2 0 0 c

20、00448e0 00000000 S bpmdroot 141 2 0 0 c008b5f4 00000000 S pdflushroot 142 2 0 0 c008b5f4 00000000 S pdflushroot 143 2 0 0 c008f948 00000000 S kswapd0root 189 2 0 0 c0068eec 00000000 S aio/0root 195 2 0 0 c01721f0 00000000 S mtdblockdroot 340 2 0 0 c01b4eb0 00000000 S accessory notifroot 349 2 0 0 c0

21、068eec 00000000 S camera_task/0root 376 2 0 0 c0061438 00000000 S w1_controlroot 378 2 0 0 c0061438 00000000 S w1_bus_master1root 386 2 0 0 c0068eec 00000000 S charge ?root 428 2 0 0 c02ca26c 00000000 S krfcommdroot 430 2 0 0 c0068eec 00000000 S rpciod/0root 724 2 0 0 c0216908 00000000 S mmcqdroot 7

22、26 1 772 180 c019dbc4 afe0c1dc S /system/bin/shsystem 727 1 840 188 c022d8a0 afe0c47c S /system/bin/servicemanagerroot 729 1 1920 336 ffffffff afe0c1dc S /system/bin/mountdroot 730 1 704 176 c0257854 afe0ce0c S /system/bin/debuggerdroot 731 1 4132 628 c027e2f8 afe0ce0c S /opl/bin/tcmdroot 732 1 852

23、248 c00b92b0 afe0c5a4 S /opl/bin/adapterradio 733 1 12796 648 ffffffff beaab18c S /system/bin/rildroot 734 1 72000 14172 c00b92b0 afe0c5a4 S zygoteroot 735 1 33848 4512 ffffffff afe0c47c S /system/bin/mediaserverroot 736 1 1080 216 c00b8c14 bedc021c S /system/bin/dbus-daemonroot 737 1 832 208 c02b6e

24、80 afe0c1dc S /system/bin/installdroot 740 1 856 260 c00b92b0 afe0c5a4 S /opl/bin/bpdroot 741 1 828 172 c00b8c14 afe0d27c S /opl/bin/battmondroot 768 1 720 272 c02265ec afe0c1dc S /system/bin/logcatroot 769 1 716 264 c02265ec afe0c1dc S /system/bin/logcatroot 816 2 0 0 c0068eec 00000000 S battery.0s

25、ystem 825 734 574128 28360 ffffffff afe0c47c S system_serverradio 877 734 158260 20040 ffffffff afe0d404 S com.android.phoneapp_5 879 734 100888 13616 ffffffff afe0d404 S android.process.acoresystem 882 734 144664 24296 ffffffff afe0d404 S android.process.omsserviceapp_45 884 734 92304 10932 fffffff

26、f afe0d404 S com.motorola.motohomeapp_22 890 734 117068 30228 ffffffff afe0d404 S oms.homeapp_3 918 734 98760 12652 ffffffff afe0d404 S oms.widgetmanagerapp_5 928 734 100888 13336 ffffffff afe0d404 S com.android.inputmethod.borqsapp_24 930 734 105176 19168 ffffffff afe0d404 S com.db4o.servo.searchap

27、p_18 960 734 104180 15208 ffffffff afe0d404 S com.android.mmsapp_8 979 734 118860 14044 ffffffff afe0d404 S android.process.mediaapp_9 991 734 91980 12264 ffffffff afe0d404 S com.android.alarmclockapp_15 998 734 103144 12908 ffffffff afe0d404 S oms.dcdsystem 1018 734 94732 13792 ffffffff afe0d404 S

28、oms.dmapp_14 1025 734 95636 13036 ffffffff afe0d404 S com.android.calendarapp_42 1041 734 93292 11316 ffffffff afe0d404 S com.motorola.smsautoregapp_40 1090 734 97152 15192 ffffffff afe0d404 S com.motorola.mtcapp_38 1102 734 93832 12868 ffffffff afe0d404 S com.streamezzo.browser.androidapp_26 1115 7

29、34 96596 15084 ffffffff afe0d404 S oms.mediacenterapp_37 1126 734 98208 15212 ffffffff afe0d404 S com.hyfsoft.docviewerapp_20 1146 734 99260 15320 ffffffff afe0d404 S com.android.musicapp_47 1157 734 100204 15964 ffffffff afe0d404 S com.motorola.cameraapp_11 1183 734 122672 23576 ffffffff afe0d404 S

30、 com.android.browserapp_6 1199 734 117032 20388 ffffffff afe0d404 S oms.mobilemusicsystem 1244 734 99292 15940 ffffffff afe0d404 S com.android.settingsapp_23 1311 734 96932 16004 ffffffff afe0d404 S oms.bruroot 1334 2 0 0 c0216908 00000000 S mmcqdapp_8 1351 734 100308 15876 ffffffff afe0d404 S com.a

31、ndroid.cameraapp_1 1424 734 111904 17024 ffffffff afe0d404 S oms.messagingapp_4 1436 734 101172 15504 ffffffff afe0d404 S oms.mailapp_2 1484 734 100716 18128 ffffffff afe0d404 S com.msapp_16 1663 734 101024 16748 ffffffff afe0d404 S oms.android.filemanagerroot 1684 1 3364 176 ffffffff 0000e8f4 S /sbin/adbdroot 1692 1684 776 348 c0059cd4 afe0d0ac S /system/bin/shroot 1724 1692 920 356 00000000 afe0c1dc R ps从真正的应用层的角度来看,所有的应用程序(如settings,media)的父进程都是zygote. 因为任何一个应用都是一个VM。2 AdbdSee to A

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1