Build DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE.

DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE is installed on
/product/etc/vintf. It is considered as a replacement of
DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE, so only one
of them may be defined. At build time, things like
SEPolicy versions etc. will be written to
/product/etc/vintf/compatibility_matrix.device.xml, just
like the /system one.

Also, split framework_compatibitity_matrix.xml to
system_compatibility_matrix.xml and product_compatibility_matrix.xml.
The latter two corresponds to matrices installed to respective
partitions only.

Test: build with DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE defined
Test: boot (sanity)
Bug: 120600021
Change-Id: I81f9a8f5028cbb88c45f44df04bccb8ccb483972
This commit is contained in:
Yifan Hong
2019-01-22 14:27:50 -08:00
parent 7224c5dc1c
commit fee037aac8
3 changed files with 102 additions and 11 deletions

View File

@@ -17,8 +17,9 @@
LOCAL_PATH := $(call my-dir)
BUILD_FRAMEWORK_COMPATIBILITY_MATRIX := $(LOCAL_PATH)/compatibility_matrix.mk
my_empty_manifest := $(LOCAL_PATH)/manifest.empty.xml
# Framework Compatibility Matrix (common to all FCM versions)
# System Compatibility Matrix (common to all FCM versions)
include $(CLEAR_VARS)
include $(LOCAL_PATH)/clear_vars.mk
@@ -26,6 +27,7 @@ LOCAL_MODULE := framework_compatibility_matrix.device.xml
LOCAL_MODULE_STEM := compatibility_matrix.device.xml
# define LOCAL_MODULE_CLASS for local-generated-sources-dir.
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_RELATIVE_PATH := vintf
ifndef DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE
LOCAL_SRC_FILES := compatibility_matrix.empty.xml
@@ -37,10 +39,9 @@ LOCAL_GENERATED_SOURCES := $(DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE)
# Enforce that DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE does not specify required HALs
# by checking it against an empty manifest. But the empty manifest needs to contain
# BOARD_SEPOLICY_VERS to be compatible with DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE.
my_manifest_src_file := $(LOCAL_PATH)/manifest.empty.xml
my_gen_check_manifest := $(local-generated-sources-dir)/manifest.check.xml
$(my_gen_check_manifest): PRIVATE_SRC_FILE := $(my_manifest_src_file)
$(my_gen_check_manifest): $(my_manifest_src_file) $(HOST_OUT_EXECUTABLES)/assemble_vintf
$(my_gen_check_manifest): PRIVATE_SRC_FILE := $(my_empty_manifest)
$(my_gen_check_manifest): $(my_empty_manifest) $(HOST_OUT_EXECUTABLES)/assemble_vintf
BOARD_SEPOLICY_VERS=$(BOARD_SEPOLICY_VERS) \
VINTF_IGNORE_TARGET_FCM_VERSION=true \
$(HOST_OUT_EXECUTABLES)/assemble_vintf -i $(PRIVATE_SRC_FILE) -o $@
@@ -49,7 +50,6 @@ LOCAL_GEN_FILE_DEPENDENCIES += $(my_gen_check_manifest)
LOCAL_ASSEMBLE_VINTF_FLAGS += -c "$(my_gen_check_manifest)"
my_gen_check_manifest :=
my_manifest_src_file :=
endif # DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE
@@ -61,18 +61,57 @@ LOCAL_ASSEMBLE_VINTF_ENV_VARS := \
include $(BUILD_FRAMEWORK_COMPATIBILITY_MATRIX)
# Product Compatibility Matrix
include $(CLEAR_VARS)
include $(LOCAL_PATH)/clear_vars.mk
LOCAL_MODULE := product_compatibility_matrix.xml
ifndef DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE
my_framework_matrix_deps :=
include $(BUILD_PHONY_PACKAGE)
else # DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE
LOCAL_MODULE_STEM := compatibility_matrix.xml
LOCAL_PRODUCT_MODULE := true
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_RELATIVE_PATH := vintf
# DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE specify an absolute path
LOCAL_GENERATED_SOURCES := $(DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE)
# Enforce that DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE does not specify required HALs
# by checking it against an empty manifest.
LOCAL_GEN_FILE_DEPENDENCIES += $(my_empty_manifest)
LOCAL_ASSEMBLE_VINTF_FLAGS += -c "$(my_empty_manifest)"
my_framework_matrix_deps := $(LOCAL_MODULE)
include $(BUILD_FRAMEWORK_COMPATIBILITY_MATRIX)
endif # DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE
my_system_matrix_deps := \
framework_compatibility_matrix.legacy.xml \
framework_compatibility_matrix.1.xml \
framework_compatibility_matrix.2.xml \
framework_compatibility_matrix.3.xml \
framework_compatibility_matrix.current.xml \
framework_compatibility_matrix.device.xml
framework_compatibility_matrix.device.xml \
# Phony target that installs all framework compatibility matrix files
my_framework_matrix_deps += \
$(my_system_matrix_deps)
# Phony target that installs all system compatibility matrix files
include $(CLEAR_VARS)
LOCAL_MODULE := system_compatibility_matrix.xml
LOCAL_REQUIRED_MODULES := $(my_system_matrix_deps)
include $(BUILD_PHONY_PACKAGE)
# Phony target that installs all framework compatibility matrix files (system + product)
include $(CLEAR_VARS)
LOCAL_MODULE := framework_compatibility_matrix.xml
LOCAL_REQUIRED_MODULES := $(my_system_matrix_deps)
LOCAL_REQUIRED_MODULES := $(my_framework_matrix_deps)
include $(BUILD_PHONY_PACKAGE)
# Final Framework Compatibility Matrix for OTA
@@ -80,7 +119,7 @@ include $(CLEAR_VARS)
include $(LOCAL_PATH)/clear_vars.mk
LOCAL_MODULE := verified_assembled_system_matrix.xml
LOCAL_MODULE_PATH := $(PRODUCT_OUT)
LOCAL_REQUIRED_MODULES := $(my_system_matrix_deps)
LOCAL_REQUIRED_MODULES := $(my_framework_matrix_deps)
LOCAL_GENERATED_SOURCES := $(call module-installed-files,$(LOCAL_REQUIRED_MODULES))
LOCAL_ADD_VBMETA_VERSION_OVERRIDE := true
@@ -97,4 +136,6 @@ include $(BUILD_FRAMEWORK_COMPATIBILITY_MATRIX)
BUILT_SYSTEM_MATRIX := $(LOCAL_BUILT_MODULE)
my_system_matrix_deps :=
my_framework_matrix_deps :=
my_empty_manifest :=
BUILD_FRAMEWORK_COMPATIBILITY_MATRIX :=