Support per-partition settings for os_version AVB props

The value of the AVB properties are parsed by the device
bootloader, which might expect a different format of the value.
Allowing them to have per-device settings.

The default value of those per-partition os_version is
$(PLATFORM_VERSION_LAST_STABLE), which is usually an integer,
e.g., 12.

Bug: 211364958
Test: build then `avbtool info_image`
Change-Id: I2005df615c0ff35622030baa2477e29d9d20e94f
This commit is contained in:
Bowgo Tsai 2022-03-30 11:32:32 +08:00
parent 0b7aea6dc5
commit b0f436386f

View file

@ -4032,29 +4032,65 @@ $(if $(BOARD_AVB_RECOVERY_KEY_PATH),,\
endif
endif
# Appends os version and security patch level as a AVB property descriptor
# Appends os version as a AVB property descriptor.
SYSTEM_OS_VERSION ?= $(PLATFORM_VERSION_LAST_STABLE)
BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS += \
--prop com.android.build.system.os_version:$(SYSTEM_OS_VERSION)
PRODUCT_OS_VERSION ?= $(PLATFORM_VERSION_LAST_STABLE)
BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS += \
--prop com.android.build.product.os_version:$(PRODUCT_OS_VERSION)
SYSTEM_EXT_OS_VERSION ?= $(PLATFORM_VERSION_LAST_STABLE)
BOARD_AVB_SYSTEM_EXT_ADD_HASHTREE_FOOTER_ARGS += \
--prop com.android.build.system_ext.os_version:$(SYSTEM_EXT_OS_VERSION)
INIT_BOOT_OS_VERSION ?= $(PLATFORM_VERSION_LAST_STABLE)
BOARD_AVB_INIT_BOOT_ADD_HASH_FOOTER_ARGS += \
--prop com.android.build.init_boot.os_version:$(INIT_BOOT_OS_VERSION)
BOOT_OS_VERSION ?= $(PLATFORM_VERSION_LAST_STABLE)
BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS += \
--prop com.android.build.boot.os_version:$(BOOT_OS_VERSION)
VENDOR_OS_VERSION ?= $(PLATFORM_VERSION_LAST_STABLE)
BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS += \
--prop com.android.build.vendor.os_version:$(VENDOR_OS_VERSION)
ODM_OS_VERSION ?= $(PLATFORM_VERSION_LAST_STABLE)
BOARD_AVB_ODM_ADD_HASHTREE_FOOTER_ARGS += \
--prop com.android.build.odm.os_version:$(ODM_OS_VERSION)
VENDOR_DLKM_OS_VERSION ?= $(PLATFORM_VERSION_LAST_STABLE)
BOARD_AVB_VENDOR_DLKM_ADD_HASHTREE_FOOTER_ARGS += \
--prop com.android.build.vendor_dlkm.os_version:$(VENDOR_DLKM_OS_VERSION)
ODM_DLKM_OS_VERSION ?= $(PLATFORM_VERSION_LAST_STABLE)
BOARD_AVB_ODM_DLKM_ADD_HASHTREE_FOOTER_ARGS += \
--prop com.android.build.odm_dlkm.os_version:$(ODM_DLKM_OS_VERSION)
SYSTEM_DLKM_OS_VERSION ?= $(PLATFORM_VERSION_LAST_STABLE)
BOARD_AVB_SYSTEM_DLKM_ADD_HASHTREE_FOOTER_ARGS += \
--prop com.android.build.system_dlkm.os_version:$(SYSTEM_DLKM_OS_VERSION)
# Appends fingerprint and security patch level as a AVB property descriptor.
BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS += \
--prop com.android.build.system.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \
--prop com.android.build.system.os_version:$(PLATFORM_VERSION_LAST_STABLE) \
--prop com.android.build.system.security_patch:$(PLATFORM_SECURITY_PATCH)
BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS += \
--prop com.android.build.product.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \
--prop com.android.build.product.os_version:$(PLATFORM_VERSION_LAST_STABLE) \
--prop com.android.build.product.security_patch:$(PLATFORM_SECURITY_PATCH)
BOARD_AVB_SYSTEM_EXT_ADD_HASHTREE_FOOTER_ARGS += \
--prop com.android.build.system_ext.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \
--prop com.android.build.system_ext.os_version:$(PLATFORM_VERSION_LAST_STABLE) \
--prop com.android.build.system_ext.security_patch:$(PLATFORM_SECURITY_PATCH)
BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS += \
--prop com.android.build.boot.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE)
BOARD_AVB_INIT_BOOT_ADD_HASH_FOOTER_ARGS += \
--prop com.android.build.init_boot.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \
--prop com.android.build.init_boot.os_version:$(PLATFORM_VERSION_LAST_STABLE)
--prop com.android.build.init_boot.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE)
BOARD_AVB_VENDOR_BOOT_ADD_HASH_FOOTER_ARGS += \
--prop com.android.build.vendor_boot.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \
@ -4066,24 +4102,19 @@ BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS += \
--prop com.android.build.recovery.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE)
BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS += \
--prop com.android.build.vendor.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \
--prop com.android.build.vendor.os_version:$(PLATFORM_VERSION_LAST_STABLE)
--prop com.android.build.vendor.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE)
BOARD_AVB_ODM_ADD_HASHTREE_FOOTER_ARGS += \
--prop com.android.build.odm.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \
--prop com.android.build.odm.os_version:$(PLATFORM_VERSION_LAST_STABLE)
--prop com.android.build.odm.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE)
BOARD_AVB_VENDOR_DLKM_ADD_HASHTREE_FOOTER_ARGS += \
--prop com.android.build.vendor_dlkm.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \
--prop com.android.build.vendor_dlkm.os_version:$(PLATFORM_VERSION_LAST_STABLE)
--prop com.android.build.vendor_dlkm.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE)
BOARD_AVB_ODM_DLKM_ADD_HASHTREE_FOOTER_ARGS += \
--prop com.android.build.odm_dlkm.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \
--prop com.android.build.odm_dlkm.os_version:$(PLATFORM_VERSION_LAST_STABLE)
--prop com.android.build.odm_dlkm.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE)
BOARD_AVB_SYSTEM_DLKM_ADD_HASHTREE_FOOTER_ARGS += \
--prop com.android.build.system_dlkm.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \
--prop com.android.build.system_dlkm.os_version:$(PLATFORM_VERSION_LAST_STABLE)
--prop com.android.build.system_dlkm.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE)
BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS += \
--prop com.android.build.dtbo.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE)
@ -4094,14 +4125,6 @@ BOARD_AVB_PVMFW_ADD_HASH_FOOTER_ARGS += \
# The following vendor- and odm-specific images needs explicit SPL set per board.
# TODO(b/210875415) Is this security_patch property used? Should it be removed from
# boot.img when there is no platform ramdisk included in it?
ifdef BOOT_OS_VERSION
BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS += \
--prop com.android.build.boot.os_version:$(BOOT_OS_VERSION)
else
BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS += \
--prop com.android.build.boot.os_version:$(PLATFORM_VERSION_LAST_STABLE)
endif
ifdef BOOT_SECURITY_PATCH
BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS += \
--prop com.android.build.boot.security_patch:$(BOOT_SECURITY_PATCH)