启动流程分析

开机流程

bootloader 引导系统
内核启动 idle

image.png

image.png

流程图

1726624693646.png

Zygote 启动

Zygote进程相关

image.png

zygote的启动是在 init 进程启动后,解析init.rc文件创建的:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import /system/etc/init/hw/init.${ro.zygote}.rc
#这个里面会根据平台的不同,选择32位,还是64位。
    

# system/core/rootdir/init.zygote64.rc
 service zygote /system/bin/app_process64 -Xzygote /system/bin --zygote --start-system-server --socket-name=zygote
     class main
     priority -20
     user root
     group root readproc reserved_disk
     socket zygote stream 660 root system
     socket usap_pool_primary stream 660 root system
     onrestart exec_background - system system -- /system/bin/vdc volume abort_fuse
     onrestart write /sys/power/state on
     # NOTE: If the wakelock name here is changed, then also
     # update it in SystemSuspend.cpp
     onrestart write /sys/power/wake_lock zygote_kwl
     onrestart restart audioserver
     onrestart restart cameraserver
     onrestart restart media
     onrestart restart media.tuner
     onrestart restart netd
     onrestart restart wificond
     task_profiles ProcessCapacityHigh MaxPerformance
     critical window=${zygote.critical_window.minute:-off} target=zygote-fatal
0%