主要涉及的模块:
- recovery,A/B system下recovery进程调用update_engine_sideload可执行程序进行升级。
- update_engine_sideload,调用bootcontrol服务设置AB系统状态
- bootcontrol服务
- update_verifier服务
设备进入recovery模式调用update_engine_sideload的流程:
bsp/bootable/recovery/recovery.cpp
bsp/bootable/recovery/install.cpp
status = install_package(update_package, &should_wipe_cache, TEMPORARY_INSTALL_FILE, true,
retry_count);
if (status == INSTALL_SUCCESS && should_wipe_cache) {
wipe_cache(false, device);
}
result = really_install_package(path, wipe_cache, needs_mount, &log_buffer, retry_count,
&max_temperature);
int result = try_update_binary(path, zip, wipe_cache, log_buffer, retry_count, max_temperature);
如果系统支持AB_OTA_UPDATER,则使用update_engine_sideload升级,非AB_OTA升级使用update-binary
#ifdef AB_OTA_UPDATER
int ret = update_binary_command(package, zip, "/sbin/update_engine_sideload", retry_count,
pipefd[1], &args);
#else
int ret = update_binary_command(package, zip, "/tmp/update-binary", retry_count, pipefd[1],
&args);
#endif
update_engine_sideload调用bootcontrol
bsp/system/update_engine/sideload_main.cc
bsp/system/update_engine/boot_control_recovery.cc
bsp/system/update_engine/binder_service_android.cc
bootcontrol服务
bsp/hardware/interfaces/boot/1.0/default/android.hardware.boot@1.0-service.rc
bsp/hardware/interfaces/boot/1.0/default/BootControl.cpp
service vendor.boot-hal-1-0 /vendor/bin/hw/android.hardware.boot@1.0-service
class early_hal
user root
group root
update_verifier服务
bsp/bootable/recovery/update_verifier.cpp
bsp/bootable/recovery/update_verifier.rc
service update_verifier_nonencrypted /system/bin/update_verifier nonencrypted
user root
group cache system
priority -20
ioprio rt 0
service update_verifier /system/bin/update_verifier ${vold.decrypt}
user root
group cache system
priority -20
ioprio rt 0
bsp/system/core/rootdir/init.rc
on zygote-start && property:ro.crypto.state=unencrypted
# A/B update verifier that marks a successful boot.
exec_start update_verifier_nonencrypted
start netd
start zygote
start zygote_secondary
on zygote-start && property:ro.crypto.state=unsupported
# A/B update verifier that marks a successful boot.
exec_start update_verifier_nonencrypted
start netd
start zygote
start zygote_secondary
on zygote-start && property:ro.crypto.state=encrypted && property:ro.crypto.type=file
# A/B update verifier that marks a successful boot.
exec_start update_verifier_nonencrypted
start netd
start zygote
start zygote_secondary
on property:vold.decrypt=trigger_restart_min_framework
# A/B update verifier that marks a successful boot.
exec_start update_verifier
class_start main
on property:vold.decrypt=trigger_restart_framework
stop surfaceflinger
start surfaceflinger
# A/B update verifier that marks a successful boot.
exec_start update_verifier
class_start main
class_start late_start