From 44c9b2e1f4b26e334ced156f7ecd41adbcb81923 Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Tue, 23 Jan 2018 14:34:41 -0800 Subject: [PATCH 1/2] Compatibility matrices: kernel req at each FCM version * devices with Shipping FCM version legacy / O / O-MR1 use 3.18, 4.4, 4.9 * devices with Shipping FCM version P use 4.4 4.9 Bug: 72389707 Test: manual inspection on $OUT/system/etc/vintf/compatibility_matrix.*.xml Change-Id: I4f37325c0210f88e9e6d3e7136a82d50da3e93fe --- compatibility_matrices/Android.mk | 125 ++++++------------ .../compatibility_matrix.mk | 87 ++++++++++++ 2 files changed, 127 insertions(+), 85 deletions(-) create mode 100644 compatibility_matrices/compatibility_matrix.mk diff --git a/compatibility_matrices/Android.mk b/compatibility_matrices/Android.mk index 2a01480b41..e876b3d10f 100644 --- a/compatibility_matrices/Android.mk +++ b/compatibility_matrices/Android.mk @@ -16,123 +16,78 @@ LOCAL_PATH := $(call my-dir) +BUILD_FRAMEWORK_COMPATIBILITY_MATRIX := $(LOCAL_PATH)/compatibility_matrix.mk + +# Clear potential input variables to BUILD_FRAMEWORK_COMPATIBILITY_MATRIX +LOCAL_ADD_VBMETA_VERSION := +LOCAL_ASSEMBLE_VINTF_ENV_VARS := +LOCAL_ASSEMBLE_VINTF_FLAGS := +LOCAL_KERNEL_VERSIONS := +LOCAL_GEN_FILE_DEPENDENCIES := + # Install all compatibility_matrix.*.xml to /system/etc/vintf + include $(CLEAR_VARS) -LOCAL_MODULE := framework_compatibility_matrix.legacy.xml LOCAL_MODULE_STEM := compatibility_matrix.legacy.xml LOCAL_SRC_FILES := $(LOCAL_MODULE_STEM) -LOCAL_MODULE_CLASS := ETC -LOCAL_MODULE_PATH := $(TARGET_OUT)/etc/vintf -include $(BUILD_PREBUILT) +LOCAL_KERNEL_VERSIONS := 3.18 4.4 4.9 +include $(BUILD_FRAMEWORK_COMPATIBILITY_MATRIX) include $(CLEAR_VARS) -LOCAL_MODULE := framework_compatibility_matrix.1.xml LOCAL_MODULE_STEM := compatibility_matrix.1.xml LOCAL_SRC_FILES := $(LOCAL_MODULE_STEM) -LOCAL_MODULE_CLASS := ETC -LOCAL_MODULE_PATH := $(TARGET_OUT)/etc/vintf -include $(BUILD_PREBUILT) +LOCAL_KERNEL_VERSIONS := 3.18 4.4 4.9 +include $(BUILD_FRAMEWORK_COMPATIBILITY_MATRIX) include $(CLEAR_VARS) -LOCAL_MODULE := framework_compatibility_matrix.2.xml LOCAL_MODULE_STEM := compatibility_matrix.2.xml LOCAL_SRC_FILES := $(LOCAL_MODULE_STEM) -LOCAL_MODULE_CLASS := ETC -LOCAL_MODULE_PATH := $(TARGET_OUT)/etc/vintf -include $(BUILD_PREBUILT) +LOCAL_KERNEL_VERSIONS := 3.18 4.4 4.9 +include $(BUILD_FRAMEWORK_COMPATIBILITY_MATRIX) + +# TODO(b/72409164): STOPSHIP: update kernel version requirements include $(CLEAR_VARS) -LOCAL_MODULE := framework_compatibility_matrix.current.xml LOCAL_MODULE_STEM := compatibility_matrix.current.xml LOCAL_SRC_FILES := $(LOCAL_MODULE_STEM) -LOCAL_MODULE_CLASS := ETC -LOCAL_MODULE_PATH := $(TARGET_OUT)/etc/vintf -include $(BUILD_PREBUILT) +LOCAL_KERNEL_VERSIONS := 4.4 4.9 +include $(BUILD_FRAMEWORK_COMPATIBILITY_MATRIX) + +# Framework Compatibility Matrix (common to all FCM versions) -# Framework Compatibility Matrix without HALs include $(CLEAR_VARS) -LOCAL_MODULE := framework_compatibility_matrix.empty.xml -LOCAL_MODULE_STEM := compatibility_matrix.empty.xml -LOCAL_MODULE_CLASS := ETC -LOCAL_MODULE_PATH := $(TARGET_OUT)/etc/vintf +LOCAL_MODULE_STEM := compatibility_matrix.empty.xml +LOCAL_SRC_FILES := $(LOCAL_MODULE_STEM) +LOCAL_ADD_VBMETA_VERSION := true +LOCAL_ASSEMBLE_VINTF_ENV_VARS := \ + POLICYVERS \ + BOARD_SEPOLICY_VERS -GEN := $(local-generated-sources-dir)/$(LOCAL_MODULE_STEM) - -$(GEN): PRIVATE_FLAGS := - -ifeq (true,$(BOARD_AVB_ENABLE)) -$(GEN): $(AVBTOOL) -# INTERNAL_AVB_SYSTEM_SIGNING_ARGS consists of BOARD_AVB_SYSTEM_KEY_PATH and -# BOARD_AVB_SYSTEM_ALGORITHM. We should add the dependency of key path, which -# is a file, here. -$(GEN): $(BOARD_AVB_SYSTEM_KEY_PATH) -# Use deferred assignment (=) instead of immediate assignment (:=). -# Otherwise, cannot get INTERNAL_AVB_SYSTEM_SIGNING_ARGS. -$(GEN): FRAMEWORK_VBMETA_VERSION = $$("$(AVBTOOL)" add_hashtree_footer \ - --print_required_libavb_version \ - $(INTERNAL_AVB_SYSTEM_SIGNING_ARGS) \ - $(BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS)) -else -$(GEN): FRAMEWORK_VBMETA_VERSION := 0.0 -endif - -# Specify kernel versions that the current framework supports. These versions, -# along with kernel configurations, are written to the framework compatibility -# matrix. -$(GEN): KERNEL_VERSIONS := 3.18 4.4 4.9 - -# Specify the location of android-base*.cfg files. -$(GEN): KERNEL_CONFIG_DATA := kernel/configs - -$(GEN): $(foreach version,$(KERNEL_VERSIONS),\ - $(wildcard $(KERNEL_CONFIG_DATA)/android-$(version)/android-base*.cfg)) -$(GEN): PRIVATE_FLAGS += $(foreach version,$(KERNEL_VERSIONS),\ - --kernel=$(version):$(call normalize-path-list,\ - $(wildcard $(KERNEL_CONFIG_DATA)/android-$(version)/android-base*.cfg))) - -$(GEN): $(LOCAL_PATH)/compatibility_matrix.empty.xml $(HOST_OUT_EXECUTABLES)/assemble_vintf - POLICYVERS=$(POLICYVERS) \ - BOARD_SEPOLICY_VERS=$(BOARD_SEPOLICY_VERS) \ - FRAMEWORK_VBMETA_VERSION=$(FRAMEWORK_VBMETA_VERSION) \ - $(HOST_OUT_EXECUTABLES)/assemble_vintf \ - -i $< -o $@ $(PRIVATE_FLAGS) -LOCAL_PREBUILT_MODULE_FILE := $(GEN) -include $(BUILD_PREBUILT) +include $(BUILD_FRAMEWORK_COMPATIBILITY_MATRIX) # Framework Compatibility Matrix -include $(CLEAR_VARS) -LOCAL_MODULE := framework_compatibility_matrix.xml -LOCAL_MODULE_STEM := compatibility_matrix.xml -LOCAL_MODULE_CLASS := ETC -LOCAL_MODULE_PATH := $(TARGET_OUT) +include $(CLEAR_VARS) +LOCAL_MODULE := framework_compatibility_matrix.xml +LOCAL_MODULE_STEM := compatibility_matrix.xml +LOCAL_MODULE_PATH := $(TARGET_OUT) LOCAL_REQUIRED_MODULES := \ framework_compatibility_matrix.legacy.xml \ framework_compatibility_matrix.1.xml \ framework_compatibility_matrix.2.xml \ framework_compatibility_matrix.current.xml \ framework_compatibility_matrix.empty.xml - -GEN := $(local-generated-sources-dir)/compatibility_matrix.xml - -$(GEN): PRIVATE_FLAGS := +LOCAL_GENERATED_SOURCES := $(call module-installed-files,$(LOCAL_REQUIRED_MODULES)) ifdef BUILT_VENDOR_MANIFEST -$(GEN): $(BUILT_VENDOR_MANIFEST) -$(GEN): PRIVATE_FLAGS += -c "$(BUILT_VENDOR_MANIFEST)" +LOCAL_GEN_FILE_DEPENDENCIES += $(BUILT_VENDOR_MANIFEST) +LOCAL_ASSEMBLE_VINTF_FLAGS += -c "$(BUILT_VENDOR_MANIFEST)" endif -MATRIX_SRC_FILES := $(call module-installed-files,$(LOCAL_REQUIRED_MODULES)) -$(GEN): PRIVATE_MATRIX_SRC_FILES := $(MATRIX_SRC_FILES) -$(GEN): $(MATRIX_SRC_FILES) $(HOST_OUT_EXECUTABLES)/assemble_vintf - PRODUCT_ENFORCE_VINTF_MANIFEST=$(PRODUCT_ENFORCE_VINTF_MANIFEST) \ - $(HOST_OUT_EXECUTABLES)/assemble_vintf \ - -i $(call normalize-path-list,$(PRIVATE_MATRIX_SRC_FILES)) \ - -o $@ $(PRIVATE_FLAGS) +LOCAL_ASSEMBLE_VINTF_ENV_VARS := PRODUCT_ENFORCE_VINTF_MANIFEST -MATRIX_SRC_FILES := - -LOCAL_PREBUILT_MODULE_FILE := $(GEN) -include $(BUILD_PREBUILT) +include $(BUILD_FRAMEWORK_COMPATIBILITY_MATRIX) BUILT_SYSTEM_COMPATIBILITY_MATRIX := $(LOCAL_BUILT_MODULE) + +BUILD_FRAMEWORK_COMPATIBILITY_MATRIX := diff --git a/compatibility_matrices/compatibility_matrix.mk b/compatibility_matrices/compatibility_matrix.mk new file mode 100644 index 0000000000..90713d49db --- /dev/null +++ b/compatibility_matrices/compatibility_matrix.mk @@ -0,0 +1,87 @@ +# +# Copyright (C) 2018 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +ifndef LOCAL_MODULE_STEM +$(error LOCAL_MODULE_STEM must be defined.) +endif + +LOCAL_MODULE := framework_$(LOCAL_MODULE_STEM) +LOCAL_MODULE_CLASS := ETC + +ifndef LOCAL_MODULE_PATH +LOCAL_MODULE_PATH := $(TARGET_OUT)/etc/vintf +endif + +GEN := $(local-generated-sources-dir)/$(LOCAL_MODULE_STEM) + +$(GEN): PRIVATE_ENV_VARS := $(LOCAL_ASSEMBLE_VINTF_ENV_VARS) +$(GEN): PRIVATE_FLAGS := $(LOCAL_ASSEMBLE_VINTF_FLAGS) + +$(GEN): $(LOCAL_GEN_FILE_DEPENDENCIES) + +ifeq (true,$(strip $(LOCAL_ADD_VBMETA_VERSION))) +ifeq (true,$(BOARD_AVB_ENABLE)) +$(GEN): $(AVBTOOL) +# INTERNAL_AVB_SYSTEM_SIGNING_ARGS consists of BOARD_AVB_SYSTEM_KEY_PATH and +# BOARD_AVB_SYSTEM_ALGORITHM. We should add the dependency of key path, which +# is a file, here. +$(GEN): $(BOARD_AVB_SYSTEM_KEY_PATH) +# Use deferred assignment (=) instead of immediate assignment (:=). +# Otherwise, cannot get INTERNAL_AVB_SYSTEM_SIGNING_ARGS. +$(GEN): FRAMEWORK_VBMETA_VERSION = $$("$(AVBTOOL)" add_hashtree_footer \ + --print_required_libavb_version \ + $(INTERNAL_AVB_SYSTEM_SIGNING_ARGS) \ + $(BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS)) +else +$(GEN): FRAMEWORK_VBMETA_VERSION := 0.0 +endif # BOARD_AVB_ENABLE +$(GEN): PRIVATE_ENV_VARS += FRAMEWORK_VBMETA_VERSION +endif # LOCAL_ADD_VBMETA_VERSION + +ifneq (,$(strip $(LOCAL_KERNEL_VERSIONS))) +$(GEN): PRIVATE_KERNEL_CONFIG_DATA := kernel/configs +$(GEN): PRIVATE_KERNEL_VERSIONS := $(LOCAL_KERNEL_VERSIONS) +$(GEN): $(foreach version,$(PRIVATE_KERNEL_VERSIONS),\ + $(wildcard $(PRIVATE_KERNEL_CONFIG_DATA)/android-$(version)/android-base*.cfg)) +$(GEN): PRIVATE_FLAGS += $(foreach version,$(PRIVATE_KERNEL_VERSIONS),\ + --kernel=$(version):$(call normalize-path-list,\ + $(wildcard $(PRIVATE_KERNEL_CONFIG_DATA)/android-$(version)/android-base*.cfg))) +endif + +my_matrix_src_files := \ + $(addprefix $(LOCAL_PATH)/,$(LOCAL_SRC_FILES)) \ + $(LOCAL_GENERATED_SOURCES) + +$(GEN): PRIVATE_SRC_FILES := $(my_matrix_src_files) +$(GEN): $(my_matrix_src_files) $(HOST_OUT_EXECUTABLES)/assemble_vintf + $(foreach varname,$(PRIVATE_ENV_VARS),$(varname)=$($(varname))) \ + $(HOST_OUT_EXECUTABLES)/assemble_vintf \ + -i $(call normalize-path-list,$(PRIVATE_SRC_FILES)) \ + -o $@ \ + $(PRIVATE_FLAGS) + +LOCAL_PREBUILT_MODULE_FILE := $(GEN) +LOCAL_SRC_FILES := +LOCAL_GENERATED_SOURCES := + +LOCAL_ADD_VBMETA_VERSION := +LOCAL_ASSEMBLE_VINTF_ENV_VARS := +LOCAL_ASSEMBLE_VINTF_FLAGS := +LOCAL_KERNEL_VERSIONS := +LOCAL_GEN_FILE_DEPENDENCIES := +my_matrix_src_files := + +include $(BUILD_PREBUILT) From 94b7d2ca19e816ccc68aba11d91e0bf54bf5fc86 Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Tue, 23 Jan 2018 15:38:49 -0800 Subject: [PATCH 2/2] Compatibility matrices: add minor revision to kernel versions Test: builds Bug: 72388844 Change-Id: Id60cef10610f39d70eebccbeb6e625e3d93795c6 --- compatibility_matrices/Android.mk | 8 ++++---- compatibility_matrices/compatibility_matrix.mk | 17 +++++++++++++++-- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/compatibility_matrices/Android.mk b/compatibility_matrices/Android.mk index e876b3d10f..1c86f11081 100644 --- a/compatibility_matrices/Android.mk +++ b/compatibility_matrices/Android.mk @@ -31,19 +31,19 @@ LOCAL_GEN_FILE_DEPENDENCIES := include $(CLEAR_VARS) LOCAL_MODULE_STEM := compatibility_matrix.legacy.xml LOCAL_SRC_FILES := $(LOCAL_MODULE_STEM) -LOCAL_KERNEL_VERSIONS := 3.18 4.4 4.9 +LOCAL_KERNEL_VERSIONS := 3.18.0 4.4.0 4.9.0 include $(BUILD_FRAMEWORK_COMPATIBILITY_MATRIX) include $(CLEAR_VARS) LOCAL_MODULE_STEM := compatibility_matrix.1.xml LOCAL_SRC_FILES := $(LOCAL_MODULE_STEM) -LOCAL_KERNEL_VERSIONS := 3.18 4.4 4.9 +LOCAL_KERNEL_VERSIONS := 3.18.0 4.4.0 4.9.0 include $(BUILD_FRAMEWORK_COMPATIBILITY_MATRIX) include $(CLEAR_VARS) LOCAL_MODULE_STEM := compatibility_matrix.2.xml LOCAL_SRC_FILES := $(LOCAL_MODULE_STEM) -LOCAL_KERNEL_VERSIONS := 3.18 4.4 4.9 +LOCAL_KERNEL_VERSIONS := 3.18.0 4.4.0 4.9.0 include $(BUILD_FRAMEWORK_COMPATIBILITY_MATRIX) # TODO(b/72409164): STOPSHIP: update kernel version requirements @@ -51,7 +51,7 @@ include $(BUILD_FRAMEWORK_COMPATIBILITY_MATRIX) include $(CLEAR_VARS) LOCAL_MODULE_STEM := compatibility_matrix.current.xml LOCAL_SRC_FILES := $(LOCAL_MODULE_STEM) -LOCAL_KERNEL_VERSIONS := 4.4 4.9 +LOCAL_KERNEL_VERSIONS := 4.4.0 4.9.0 include $(BUILD_FRAMEWORK_COMPATIBILITY_MATRIX) # Framework Compatibility Matrix (common to all FCM versions) diff --git a/compatibility_matrices/compatibility_matrix.mk b/compatibility_matrices/compatibility_matrix.mk index 90713d49db..14c60ab972 100644 --- a/compatibility_matrices/compatibility_matrix.mk +++ b/compatibility_matrices/compatibility_matrix.mk @@ -14,6 +14,17 @@ # limitations under the License. # +########################################################### +## Remove minor revision from a kernel version. For example, +## 3.18.0 becomes 3.18. +## $(1): kernel version +########################################################### +define remove-minor-revision +$(strip $(subst $(space),.,$(wordlist 1,2,$(subst .,$(space),$(strip $(1)))))) +endef + +# $(warning $(call remove-minor-revision,3.18.0)) + ifndef LOCAL_MODULE_STEM $(error LOCAL_MODULE_STEM must be defined.) endif @@ -55,10 +66,10 @@ ifneq (,$(strip $(LOCAL_KERNEL_VERSIONS))) $(GEN): PRIVATE_KERNEL_CONFIG_DATA := kernel/configs $(GEN): PRIVATE_KERNEL_VERSIONS := $(LOCAL_KERNEL_VERSIONS) $(GEN): $(foreach version,$(PRIVATE_KERNEL_VERSIONS),\ - $(wildcard $(PRIVATE_KERNEL_CONFIG_DATA)/android-$(version)/android-base*.cfg)) + $(wildcard $(PRIVATE_KERNEL_CONFIG_DATA)/android-$(call remove-minor-revision,$(version))/android-base*.cfg)) $(GEN): PRIVATE_FLAGS += $(foreach version,$(PRIVATE_KERNEL_VERSIONS),\ --kernel=$(version):$(call normalize-path-list,\ - $(wildcard $(PRIVATE_KERNEL_CONFIG_DATA)/android-$(version)/android-base*.cfg))) + $(wildcard $(PRIVATE_KERNEL_CONFIG_DATA)/android-$(call remove-minor-revision,$(version))/android-base*.cfg))) endif my_matrix_src_files := \ @@ -85,3 +96,5 @@ LOCAL_GEN_FILE_DEPENDENCIES := my_matrix_src_files := include $(BUILD_PREBUILT) + +remove-minor-revision :=