Build DEVICE manifests and fragments for each SKU

Single vendor can support multiple skus with different
capabilities. Add support to define and build sku
based device manifests.

Specify DEVICE manifests in BoardConfig.mk as below.

  # installed to /vendor/etc/vintf/manifest_{sku}.xml
  DEVICE_MANIFEST_SKUS := sku1 sku2 sku3

  DEVICE_MANIFEST_SKU1_FILE := device/foo/bar/manifest_sku1.xml
  DEVICE_MANIFEST_SKU2_FILE := device/foo/bar/manifest_sku2.xml
  DEVICE_MANIFEST_SKU3_FILE := device/foo/bar/manifest_sku3.xml

Bug: 148601741

Change-Id: Id57d4ad21b0d3edf8d60d07446b6b806c1df20ab
This commit is contained in:
Roopesh Nataraja 2020-02-26 18:10:57 -08:00
parent 83315ab6c7
commit 11e776fc32
2 changed files with 38 additions and 0 deletions

View File

@ -1030,6 +1030,7 @@ endef
define auto-included-modules
$(if $(BOARD_VNDK_VERSION),vndk_package) \
$(if $(DEVICE_MANIFEST_FILE),vendor_manifest.xml) \
$(if $(DEVICE_MANIFEST_SKUS),$(foreach sku, $(DEVICE_MANIFEST_SKUS),vendor_manifest_$(sku).xml)) \
$(if $(ODM_MANIFEST_FILES),odm_manifest.xml) \
$(if $(ODM_MANIFEST_SKUS),$(foreach sku, $(ODM_MANIFEST_SKUS),odm_manifest_$(sku).xml)) \

View File

@ -52,6 +52,43 @@ LOCAL_PREBUILT_MODULE_FILE := $(GEN)
include $(BUILD_PREBUILT)
endif
# DEVICE_MANIFEST_SKUS: a list of SKUS where DEVICE_MANIFEST_<sku>_FILE is defined.
ifdef DEVICE_MANIFEST_SKUS
# Install /vendor/etc/vintf/manifest_$(sku).xml
# $(1): sku
define _add_device_sku_manifest
my_fragment_files_var := DEVICE_MANIFEST_$$(call to-upper,$(1))_FILE
ifndef $$(my_fragment_files_var)
$$(error $(1) is in DEVICE_MANIFEST_SKUS but $$(my_fragment_files_var) is not defined)
endif
my_fragment_files := $$($$(my_fragment_files_var))
include $$(CLEAR_VARS)
LOCAL_MODULE := vendor_manifest_$(1).xml
LOCAL_MODULE_STEM := manifest_$(1).xml
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc/vintf
GEN := $$(local-generated-sources-dir)/manifest_$(1).xml
$$(GEN): PRIVATE_SRC_FILES := $$(my_fragment_files)
$$(GEN): $$(my_fragment_files) $$(HOST_OUT_EXECUTABLES)/assemble_vintf
BOARD_SEPOLICY_VERS=$(BOARD_SEPOLICY_VERS) \
PRODUCT_ENFORCE_VINTF_MANIFEST=$(PRODUCT_ENFORCE_VINTF_MANIFEST) \
PRODUCT_SHIPPING_API_LEVEL=$(PRODUCT_SHIPPING_API_LEVEL) \
$$(HOST_OUT_EXECUTABLES)/assemble_vintf -o $$@ \
-i $$(call normalize-path-list,$$(PRIVATE_SRC_FILES))
LOCAL_PREBUILT_MODULE_FILE := $$(GEN)
include $$(BUILD_PREBUILT)
my_fragment_files_var :=
my_fragment_files :=
endef
$(foreach sku, $(DEVICE_MANIFEST_SKUS), $(eval $(call _add_device_sku_manifest,$(sku))))
_add_device_sku_manifest :=
endif # DEVICE_MANIFEST_SKUS
# ODM manifest
ifdef ODM_MANIFEST_FILES
# ODM_MANIFEST_FILES is a list of files that is combined and installed as the default ODM manifest.