Android9.0 A / BシステムはSDカードのアップグレードプロセスを使用しています

主に関連するモジュール:

  • リカバリ、A / Bシステムのリカバリプロセスは、update_engine_sideload実行可能プログラムを呼び出してアップグレードします。
  • update_engine_sideload、bootcontrolサービスを呼び出してABシステムステータスを設定します
  • ブートコントロールサービス
  • update_verifierサービス

デバイスがリカバリモードに入ったときに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

ブートコントロールサービス

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

おすすめ

転載: blog.csdn.net/weixin_44991625/article/details/105732270
おすすめ