Add check-vintf-all target.
Add target that checks VINTF compatibility of the current build (in $PRODUCT_OUT) properly. The target: - Doesn't require a full build - Won't run for system-only AOSP targets A verbose log is printed if `m check-vintf-compatible` is executed, but it won't show up if `m` is executed. (After this patch, adding product / system_ext matrices is as simple as defining a vintf_compatibility_matrix in Soong, and VINTF compatibility is properly checked.) Test: m check-vintf-all Test: delete */etc/vintf and m check-vintf-all Test: m Test: m check-vintf-all on device with vendor/odm and ODM SKU-specific manifests Test: change manifest.xml to be incompatible and m check-vintf-all fails Bug: 140280874 Bug: 140360109 Change-Id: I6ee79910d745d29cfc9b05b1435e26f91b7c10f7
This commit is contained in:
parent
42f2c761bf
commit
850f8b5d77
100
core/Makefile
100
core/Makefile
|
@ -3635,6 +3635,106 @@ endif # BUILDING_VBMETA_IMAGE
|
|||
|
||||
endif # BOARD_AVB_ENABLE
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# Check VINTF of build
|
||||
|
||||
ifndef TARGET_BUILD_APPS
|
||||
intermediates := $(call intermediates-dir-for,PACKAGING,check_vintf_all)
|
||||
check_vintf_all_deps :=
|
||||
|
||||
# -- Check VINTF compatibility of build.
|
||||
# Skip partial builds; only check full builds. Only check if:
|
||||
# - PRODUCT_ENFORCE_VINTF_MANIFEST is true
|
||||
# - Building system and vendor images
|
||||
# - Building product / system_ext / odm images if board has product / system_ext / odm images
|
||||
ifeq ($(PRODUCT_ENFORCE_VINTF_MANIFEST),true)
|
||||
ifeq ($(BUILDING_SYSTEM_IMAGE),true)
|
||||
ifeq ($(BUILDING_VENDOR_IMAGE),true)
|
||||
ifeq ($(filter true,$(BUILDING_ODM_IMAGE)),$(filter true,$(BOARD_USES_ODMIMAGE)))
|
||||
ifeq ($(filter true,$(BUILDING_PRODUCT_IMAGE)),$(filter true,$(BOARD_USES_PRODUCTIMAGE)))
|
||||
ifeq ($(filter true,$(BUILDING_SYSTEM_EXT_IMAGE)),$(filter true,$(BOARD_USES_SYSTEM_EXTIMAGE)))
|
||||
|
||||
check_vintf_compatible_log := $(intermediates)/check_vintf_compatible_log
|
||||
check_vintf_all_deps += $(check_vintf_compatible_log)
|
||||
|
||||
check_vintf_compatible_args :=
|
||||
check_vintf_compatible_deps :=
|
||||
|
||||
# -- Kernel version and configurations.
|
||||
ifeq ($(PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS),true)
|
||||
|
||||
check_vintf_compatible_args += --kernel $$(cat $(BUILT_KERNEL_VERSION_FILE)):$(BUILT_KERNEL_CONFIGS_FILE)
|
||||
check_vintf_compatible_deps += $(BUILT_KERNEL_CONFIGS_FILE) $(BUILT_KERNEL_VERSION_FILE)
|
||||
|
||||
endif # PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS
|
||||
|
||||
# The build system only writes VINTF metadata to */etc/vintf paths. Legacy paths aren't needed here
|
||||
# because they are only used for prebuilt images.
|
||||
check_vintf_compatible_deps_patterns := \
|
||||
$(TARGET_OUT)/etc/vintf/% \
|
||||
$(TARGET_OUT_VENDOR)/etc/vintf/% \
|
||||
$(TARGET_OUT_ODM)/etc/vintf/% \
|
||||
$(TARGET_OUT_PRODUCT)/etc/vintf/% \
|
||||
$(TARGET_OUT_SYSTEM_EXT)/etc/vintf/% \
|
||||
|
||||
check_vintf_compatible_deps += $(sort $(filter $(check_vintf_compatible_deps_patterns), \
|
||||
$(INTERNAL_SYSTEMIMAGE_FILES) \
|
||||
$(INTERNAL_VENDORIMAGE_FILES) \
|
||||
$(INTERNAL_ODMIMAGE_FILES) \
|
||||
$(INTERNAL_PRODUCTIMAGE_FILES) \
|
||||
$(INTERNAL_SYSTEM_EXTIMAGE_FILES) \
|
||||
))
|
||||
check_vintf_compatible_deps_patterns :=
|
||||
|
||||
check_vintf_compatible_args += \
|
||||
--dirmap /system:$(TARGET_OUT) \
|
||||
--dirmap /vendor:$(TARGET_OUT_VENDOR) \
|
||||
--dirmap /odm:$(TARGET_OUT_ODM) \
|
||||
--dirmap /product:$(TARGET_OUT_PRODUCT) \
|
||||
--dirmap /system_ext:$(TARGET_OUT_SYSTEM_EXT) \
|
||||
|
||||
ifdef PRODUCT_SHIPPING_API_LEVEL
|
||||
check_vintf_compatible_args += --property ro.product.first_api_level=$(PRODUCT_SHIPPING_API_LEVEL)
|
||||
endif # PRODUCT_SHIPPING_API_LEVEL
|
||||
|
||||
$(check_vintf_compatible_log): PRIVATE_CHECK_VINTF_ARGS := $(check_vintf_compatible_args)
|
||||
$(check_vintf_compatible_log): PRIVATE_CHECK_VINTF_DEPS := $(check_vintf_compatible_deps)
|
||||
$(check_vintf_compatible_log): $(HOST_OUT_EXECUTABLES)/checkvintf $(check_vintf_compatible_deps)
|
||||
@echo -n -e 'Deps: \n ' > $@
|
||||
@sed 's/ /\n /g' <<< "$(PRIVATE_CHECK_VINTF_DEPS)" >> $@
|
||||
@echo -n -e 'Args: \n ' >> $@
|
||||
@cat <<< "$(PRIVATE_CHECK_VINTF_ARGS)" >> $@
|
||||
@echo -n -e 'For empty SKU:' >> $@
|
||||
@( $< --check-compat $(PRIVATE_CHECK_VINTF_ARGS) >> $@ 2>&1 ) || ( cat $@ && exit 1 )
|
||||
$(foreach sku,$(ODM_MANIFEST_SKUS), \
|
||||
echo "For SKU = $(sku):" >> $@; \
|
||||
( $< --check-compat $(PRIVATE_CHECK_VINTF_ARGS) \
|
||||
--property ro.boot.product.hardware.sku=$(sku) >> $@ 2>&1 ) || ( cat $@ && exit 1 ); )
|
||||
|
||||
check_vintf_compatible_log :=
|
||||
check_vintf_compatible_args :=
|
||||
check_vintf_compatible_deps :=
|
||||
|
||||
endif # BUILDING_SYSTEM_EXT_IMAGE equals BOARD_USES_SYSTEM_EXTIMAGE
|
||||
endif # BUILDING_PRODUCT_IMAGE equals BOARD_USES_PRODUCTIMAGE
|
||||
endif # BUILDING_ODM_IMAGE equals BOARD_USES_ODMIMAGE
|
||||
endif # BUILDING_VENDOR_IMAGE
|
||||
endif # BUILDING_SYSTEM_IMAGE
|
||||
endif # PRODUCT_ENFORCE_VINTF_MANIFEST
|
||||
|
||||
# Add all logs of VINTF checks to dist builds
|
||||
droid_targets: $(check_vintf_all_deps)
|
||||
$(call dist-for-goals, droid_targets, $(check_vintf_all_deps))
|
||||
|
||||
# Helper alias to check all VINTF of current build.
|
||||
.PHONY: check-vintf-all
|
||||
check-vintf-all: $(check_vintf_all_deps)
|
||||
$(foreach file,$^,echo "$(file)"; cat "$(file)"; echo;)
|
||||
|
||||
check_vintf_all_deps :=
|
||||
intermediates :=
|
||||
endif # !TARGET_BUILD_APPS
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# Check image sizes <= size of super partition
|
||||
|
||||
|
|
Loading…
Reference in New Issue