執行
具有 Android 9 及更低版本且具有 A/B 分區的 Android 裝置可以使用不活動的system_other
分區(例如,當slot_a
處於活動狀態時為system_b
)來儲存預先最佳化的 VDEX/ODEX 檔案。使用system_other
時, ro.cp_system_other_odex
設定為 1,以便套件管理器服務設定sys.cppreopt=requested
以便cppreopts.rc
對其進行操作。
在 Android 10 中,引入了libfs_avb
以支援system_other
分區的獨立 AVB 驗證。此類分區的 VBMeta 結構會附加到分區的末尾,以透過檔案系統中的預期公鑰進行驗證。 Android 建置系統支援對system_other.img
進行簽名,同時在/product/etc/security/avb/system_other.avbpubkey
下包含對應的簽章金鑰。發布工具sign_target_files_apks.py
也支援將簽章金鑰替換為發布版本。
Android 10 先前推出的 A/B 裝置具有實體system_other
分區,即使它已升級至 Android 10 並且PRODUCT_RETROFIT_DYNAMIC_PARTITIONS
設定為true
。
使用 Android 10 啟動的 A/B 裝置必須具有邏輯system_other
分割區。以下範例顯示了在system_other
上啟用 AVB 的典型fstab.postinstall
檔案。
#<dev> <mnt_point> <type> <mnt_flags options> <fs_mgr_flags> system /postinstall ext4 ro,nosuid,nodev,noexec slotselect_other,logical,avb_keys=/product/etc/security/avb/system_other.avbpubkey
需要在system_other
分割區上啟用 AVB 的裝置應將fstab
檔案放置在產品分割區中,並將屬性ro.postinstall.fstab.prefix
設定為/product
。
# Use /product/etc/fstab.postinstall to mount system_other. PRODUCT_PRODUCT_PROPERTIES += \ ro.postinstall.fstab.prefix=/product PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/fstab.postinstall:$(TARGET_COPY_OUT_PRODUCT)/etc/fstab.postinstall