Android系统启动流程
作者:互联网
1.Android系统启动流程
那么结合本篇以及本系列的前三篇文章,我们就可以得出Android系统启动流程,如下所示。
1.启动电源以及系统启动
当电源按下时引导芯片代码开始从预定义的地方(固化在ROM)开始执行。加载引导程序Bootloader到RAM,然后执行。
2.引导程序BootLoader
引导程序BootLoader是在Android操作系统开始运行前的一个小程序,它的主要作用是把系统OS拉起来并运行。
3.Linux内核启动
内核启动时,设置缓存、被保护存储器、计划列表、加载驱动。当内核完成系统设置,它首先在系统文件中寻找init.rc文件,并启动init进程。
4.init进程启动
初始化和启动属性服务,并且启动Zygote进程。
5.Zygote进程启动
创建JavaVM并为JavaVM注册JNI,创建服务端Socket,启动SystemServer进程。
6.SystemServer进程启动
启动Binder线程池和SystemServiceManager,并且启动各种系统服务。
7.Launcher启动
被SystemServer进程启动的ActivityManagerService会启动Launcher,Launcher启动后会将已安装应用的快捷图标显示到界面上。
结合上面的流程,给出Android系统启动流程图:
2.开机动画所处的位置
由surfacefinger启动,不由原来init.rc直接启动
https://blog.csdn.net/u010753159/article/details/51325500
3.开机启动prof Log
<< /proc/bootprof >>:
----------------------------------------
0 BOOT PROF (unit:msec)
----------------------------------------
663 : preloader
2718 : lk (Start->Show logo: 744)
----------------------------------------
27.566153 : ON
136.795307 : 1-swapper/0 : initcall: arm64_device_init 40.393846ms
157.571154 : 1-swapper/0 : initcall: param_sysfs_init 16.377846ms
214.686231 : 1-swapper/0 : initcall: ccci_util_init 40.666308ms
250.370154 : 1-swapper/0 : initcall: event_trace_init 26.059923ms
321.267769 : 1-swapper/0 : initcall: populate_rootfs 53.117231ms
391.744539 : 1-swapper/0 : probe: probe=platform_drv_probe drv=musb-hdrc(ffffff800946b840) 15.519077ms
391.800308 : 1-swapper/0 : initcall: musb_init 16.094000ms
425.951539 : 1-swapper/0 : probe: probe=platform_drv_probe drv=mtkfb(ffffff8009476c60) 27.151154ms
426.249385 : 1-swapper/0 : initcall: mtkfb_init 28.278385ms
458.749154 : 1-swapper/0 : initcall: modem_cd_init 15.351692ms
1437.226618 : 1-swapper/0 : probe: probe=spi_drv_probe drv=sunwave-fp(ffffff80094c6cb0) 919.970925ms
1437.332387 : 1-swapper/0 : initcall: sf_ctl_driver_init 920.152309ms
2072.525927 : 1-swapper/0 : initcall: mt_spm_init 554.895847ms
2078.197697 : 196-kworker/3:1 : probe: probe=mmc_bus_probe drv=mmcblk(ffffff80094d4110) 399.728539ms
3319.500084 : 1-swapper/0 : probe: probe=i2c_device_probe drv=ltr559(ffffff800945c488) 1245.203080ms
3319.807930 : 1-swapper/0 : initcall: alsps_init 1245.673080ms
3350.704469 : 1-swapper/0 : probe: probe=i2c_device_probe drv=bmp280(ffffff800945df30) 15.867539ms
3350.957930 : 1-swapper/0 : initcall: baro_init 16.650692ms
3915.435163 : 53-kworker/u8:1 : probe: probe=i2c_device_probe drv=ft6x06_new(ffffff80094c6600) 535.894924ms
3917.398009 : 53-kworker/u8:1 : probe: probe=platform_drv_probe drv=mtk-tpd(ffffff80094ba558) 539.099848ms
3920.459163 : 1-swapper/0 : initcall: mtk_charger_init 544.432924ms
3957.744240 : 1-swapper/0 : initcall: clk_debug_init 33.908846ms
3961.032009 : 1-swapper/0 : Kernel_init_done
5452.606166 : 1-init : INIT:early-init
6364.176707 : 1-init : INIT:late-init
6364.781168 : 1-init : INIT:Mount_START
8351.221558 : 1-init : INIT:Mount_END
8387.175404 : 1-init : start teei_daemon (on fs)
8390.148789 : 1-init : start teei_daemon end (on fs)
8492.065097 : 327-teei_daemon : TEEI WorkQueue Created
8492.109789 : 327-teei_daemon : TEEI VFS Buffer Created
8502.009635 : 1-init : INIT:post-fs
8856.556790 : 1-init : INIT:post-fs-data
8921.187328 : 1-init : post-fs-data: on modem start
8942.711021 : 1-init : start teei cfg (on post-fs-data)
8955.818867 : 1-init : start teei cfg end (on post-fs-data)
9452.177637 : 327-teei_daemon : TEEI BOOT Stage1 Completed
9453.333791 : 327-teei_daemon : TEEI BOOT CMD Buffer Created
9725.352330 : 1-init : INIT:boot
9918.550177 : 1-init : USB ready
9970.120639 : 390-vold : vold:cryptfs_enable_internal:START
9971.605869 : 370-ccci_mdinit : ccci_md3: md_init srv start
9986.179639 : 1-init : INIT:vold.decrypt=trigger_shutdown_framework
10047.415870 : 368-ccci_mdinit : ccci_md1: md_init srv start
10052.268100 : 368-ccci_mdinit : ccci_md1: init
10190.896408 : 327-teei_daemon : TEEI BOOT Stage2 Completed
10193.688870 : 327-teei_daemon : TEEI BOOT Service1 Inited
10193.742101 : 327-teei_daemon : TEEI BOOT Keymaster Unlocked
10284.522485 : 1-init : INIT:vold.decrypt=trigger_post_fs_data
10495.396024 : 1-init : INIT:post-fs-data
10547.657563 : 1-init : post-fs-data: on modem start
10567.273871 : 1-init : start teei cfg (on post-fs-data)
10584.649948 : 1-init : start teei cfg end (on post-fs-data)
10939.487333 : 426-SurfaceFlinger: : BOOT_Animation:START
12562.424722 : 390-vold : vold:encrypt_master_key:START
12562.657106 : 390-vold : vold:keymaster_create_key:START
15747.409345 : 390-vold : vold:keymaster_create_key:END
15747.498960 : 390-vold : vold:scrypt_keymaster:START
17311.102733 : 390-vold : vold:scrypt_keymaster:END
17960.590581 : 390-vold : vold:encrypt_master_key:END
17965.918965 : 390-vold : vold:decrypt_master_key:START
17966.003888 : 390-vold : vold:scrypt_keymaster:START
19513.749584 : 390-vold : vold:scrypt_keymaster:END
19513.848431 : 390-vold : vold:decrypt_master_key:END
19518.434046 : 390-vold : vold:cryptfs_enable_inplace:START
26403.858447 : 390-vold : vold:cryptfs_enable_inplace:END
26488.997370 : 390-vold : vold:decrypt_master_key:START
26489.086601 : 390-vold : vold:scrypt_keymaster:START
28037.866835 : 390-vold : vold:scrypt_keymaster:END
28037.964759 : 390-vold : vold:decrypt_master_key:END
28695.554837 : 390-vold : vold:cryptfs_restart_internal:START
28699.209760 : 1-init : INIT:vold.decrypt=trigger_reset_main
30837.402304 : 1-init : INIT:vold.decrypt=trigger_post_fs_data
31043.468458 : 1-init : INIT:post-fs-data
31107.979535 : 1-init : post-fs-data: on modem start
31125.586535 : 327-teei_daemon : TEEI BOOT Decrypt Unlocked
31125.755920 : 327-teei_daemon : TEEI BOOT Service2 Inited
31159.208304 : 1-init : start teei cfg (on post-fs-data)
31183.158074 : 1-init : start teei cfg end (on post-fs-data)
31519.435459 : 327-teei_daemon : TEEI BOOT Load TEES Completed
31519.478690 : 327-teei_daemon : TEEI BOOT All Completed
31519.490536 : 327-teei_daemon : TEEI_BOOT_OK
31702.189844 : 1-init : INIT:vold.decrypt=trigger_restart_framework
32116.520307 : 390-vold : vold:cryptfs_restart_internal:END
32116.635461 : 390-vold : vold:cryptfs_enable_internal:END, ret=0
32321.755461 : 482-zygote64 : boot_progress_start
33617.325926 : 368-ccci_mdinit : ccci_md1: decpyt ready
33619.063387 : 368-ccci_mdinit : ccci_md1: reset
33785.535388 : 368-ccci_mdinit : ccci_md1: bootup
38359.421014 : 482-main : Zygote:Preload Start
38677.507169 : 483-main : Zygote:Preload End
38849.372554 : 368-ccci_mdinit : ccci_md1: ready
40348.881865 : 482-main : Zygote:Preload 4715 classes in 1800ms
40536.839250 : 482-main : Zygote:Preload 64 obtain resources in 186ms
40571.867404 : 482-main : Zygote:Preload 41 resources in 34ms
41065.418020 : 482-main : Zygote:Preload End
41530.037329 : 1102-system_server : Android:SysServerInit_START
43077.210794 : 1102-system_server : Android:PackageManagerService_Start
43140.914102 : 1102-system_server : Android:PMS_scan_START
43143.757948 : 1102-system_server : Android:PMS_scan_data:/vendor/overlay
43221.506410 : 1102-system_server : Android:PMS_scan_data:/system/framework
43601.665719 : 1102-system_server : Android:PMS_scan_data:/vendor/framework
43611.346642 : 1102-system_server : Android:PMS_scan_data:/system/priv-app
46889.737573 : 1102-system_server : Android:PMS_scan_data:/system/app
52653.427356 : 1102-system_server : Android:PMS_scan_data:/vendor/app
52866.959587 : 1102-system_server : Android:PMS_scan_data:/system/presetapp
109655.541030 : 1102-system_server : Android:PMS_scan_END
109726.110492 : 1102-system_server : PMS:reconcileAppsDataLI
111146.830341 : 1102-system_server : Android:PMS_READY
114003.500964 : 483-main : Zygote:Preload 4715 classes in 2157ms
114256.658041 : 1102-system_server : PMS:performDexOpt:com.mediatek.ims
114289.513810 : 483-main : Zygote:Preload 64 obtain resources in 284ms
114331.412503 : 483-main : Zygote:Preload 41 resources in 41ms
114863.786812 : 1220-QkSp_performDex : PMS:performDexOpt:com.mediatek.ims
116049.856276 : 1102-system_server : PMS:performDexOpt:com.android.providers.settings
116052.011276 : 1220-QkSp_performDex : PMS:performDexOpt:com.android.providers.settings
116056.421122 : 1102-system_server : PMS:performDexOpt:com.android.inputdevices
116063.351584 : 1220-QkSp_performDex : PMS:performDexOpt:com.android.inputdevices
116070.269276 : 1102-system_server : PMS:performDexOpt:com.android.server.telecom
116073.287968 : 1220-QkSp_performDex : PMS:performDexOpt:com.android.server.telecom
116088.447892 : 1102-system_server : PMS:performDexOpt:com.android.inputmethod.latin
116091.869353 : 1220-QkSp_performDex : PMS:performDexOpt:com.android.inputmethod.latin
116157.704661 : 1102-system_server : PMS:performDexOpt:com.android.settings
116160.647507 : 1220-QkSp_performDex : PMS:performDexOpt:com.android.settings
116184.234661 : 1102-system_server : PMS:performDexOpt:com.qiku.android.configcenter
116186.145507 : 1220-QkSp_performDex : PMS:performDexOpt:com.qiku.android.configcenter
116200.713969 : 1102-system_server : PMS:performDexOpt:com.android.phone
116203.190507 : 1220-QkSp_performDex : PMS:performDexOpt:com.android.phone
116283.789431 : 1102-system_server : PMS:performDexOpt:com.android.location.fused
116292.689892 : 1220-QkSp_performDex : PMS:performDexOpt:com.android.location.fused
116306.726123 : 1102-system_server : PMS:performDexOpt:com.android.systemui
116357.545969 : 1220-QkSp_performDex : PMS:performDexOpt:com.android.systemui
116375.392431 : 1102-system_server : PMS:performDexOpt:com.android.providers.media
116385.881277 : 1220-QkSp_performDex : PMS:performDexOpt:com.android.providers.media
116393.848892 : 1102-system_server : PMS:performDexOpt:com.mediatek.location.lppe.main
116398.186815 : 1220-QkSp_performDex : PMS:performDexOpt:com.mediatek.location.lppe.main
117048.866355 : 1102-system_server : PMS:performDexOpt:com.android.providers.downloads
117052.288817 : 1220-QkSp_performDex : PMS:performDexOpt:com.android.providers.downloads
117085.277355 : 1102-system_server : PMS:performDexOpt:com.android.core.patchsystem
117087.844048 : 1220-QkSp_performDex : PMS:performDexOpt:com.android.core.patchsystem
117095.659509 : 1102-system_server : PMS:performDexOpt:com.qiku.android.safe
117098.175356 : 1220-QkSp_performDex : PMS:performDexOpt:com.qiku.android.safe
117108.529509 : 1102-system_server : PMS:performDexOpt:com.mediatek.bluetooth.dtt
117111.240817 : 1220-QkSp_performDex : PMS:performDexOpt:com.mediatek.bluetooth.dtt
117120.790433 : 1102-system_server : PMS:performDexOpt:com.qiku.android.contacts
117123.440356 : 1220-QkSp_performDex : PMS:performDexOpt:com.qiku.android.contacts
117132.767817 : 1102-system_server : PMS:performDexOpt:com.mediatek.providers.drm
117136.583202 : 1220-QkSp_performDex : PMS:performDexOpt:com.mediatek.providers.drm
117142.697509 : 1102-system_server : PMS:performDexOpt:com.mediatek.batterywarning
117144.452356 : 1220-QkSp_performDex : PMS:performDexOpt:com.mediatek.batterywarning
117185.831817 : 1102-system_server : PMS:performDexOpt:com.android.printspooler
117187.882740 : 1220-QkSp_performDex : PMS:performDexOpt:com.android.printspooler
117195.702894 : 1102-system_server : PMS:performDexOpt:com.android.sc
117198.046279 : 1220-QkSp_performDex : PMS:performDexOpt:com.android.sc
117208.492587 : 1102-system_server : PMS:performDexOpt:com.qiku.android.calendar
117210.520279 : 1220-QkSp_performDex : PMS:performDexOpt:com.qiku.android.calendar
117220.131817 : 1102-system_server : PMS:performDexOpt:com.qiku.android.launcher3
117223.655356 : 1220-QkSp_performDex : PMS:performDexOpt:com.qiku.android.launcher3
117233.032433 : 1102-system_server : PMS:performDexOpt:com.mediatek.duraspeed
117235.186740 : 1220-QkSp_performDex : PMS:performDexOpt:com.mediatek.duraspeed
117246.485279 : 1102-system_server : PMS:performDexOpt:com.android.keychain
117249.713664 : 1220-QkSp_performDex : PMS:performDexOpt:com.android.keychain
117297.598433 : 1102-system_server : PMS:performDexOpt:com.qiku.cardmanager2
117299.536048 : 1220-QkSp_performDex : PMS:performDexOpt:com.qiku.cardmanager2
117312.726818 : 1102-system_server : PMS:performDexOpt:com.android.osfota
117315.795048 : 1220-QkSp_performDex : PMS:performDexOpt:com.android.osfota
117323.138895 : 1102-system_server : PMS:performDexOpt:com.mediatek.thermalmanager
117325.636664 : 1220-QkSp_performDex : PMS:performDexOpt:com.mediatek.thermalmanager
117668.021511 : 1102-system_server : PMS:performDexOpt:com.mtk.telephony
117670.370665 : 1220-QkSp_performDex : PMS:performDexOpt:com.mtk.telephony
118040.469589 : 1102-system_server : PMS:performDexOpt:com.mediatek.mdmconfig
118042.794819 : 1220-QkSp_performDex : PMS:performDexOpt:com.mediatek.mdmconfig
118084.169896 : 1102-system_server : PMS:performDexOpt:com.android.wallpaperbackup
118087.126204 : 1220-QkSp_performDex : PMS:performDexOpt:com.android.wallpaperbackup
118092.179512 : 1102-system_server : PMS:performDexOpt:com.android.bluetooth
118094.256512 : 1220-QkSp_performDex : PMS:performDexOpt:com.android.bluetooth
118103.959358 : 1102-system_server : PMS:performDexOpt:com.android.providers.contacts
118105.985358 : 1220-QkSp_performDex : PMS:performDexOpt:com.android.providers.contacts
121384.339750 : 1102-system_server : AMS:systemReady
122448.832830 : 1102-system_server : AMS:AMS_READY
122579.516061 : 1102-system_server : AP_Init:[service]:[com.android.inputmethod.latin]:[com.android.inputmethod.latin/.LatinIME]:pid:1277
122719.523907 : 1102-system_server : AP_Init:[service]:[com.android.systemui]:[com.android.systemui/.SystemUIService]:pid:1295:(PersistAP)
122876.061677 : 1116-system-server-i : AP_Init:[]:[WebViewLoader-armeabi-v7a]:pid:1309
122913.863677 : 1116-system-server-i : AP_Init:[]:[WebViewLoader-arm64-v8a]:pid:1314
123057.271985 : 1102-system_server : SystemServer:NetworkStatsService systemReady
123279.157293 : 1102-system_server : SystemServer:ConnectivityService systemReady
123379.702217 : 1102-system_server : SystemServer:NetworkPolicyManagerServ systemReady
123814.363448 : 1102-system_server : SystemServer:PhaseThirdPartyAppsCanStart
123848.021064 : 1102-system_server : AP_Init:[added application]:[com.mediatek.ims]:[com.mediatek.ims]:pid:1369:(PersistAP)
123883.222372 : 1102-system_server : AP_Init:[added application]:[com.android.phone]:[com.android.phone]:pid:1374:(PersistAP)
123969.667064 : 1102-system_server : AP_Init:[activity]:[com.android.settings:CryptKeeper]:[com.android.settings/.CryptKeeper]:pid:1397
124048.761141 : 1102-system_server : Android:SysServerInit_END
124375.909604 : 1221-Binder:1102_3 : AP_Init:[activity]:[com.android.settings]:[com.android.settings/.FallbackHome]:pid:1431
125106.392990 : 1118-ActivityManager : AMS:ENABLE_SCREEN
125112.070605 : 1127-android.display : AP_Launch: com.android.settings/.FallbackHome 757ms
130481.581849 : 399-Binder:375_1 : BOOT_Animation:END
130481.626464 : OFF
----------------------------------------
================ END of FILE ===============
ams.ready之后,会调用startHome,fallback启动之后,会调用到activityidle,然后到enalbescreen,最后调用到wms.enablescreen.wms等 keyguard statusbar navigationbar wallpaper绘制完后,退出开机动画,发送boot_complete广播,然后unlockuser会走finish,然后发送unlockuser广播,fallback收到unlock广播就会重新启动launcher,此时launcher就启动了
标签:系统启动,PMS,流程,system,server,1102,performDexOpt,Android,com 来源: https://blog.csdn.net/wd229047557/article/details/80741973