From b7735d81054002961b681f4bdf296d4de2701135 Mon Sep 17 00:00:00 2001 From: Jaekyun Seok Date: Mon, 27 Nov 2017 17:04:47 +0900 Subject: [PATCH] Support /product partition This CL adds the following build flags to support building product partition from Android build system. - BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS - BOARD_AVB_PRODUCT_KEY_PATH - BOARD_AVB_PRODUCT_ALGORITHM - BOARD_AVB_PRODUCT_ROLLBACK_INDEX_LOCATION - BOARD_PREBUILT_PRODUCTIMAGE - BOARD_PRODUCTIMAGE_EXTFS_INODE_COUNT - BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE - BOARD_PRODUCTIMAGE_PARTITION_SIZE - BOARD_PRODUCTIMAGE_SQUASHFS_BLOCK_SIZE - BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR - BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR_OPT - BOARD_PRODUCTIMAGE_SQUASHFS_DISABLE_4K_ALIGN - BOARD_USES_PRODUCTIMAGE - LOCAL_PRODUCT_MODULE - PRODUCT_FOOTER_ARGS - PRODUCT_PRODUCT_BASE_FS_PATH - PRODUCT_PRODUCT_VERITY_PARTITION - TARGET_COPY_OUT_PRODUCT - TARGET_OUT_PRODUCT* And PRODUCT_PRODUCT_PROPERTIES is added to save product-specific properties in /product/build.prop. Bug: 64195575 Test: succeeded building product.img with BOARD_PRODUCTIMAGE_PARTITION_SIZE, BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE and PRODUCT_PRODUCT_VERITY_PARTITION. Change-Id: I774e6a38003734421591e51bed103802ff84f432 --- core/Makefile | 164 +++++++++++++++++- core/base_rules.mk | 4 + core/clear_vars.mk | 1 + core/config.mk | 1 + core/envsetup.mk | 68 ++++++++ core/main.mk | 6 + core/package_internal.mk | 2 + core/product-graph.mk | 1 + core/product.mk | 5 + core/product_config.mk | 7 + core/soong_config.mk | 2 +- help.sh | 2 + tools/releasetools/add_img_to_target_files.py | 31 +++- tools/releasetools/build_image.py | 18 ++ tools/releasetools/common.py | 2 +- 15 files changed, 305 insertions(+), 9 deletions(-) diff --git a/core/Makefile b/core/Makefile index 7aa10198d4..39969bce3e 100644 --- a/core/Makefile +++ b/core/Makefile @@ -423,6 +423,32 @@ ifdef property_overrides_split_enabled $(hide) build/make/tools/post_process_props.py $@ endif # property_overrides_split_enabled +# ----------------------------------------------------------------- +# product build.prop +INSTALLED_PRODUCT_BUILD_PROP_TARGET := $(TARGET_OUT_PRODUCT)/build.prop +ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_PRODUCT_BUILD_PROP_TARGET) + +FINAL_PRODUCT_PROPERTIES += \ + $(call collapse-pairs, $(PRODUCT_PRODUCT_PROPERTIES)) +FINAL_PRODUCT_PROPERTIES := $(call uniq-pairs-by-first-component, \ + $(FINAL_PRODUCT_PROPERTIES),=) + +$(INSTALLED_PRODUCT_BUILD_PROP_TARGET): + @echo Target product buildinfo: $@ + @mkdir -p $(dir $@) + $(hide) echo > $@ +ifdef BOARD_USES_PRODUCTIMAGE + $(hide) echo ro.product.build.date=`$(DATE_FROM_FILE)`>>$@ + $(hide) echo ro.product.build.date.utc=`$(DATE_FROM_FILE) +%s`>>$@ + $(hide) echo ro.product.build.fingerprint="$(BUILD_FINGERPRINT_FROM_FILE)">>$@ +endif # BOARD_USES_PRODUCTIMAGE + $(hide) echo "#" >> $@; \ + echo "# ADDITIONAL PRODUCT PROPERTIES" >> $@; \ + echo "#" >> $@; + $(hide) $(foreach line,$(FINAL_PRODUCT_PROPERTIES), \ + echo "$(line)" >> $@;) + $(hide) build/make/tools/post_process_props.py $@ + # ---------------------------------------------------------------- # ----------------------------------------------------------------- @@ -1013,7 +1039,7 @@ endif ifneq (true,$(TARGET_USERIMAGES_SPARSE_SQUASHFS_DISABLED)) INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG := -s endif -ifneq ($(filter $(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE) $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE),squashfs),) +ifneq ($(filter $(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE) $(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE) $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE),squashfs),) INTERNAL_USERIMAGES_DEPS += $(MAKE_SQUASHFS) $(MKSQUASHFSUSERIMG) $(IMG2SIMG) endif @@ -1066,6 +1092,15 @@ $(if $(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "vendor_squashfs_ $(if $(BOARD_VENDORIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "vendor_squashfs_block_size=$(BOARD_VENDORIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1)) $(if $(BOARD_VENDORIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "vendor_squashfs_disable_4k_align=$(BOARD_VENDORIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1)) $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH),$(hide) echo "vendor_base_fs_file=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH)" >> $(1)) +$(if $(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "product_fs_type=$(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE)" >> $(1)) +$(if $(BOARD_PRODUCTIMAGE_EXTFS_INODE_COUNT),$(hide) echo "product_extfs_inode_count=$(BOARD_PRODUCTIMAGE_EXTFS_INODE_COUNT)" >> $(1)) +$(if $(BOARD_PRODUCTIMAGE_PARTITION_SIZE),$(hide) echo "product_size=$(BOARD_PRODUCTIMAGE_PARTITION_SIZE)" >> $(1)) +$(if $(BOARD_PRODUCTIMAGE_JOURNAL_SIZE),$(hide) echo "product_journal_size=$(BOARD_PRODUCTIMAGE_JOURNAL_SIZE)" >> $(1)) +$(if $(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "product_squashfs_compressor=$(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR)" >> $(1)) +$(if $(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "product_squashfs_compressor_opt=$(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1)) +$(if $(BOARD_PRODUCTIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "product_squashfs_block_size=$(BOARD_PRODUCTIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1)) +$(if $(BOARD_PRODUCTIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "product_squashfs_disable_4k_align=$(BOARD_PRODUCTIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1)) +$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH),$(hide) echo "product_base_fs_file=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH)" >> $(1)) $(if $(BOARD_OEMIMAGE_PARTITION_SIZE),$(hide) echo "oem_size=$(BOARD_OEMIMAGE_PARTITION_SIZE)" >> $(1)) $(if $(BOARD_OEMIMAGE_JOURNAL_SIZE),$(hide) echo "oem_journal_size=$(BOARD_OEMIMAGE_JOURNAL_SIZE)" >> $(1)) $(if $(BOARD_OEMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "oem_extfs_inode_count=$(BOARD_OEMIMAGE_EXTFS_INODE_COUNT)" >> $(1)) @@ -1080,6 +1115,7 @@ $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY_FEC),$(hide) echo "v $(if $(filter eng, $(TARGET_BUILD_VARIANT)),$(hide) echo "verity_disable=true" >> $(1)) $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_VERITY_PARTITION),$(hide) echo "system_verity_block_device=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_VERITY_PARTITION)" >> $(1)) $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_VERITY_PARTITION),$(hide) echo "vendor_verity_block_device=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_VERITY_PARTITION)" >> $(1)) +$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_VERITY_PARTITION),$(hide) echo "product_verity_block_device=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_VERITY_PARTITION)" >> $(1)) $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT)" >> $(1)) $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot_key=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_KEY)" >> $(1)) $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot_subkey=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_SUBKEY)" >> $(1)) @@ -1100,6 +1136,13 @@ $(if $(BOARD_AVB_ENABLE),\ $(hide) echo "avb_vendor_key_path=$(BOARD_AVB_VENDOR_KEY_PATH)" >> $(1) $(hide) echo "avb_vendor_algorithm=$(BOARD_AVB_VENDOR_ALGORITHM)" >> $(1) $(hide) echo "avb_vendor_rollback_index_location=$(BOARD_AVB_VENDOR_ROLLBACK_INDEX_LOCATION)" >> $(1))) +$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_product_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1)) +$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_product_add_hashtree_footer_args=$(BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS)" >> $(1)) +$(if $(BOARD_AVB_ENABLE),\ + $(if $(BOARD_AVB_PRODUCT_KEY_PATH),\ + $(hide) echo "avb_product_key_path=$(BOARD_AVB_PRODUCT_KEY_PATH)" >> $(1) + $(hide) echo "avb_product_algorithm=$(BOARD_AVB_PRODUCT_ALGORITHM)" >> $(1) + $(hide) echo "avb_product_rollback_index_location=$(BOARD_AVB_PRODUCT_ROLLBACK_INDEX_LOCATION)" >> $(1))) $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),\ $(hide) echo "recovery_as_boot=true" >> $(1)) $(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)),\ @@ -1151,6 +1194,9 @@ recovery_build_props := $(intermediate_system_build_prop) ifdef property_overrides_split_enabled recovery_build_props += $(INSTALLED_VENDOR_BUILD_PROP_TARGET) endif +ifdef BOARD_USES_PRODUCTIMAGE +recovery_build_props += $(INSTALLED_PRODUCT_BUILD_PROP_TARGET) +endif recovery_resources_common := $(call include-path-for, recovery)/res # Set recovery_density to the density bucket of the device. @@ -1443,10 +1489,26 @@ define create-system-vendor-symlink endef endif +# Create symlink /system/product to /product if necessary. +ifdef BOARD_USES_PRODUCTIMAGE +define create-system-product-symlink +$(hide) if [ -d $(TARGET_OUT)/product ] && [ ! -h $(TARGET_OUT)/product ]; then \ + echo 'Non-symlink $(TARGET_OUT)/product detected!' 1>&2; \ + echo 'You cannot install files to $(TARGET_OUT)/product while building a separate product.img!' 1>&2; \ + exit 1; \ +fi +$(hide) ln -sf /product $(TARGET_OUT)/product +endef +else +define create-system-product-symlink +endef +endif + # $(1): output file define build-systemimage-target @echo "Target system fs image: $(1)" $(call create-system-vendor-symlink) + $(call create-system-product-symlink) @mkdir -p $(dir $(1)) $(systemimage_intermediates) && rm -rf $(systemimage_intermediates)/system_image_info.txt $(call generate-userimage-prop-dictionary, $(systemimage_intermediates)/system_image_info.txt, \ skip_fsck=true) @@ -1521,6 +1583,7 @@ sync: $(INTERNAL_SYSTEMIMAGE_FILES) define build-systemtarball-target $(call pretty,"Target system fs tarball: $(INSTALLED_SYSTEMTARBALL_TARGET)") $(call create-system-vendor-symlink) + $(call create-system-product-symlink) $(MKTARBALL) $(FS_GET_STATS) \ $(PRODUCT_OUT) system $(PRIVATE_SYSTEM_TAR) \ $(INSTALLED_SYSTEMTARBALL_TARGET) $(TARGET_OUT) @@ -1601,6 +1664,10 @@ ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE $(hide) cd $(dir $@) && zip -qryX $(notdir $@) \ $(TARGET_COPY_OUT_VENDOR) endif +ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE + $(hide) cd $(dir $@) && zip -qryX $(notdir $@) \ + $(TARGET_COPY_OUT_PRODUCT) +endif ifneq ($(PDK_PLATFORM_JAVA_ZIP_CONTENTS),) $(hide) cd $(OUT_DIR) && zip -qryX $(patsubst $(OUT_DIR)/%,%,$@) $(PDK_PLATFORM_JAVA_ZIP_CONTENTS) endif @@ -1908,6 +1975,55 @@ INSTALLED_VENDORIMAGE_TARGET := $(PRODUCT_OUT)/vendor.img $(eval $(call copy-one-file,$(BOARD_PREBUILT_VENDORIMAGE),$(INSTALLED_VENDORIMAGE_TARGET))) endif +# ----------------------------------------------------------------- +# product partition image +ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE +INTERNAL_PRODUCTIMAGE_FILES := \ + $(filter $(TARGET_OUT_PRODUCT)/%,\ + $(ALL_DEFAULT_INSTALLED_MODULES)\ + $(ALL_PDK_FUSION_FILES)) + +# platform.zip depends on $(INTERNAL_PRODUCTIMAGE_FILES). +$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_PRODUCTIMAGE_FILES) + +INSTALLED_FILES_FILE_PRODUCT := $(PRODUCT_OUT)/installed-files-product.txt +$(INSTALLED_FILES_FILE_PRODUCT) : $(INTERNAL_PRODUCTIMAGE_FILES) $(FILESLIST) + @echo Installed file list: $@ + @mkdir -p $(dir $@) + @rm -f $@ + $(hide) $(FILESLIST) $(TARGET_OUT_PRODUCT) > $(@:.txt=.json) + $(hide) build/tools/fileslist_util.py -c $(@:.txt=.json) > $@ + +productimage_intermediates := \ + $(call intermediates-dir-for,PACKAGING,product) +BUILT_PRODUCTIMAGE_TARGET := $(PRODUCT_OUT)/product.img +define build-productimage-target + $(call pretty,"Target product fs image: $(INSTALLED_PRODUCTIMAGE_TARGET)") + @mkdir -p $(TARGET_OUT_PRODUCT) + @mkdir -p $(productimage_intermediates) && rm -rf $(productimage_intermediates)/product_image_info.txt + $(call generate-userimage-prop-dictionary, $(productimage_intermediates)/product_image_info.txt, skip_fsck=true) + $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \ + ./build/tools/releasetools/build_image.py \ + $(TARGET_OUT_PRODUCT) $(productimage_intermediates)/product_image_info.txt $(INSTALLED_PRODUCTIMAGE_TARGET) $(TARGET_OUT) + $(hide) $(call assert-max-image-size,$(INSTALLED_PRODUCTIMAGE_TARGET),$(BOARD_PRODUCTIMAGE_PARTITION_SIZE)) +endef + +# We just build this directly to the install location. +INSTALLED_PRODUCTIMAGE_TARGET := $(BUILT_PRODUCTIMAGE_TARGET) +$(INSTALLED_PRODUCTIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_PRODUCTIMAGE_FILES) $(INSTALLED_FILES_FILE_PRODUCT) $(BUILD_IMAGE_SRCS) + $(build-productimage-target) + +.PHONY: productimage-nodeps pnod +productimage-nodeps pnod: | $(INTERNAL_USERIMAGES_DEPS) + $(build-productimage-target) + +sync: $(INTERNAL_PRODUCTIMAGE_FILES) + +else ifdef BOARD_PREBUILT_PRODUCTIMAGE +INSTALLED_PRODUCTIMAGE_TARGET := $(PRODUCT_OUT)/product.img +$(eval $(call copy-one-file,$(BOARD_PREBUILT_PRODUCTIMAGE),$(INSTALLED_PRODUCTIMAGE_TARGET))) +endif + # ----------------------------------------------------------------- # dtbo image ifdef BOARD_PREBUILT_DTBOIMAGE @@ -1962,6 +2078,7 @@ DTBO_FOOTER_ARGS := BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS SYSTEM_FOOTER_ARGS := BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS VENDOR_FOOTER_ARGS := BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS RECOVERY_FOOTER_ARGS := BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS +PRODUCT_FOOTER_ARGS := BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS # Check and set required build variables for a chain partition. # $(1): the partition to enable AVB chain, e.g., BOOT or SYSTEM. @@ -2014,6 +2131,15 @@ INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \ endif endif +ifdef INSTALLED_PRODUCTIMAGE_TARGET +ifdef BOARD_AVB_PRODUCT_KEY_PATH +$(eval $(call check-and-set-avb-chain-args,PRODUCT)) +else +INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \ + --include_descriptors_from_image $(INSTALLED_PRODUCTIMAGE_TARGET) +endif +endif + ifdef INSTALLED_DTBOIMAGE_TARGET ifdef BOARD_AVB_DTBO_KEY_PATH $(eval $(call check-and-set-avb-chain-args,DTBO)) @@ -2067,6 +2193,9 @@ define extract-avb-chain-public-keys $(if $(BOARD_AVB_VENDOR_KEY_PATH),\ $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_VENDOR_KEY_PATH) \ --output $(1)/vendor.avbpubkey) + $(if $(BOARD_AVB_PRODUCT_KEY_PATH),\ + $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_PRODUCT_KEY_PATH) \ + --output $(1)/product.avbpubkey) $(if $(BOARD_AVB_DTBO_KEY_PATH),\ $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_DTBO_KEY_PATH) \ --output $(1)/dtbo.avbpubkey) @@ -2093,6 +2222,7 @@ $(INSTALLED_VBMETAIMAGE_TARGET): \ $(INSTALLED_BOOTIMAGE_TARGET) \ $(INSTALLED_SYSTEMIMAGE) \ $(INSTALLED_VENDORIMAGE_TARGET) \ + $(INSTALLED_PRODUCTIMAGE_TARGET) \ $(INSTALLED_DTBOIMAGE_TARGET) \ $(INSTALLED_RECOVERYIMAGE_TARGET) \ $(BOARD_AVB_KEY_PATH) @@ -2356,6 +2486,7 @@ $(BUILT_TARGET_FILES_PACKAGE): \ $(INSTALLED_USERDATAIMAGE_TARGET) \ $(INSTALLED_CACHEIMAGE_TARGET) \ $(INSTALLED_VENDORIMAGE_TARGET) \ + $(INSTALLED_PRODUCTIMAGE_TARGET) \ $(INSTALLED_VBMETAIMAGE_TARGET) \ $(INSTALLED_DTBOIMAGE_TARGET) \ $(INTERNAL_SYSTEMOTHERIMAGE_FILES) \ @@ -2364,6 +2495,7 @@ $(BUILT_TARGET_FILES_PACKAGE): \ $(INSTALLED_2NDBOOTLOADER_TARGET) \ $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH) \ $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH) \ + $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH) \ $(SELINUX_FC) \ $(APKCERTS_FILE) \ $(SOONG_ZIP) \ @@ -2376,6 +2508,7 @@ $(BUILT_TARGET_FILES_PACKAGE): \ | $(ACP) @echo "Package target files: $@" $(call create-system-vendor-symlink) + $(call create-system-product-symlink) $(hide) rm -rf $@ $@.list $(zip_root) $(hide) mkdir -p $(dir $@) $(zip_root) ifneq (,$(INSTALLED_RECOVERYIMAGE_TARGET)$(filter true,$(BOARD_USES_RECOVERY_AS_BOOT))) @@ -2441,6 +2574,11 @@ ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE $(hide) $(call package_files-copy-root, \ $(TARGET_OUT_VENDOR),$(zip_root)/VENDOR) endif +ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE + @# Contents of the product image + $(hide) $(call package_files-copy-root, \ + $(TARGET_OUT_PRODUCT),$(zip_root)/PRODUCT) +endif ifdef INSTALLED_SYSTEMOTHERIMAGE_TARGET @# Contents of the system_other image $(hide) $(call package_files-copy-root, \ @@ -2505,6 +2643,10 @@ ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH),) $(hide) cp $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH) \ $(zip_root)/META/$(notdir $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH)) endif +ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH),) + $(hide) cp $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH) \ + $(zip_root)/META/$(notdir $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH)) +endif ifneq ($(strip $(SANITIZE_TARGET)),) # We need to create userdata.img with real data because the instrumented libraries are in userdata.img. $(hide) echo "userdata_img_with_data=true" >> $(zip_root)/META/misc_info.txt @@ -2588,6 +2730,10 @@ ifdef BOARD_PREBUILT_VENDORIMAGE $(hide) mkdir -p $(zip_root)/IMAGES $(hide) cp $(INSTALLED_VENDORIMAGE_TARGET) $(zip_root)/IMAGES/ endif +ifdef BOARD_PREBUILT_PRODUCTIMAGE + $(hide) mkdir -p $(zip_root)/IMAGES + $(hide) cp $(INSTALLED_PRODUCTIMAGE_TARGET) $(zip_root)/IMAGES/ +endif ifdef BOARD_PREBUILT_BOOTIMAGE $(hide) mkdir -p $(zip_root)/IMAGES $(hide) cp $(INSTALLED_BOOTIMAGE_TARGET) $(zip_root)/IMAGES/ @@ -2618,6 +2764,9 @@ endif # BOARD_PREBUILT_DTBOIMAGE ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE $(hide) $(call fs_config,$(zip_root)/VENDOR,vendor/) > $(zip_root)/META/vendor_filesystem_config.txt endif +ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE + $(hide) $(call fs_config,$(zip_root)/PRODUCT,product/) > $(zip_root)/META/product_filesystem_config.txt +endif ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true) $(hide) $(call fs_config,$(zip_root)/ROOT,) > $(zip_root)/META/root_filesystem_config.txt endif @@ -2735,6 +2884,7 @@ $(SYMBOLS_ZIP): $(INSTALLED_SYSTEMIMAGE) \ $(INSTALLED_BOOTIMAGE_TARGET) \ $(INSTALLED_USERDATAIMAGE_TARGET) \ $(INSTALLED_VENDORIMAGE_TARGET) \ + $(INSTALLED_PRODUCTIMAGE_TARGET) \ $(updater_dep) endif $(SYMBOLS_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,symbols)/filelist @@ -2757,7 +2907,8 @@ ifndef TARGET_BUILD_APPS $(COVERAGE_ZIP): $(INSTALLED_SYSTEMIMAGE) \ $(INSTALLED_BOOTIMAGE_TARGET) \ $(INSTALLED_USERDATAIMAGE_TARGET) \ - $(INSTALLED_VENDORIMAGE_TARGET) + $(INSTALLED_VENDORIMAGE_TARGET) \ + $(INSTALLED_PRODUCTIMAGE_TARGET) endif $(COVERAGE_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,coverage)/filelist $(COVERAGE_ZIP): $(SOONG_ZIP) @@ -2857,6 +3008,15 @@ $(INSTALLED_QEMU_VENDORIMAGE): $(INSTALLED_VENDORIMAGE_TARGET) $(MK_QEMU_IMAGE_S vendorimage: $(INSTALLED_QEMU_VENDORIMAGE) droidcore: $(INSTALLED_QEMU_VENDORIMAGE) endif +ifeq ($(BOARD_USES_PRODUCTIMAGE),true) +INSTALLED_QEMU_PRODUCTIMAGE := $(PRODUCT_OUT)/product-qemu.img +$(INSTALLED_QEMU_PRODUCTIMAGE): $(INSTALLED_PRODUCTIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) + @echo Create product-qemu.img + (export SGDISK=$(SGDISK_HOST); $(MK_QEMU_IMAGE_SH) ${PRODUCT_OUT}/product.img) + +productimage: $(INSTALLED_QEMU_PRODUCTIMAGE) +droidcore: $(INSTALLED_QEMU_PRODUCTIMAGE) +endif endif # ----------------------------------------------------------------- # The emulator package diff --git a/core/base_rules.mk b/core/base_rules.mk index 971c1ac8f2..b4d88889dc 100644 --- a/core/base_rules.mk +++ b/core/base_rules.mk @@ -72,6 +72,8 @@ else ifneq ($(filter $(TARGET_OUT_OEM)/%,$(_path)),) LOCAL_OEM_MODULE := true else ifneq ($(filter $(TARGET_OUT_ODM)/%,$(_path)),) LOCAL_ODM_MODULE := true +else ifneq ($(filter $(TARGET_OUT_PRODUCT)/%,$(_path)),) +LOCAL_PRODUCT_MODULE := true endif _path := @@ -200,6 +202,8 @@ else ifeq (true,$(LOCAL_OEM_MODULE)) partition_tag := _OEM else ifeq (true,$(LOCAL_ODM_MODULE)) partition_tag := _ODM +else ifeq (true,$(LOCAL_PRODUCT_MODULE)) + partition_tag := _PRODUCT else ifeq (NATIVE_TESTS,$(LOCAL_MODULE_CLASS)) partition_tag := _DATA else diff --git a/core/clear_vars.mk b/core/clear_vars.mk index 5101e7326b..7d3fa75d85 100644 --- a/core/clear_vars.mk +++ b/core/clear_vars.mk @@ -197,6 +197,7 @@ LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES:= LOCAL_PREBUILT_STRIP_COMMENTS:= LOCAL_PRIVILEGED_MODULE:= # '',full,custom,disabled,obfuscation,optimization +LOCAL_PRODUCT_MODULE:= LOCAL_PROGUARD_ENABLED:= LOCAL_PROGUARD_FLAG_FILES:= LOCAL_PROGUARD_FLAGS:= diff --git a/core/config.mk b/core/config.mk index f4ce3c0d6a..9ff43e867d 100644 --- a/core/config.mk +++ b/core/config.mk @@ -987,6 +987,7 @@ dont_bother_goals := out \ cacheimage-nodeps \ bptimage-nodeps \ vnod vendorimage-nodeps \ + pnod productimage-nodeps \ systemotherimage-nodeps \ ramdisk-nodeps \ bootimage-nodeps \ diff --git a/core/envsetup.mk b/core/envsetup.mk index f339b2f072..6a7fbd1998 100644 --- a/core/envsetup.mk +++ b/core/envsetup.mk @@ -179,6 +179,7 @@ TARGET_COPY_OUT_DATA := data TARGET_COPY_OUT_ASAN := $(TARGET_COPY_OUT_DATA)/asan TARGET_COPY_OUT_OEM := oem TARGET_COPY_OUT_ODM := odm +TARGET_COPY_OUT_PRODUCT := product TARGET_COPY_OUT_ROOT := root TARGET_COPY_OUT_RECOVERY := recovery @@ -198,6 +199,17 @@ _vendor_path_placeholder := ||VENDOR-PATH-PH|| TARGET_COPY_OUT_VENDOR := $(_vendor_path_placeholder) ########################################### +########################################### +# Define TARGET_COPY_OUT_PRODUCT to a placeholder, for at this point +# we don't know if the device wants to build a separate product.img +# or just build product stuff into system.img. +# A device can set up TARGET_COPY_OUT_PRODUCT to "product" in its +# BoardConfig.mk. +# We'll substitute with the real value after loading BoardConfig.mk. +_product_path_placeholder := ||PRODUCT-PATH-PH|| +TARGET_COPY_OUT_PRODUCT := $(_product_path_placeholder) +########################################### + ################################################################# # Set up minimal BOOTCLASSPATH list of jars to build/execute # java code with dalvikvm/art. @@ -273,6 +285,29 @@ BOARD_USES_VENDORIMAGE := true else ifdef BOARD_USES_VENDORIMAGE $(error TARGET_COPY_OUT_VENDOR must be set to 'vendor' to use a vendor image) endif + +########################################### +# Now we can substitute with the real value of TARGET_COPY_OUT_PRODUCT +ifeq ($(TARGET_COPY_OUT_PRODUCT),$(_product_path_placeholder)) +TARGET_COPY_OUT_PRODUCT := system/product +else ifeq ($(filter product system/product,$(TARGET_COPY_OUT_PRODUCT)),) +$(error TARGET_COPY_OUT_PRODUCT must be either 'product' or 'system/product', seeing '$(TARGET_COPY_OUT_PRODUCT)'.) +endif +PRODUCT_COPY_FILES := $(subst $(_product_path_placeholder),$(TARGET_COPY_OUT_PRODUCT),$(PRODUCT_COPY_FILES)) + +BOARD_USES_PRODUCTIMAGE := +ifdef BOARD_PREBUILT_PRODUCTIMAGE +BOARD_USES_PRODUCTIMAGE := true +endif +ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE +BOARD_USES_PRODUCTIMAGE := true +endif +ifeq ($(TARGET_COPY_OUT_PRODUCT),product) +BOARD_USES_PRODUCTIMAGE := true +else ifdef BOARD_USES_PRODUCTIMAGE +$(error TARGET_COPY_OUT_PRODUCT must be set to 'product' to use a product image) +endif + ########################################### # Ensure that only TARGET_RECOVERY_UPDATER_LIBS *or* AB_OTA_UPDATER is set. TARGET_RECOVERY_UPDATER_LIBS ?= @@ -625,6 +660,39 @@ $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_SHARED_LIBRARIES := $(TARGET_OUT_ODM endif $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_APPS := $(TARGET_OUT_ODM_APPS) +TARGET_OUT_PRODUCT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_PRODUCT) +ifneq ($(filter address,$(SANITIZE_TARGET)),) +target_out_product_shared_libraries_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/system +ifeq ($(SANITIZE_LITE),true) +# When using SANITIZE_LITE, APKs must not be packaged with sanitized libraries, as they will not +# work with unsanitized app_process. For simplicity, generate APKs into /data/asan/. +target_out_product_app_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/product +else +target_out_product_app_base := $(TARGET_OUT_PRODUCT) +endif +else +target_out_product_shared_libraries_base := $(TARGET_OUT) +target_out_product_app_base := $(TARGET_OUT_PRODUCT) +endif + +ifeq ($(TARGET_IS_64_BIT),true) +TARGET_OUT_PRODUCT_SHARED_LIBRARIES := $(target_out_product_shared_libraries_base)/lib64 +else +TARGET_OUT_PRODUCT_SHARED_LIBRARIES := $(target_out_product_shared_libraries_base)/lib +endif +TARGET_OUT_PRODUCT_JAVA_LIBRARIES:= $(TARGET_OUT_PRODUCT)/framework +TARGET_OUT_PRODUCT_APPS := $(target_out_product_app_base)/app +TARGET_OUT_PRODUCT_APPS_PRIVILEGED := $(target_out_product_app_base)/priv-app +TARGET_OUT_PRODUCT_ETC := $(TARGET_OUT_PRODUCT)/etc + +ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true) +$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_SHARED_LIBRARIES := $(target_out_product_shared_libraries_base)/lib/$(TARGET_2ND_ARCH) +else +$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_SHARED_LIBRARIES := $(target_out_product_shared_libraries_base)/lib +endif +$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_APPS := $(TARGET_OUT_PRODUCT_APPS) +$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_APPS_PRIVILEGED := $(TARGET_OUT_PRODUCT_APPS_PRIVILEGED) + TARGET_OUT_BREAKPAD := $(PRODUCT_OUT)/breakpad TARGET_OUT_UNSTRIPPED := $(PRODUCT_OUT)/symbols diff --git a/core/main.mk b/core/main.mk index 93c8d3b843..98f6ecb167 100644 --- a/core/main.mk +++ b/core/main.mk @@ -1041,6 +1041,9 @@ bptimage: $(INSTALLED_BPTIMAGE_TARGET) .PHONY: vendorimage vendorimage: $(INSTALLED_VENDORIMAGE_TARGET) +.PHONY: productimage +productimage: $(INSTALLED_PRODUCTIMAGE_TARGET) + .PHONY: systemotherimage systemotherimage: $(INSTALLED_SYSTEMOTHERIMAGE_TARGET) @@ -1064,9 +1067,11 @@ droidcore: files \ $(INSTALLED_CACHEIMAGE_TARGET) \ $(INSTALLED_BPTIMAGE_TARGET) \ $(INSTALLED_VENDORIMAGE_TARGET) \ + $(INSTALLED_PRODUCTIMAGE_TARGET) \ $(INSTALLED_SYSTEMOTHERIMAGE_TARGET) \ $(INSTALLED_FILES_FILE) \ $(INSTALLED_FILES_FILE_VENDOR) \ + $(INSTALLED_FILES_FILE_PRODUCT) \ $(INSTALLED_FILES_FILE_SYSTEMOTHER) \ soong_docs @@ -1132,6 +1137,7 @@ else # TARGET_BUILD_APPS $(COVERAGE_ZIP) \ $(INSTALLED_FILES_FILE) \ $(INSTALLED_FILES_FILE_VENDOR) \ + $(INSTALLED_FILES_FILE_PRODUCT) \ $(INSTALLED_FILES_FILE_SYSTEMOTHER) \ $(INSTALLED_BUILD_PROP_TARGET) \ $(BUILT_TARGET_FILES_PACKAGE) \ diff --git a/core/package_internal.mk b/core/package_internal.mk index cdc4958b1c..489096635b 100644 --- a/core/package_internal.mk +++ b/core/package_internal.mk @@ -111,6 +111,8 @@ ifneq ($(PRODUCT_ENFORCE_RRO_TARGETS),) enforce_rro_enabled := else ifeq (true,$(LOCAL_ODM_MODULE)) enforce_rro_enabled := + else ifeq (true,$(LOCAL_PRODUCT_MODULE)) + enforce_rro_enabled := endif else ifeq ($(filter $(TARGET_OUT)/%,$(LOCAL_MODULE_PATH)),) enforce_rro_enabled := diff --git a/core/product-graph.mk b/core/product-graph.mk index 666a20768f..576d14ddf7 100644 --- a/core/product-graph.mk +++ b/core/product-graph.mk @@ -104,6 +104,7 @@ $(OUT_DIR)/products/$(strip $(1)).txt: $(this_makefile) $(hide) echo 'PRODUCT_PROPERTY_OVERRIDES=$$(PRODUCTS.$(strip $(1)).PRODUCT_PROPERTY_OVERRIDES)' >> $$@ $(hide) echo 'PRODUCT_DEFAULT_PROPERTY_OVERRIDES=$$(PRODUCTS.$(strip $(1)).PRODUCT_DEFAULT_PROPERTY_OVERRIDES)' >> $$@ $(hide) echo 'PRODUCT_SYSTEM_DEFAULT_PROPERTIES=$$(PRODUCTS.$(strip $(1)).PRODUCT_SYSTEM_DEFAULT_PROPERTIES)' >> $$@ + $(hide) echo 'PRODUCT_PRODUCT_PROPERTIES=$$(PRODUCTS.$(strip $(1)).PRODUCT_PRODUCT_PROPERTIES)' >> $$@ $(hide) echo 'PRODUCT_CHARACTERISTICS=$$(PRODUCTS.$(strip $(1)).PRODUCT_CHARACTERISTICS)' >> $$@ $(hide) echo 'PRODUCT_COPY_FILES=$$(PRODUCTS.$(strip $(1)).PRODUCT_COPY_FILES)' >> $$@ $(hide) echo 'PRODUCT_OTA_PUBLIC_KEYS=$$(PRODUCTS.$(strip $(1)).PRODUCT_OTA_PUBLIC_KEYS)' >> $$@ diff --git a/core/product.mk b/core/product.mk index 77f78a67f0..8095b2799d 100644 --- a/core/product.mk +++ b/core/product.mk @@ -88,6 +88,7 @@ _product_var_list := \ PRODUCT_BRAND \ PRODUCT_PROPERTY_OVERRIDES \ PRODUCT_DEFAULT_PROPERTY_OVERRIDES \ + PRODUCT_PRODUCT_PROPERTIES \ PRODUCT_CHARACTERISTICS \ PRODUCT_COPY_FILES \ PRODUCT_OTA_PUBLIC_KEYS \ @@ -125,6 +126,7 @@ _product_var_list := \ PRODUCT_VERITY_SIGNING_KEY \ PRODUCT_SYSTEM_VERITY_PARTITION \ PRODUCT_VENDOR_VERITY_PARTITION \ + PRODUCT_PRODUCT_VERITY_PARTITION \ PRODUCT_SYSTEM_SERVER_DEBUG_INFO \ PRODUCT_DEX_PREOPT_MODULE_CONFIGS \ PRODUCT_DEX_PREOPT_DEFAULT_FLAGS \ @@ -136,6 +138,7 @@ _product_var_list := \ PRODUCT_SANITIZER_MODULE_CONFIGS \ PRODUCT_SYSTEM_BASE_FS_PATH \ PRODUCT_VENDOR_BASE_FS_PATH \ + PRODUCT_PRODUCT_BASE_FS_PATH \ PRODUCT_SHIPPING_API_LEVEL \ VENDOR_PRODUCT_RESTRICT_VENDOR_FILES \ VENDOR_EXCEPTION_MODULES \ @@ -304,6 +307,8 @@ _product_stash_var_list += \ BOARD_FLASH_BLOCK_SIZE \ BOARD_VENDORIMAGE_PARTITION_SIZE \ BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE \ + BOARD_PRODUCTIMAGE_PARTITION_SIZE \ + BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE \ BOARD_INSTALLER_CMDLINE \ diff --git a/core/product_config.mk b/core/product_config.mk index 2cd801633b..e8c281bcde 100644 --- a/core/product_config.mk +++ b/core/product_config.mk @@ -365,6 +365,13 @@ PRODUCT_SYSTEM_DEFAULT_PROPERTIES := \ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_DEFAULT_PROPERTIES)) .KATI_READONLY := PRODUCT_SYSTEM_DEFAULT_PROPERTIES +# A list of property assignments, like "key = value", with zero or more +# whitespace characters on either side of the '='. +# used for adding properties to build.prop of product partition +PRODUCT_PRODUCT_PROPERTIES := \ + $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_PROPERTIES)) +.KATI_READONLY := PRODUCT_PRODUCT_PROPERTIES + # Should we use the default resources or add any product specific overlays PRODUCT_PACKAGE_OVERLAYS := \ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGE_OVERLAYS)) diff --git a/core/soong_config.mk b/core/soong_config.mk index 2fa7ad417c..639b01936a 100644 --- a/core/soong_config.mk +++ b/core/soong_config.mk @@ -124,7 +124,7 @@ $(call add_json_bool, Enforce_vintf_manifest, $(filter true,$(PRODUCT $(call add_json_bool, Uml, $(filter true,$(TARGET_USER_MODE_LINUX))) $(call add_json_str, VendorPath, $(TARGET_COPY_OUT_VENDOR)) $(call add_json_str, OdmPath, $(TARGET_COPY_OUT_ODM)) -$(call add_json_str, OemPath, $(TARGET_COPY_OUT_OEM)) +$(call add_json_str, ProductPath, $(TARGET_COPY_OUT_PRODUCT)) $(call add_json_bool, MinimizeJavaDebugInfo, $(filter true,$(PRODUCT_MINIMIZE_JAVA_DEBUG_INFO))) $(call add_json_bool, UseGoma, $(filter-out false,$(USE_GOMA))) diff --git a/help.sh b/help.sh index 3f39c771ca..c1435429e0 100755 --- a/help.sh +++ b/help.sh @@ -38,6 +38,8 @@ Common goals are: Stands for "System, NO Dependencies" vnod Quickly rebuild the vendor image from built packages Stands for "Vendor, NO Dependencies" + pnod Quickly rebuild the product image from built packages + Stands for "Product, NO Dependencies" So, for example, you could run: diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py index a9863bc91b..240e5c94bb 100755 --- a/tools/releasetools/add_img_to_target_files.py +++ b/tools/releasetools/add_img_to_target_files.py @@ -75,7 +75,7 @@ OPTIONS.is_signing = False # Partitions that should have their care_map added to META/care_map.txt. -PARTITIONS_WITH_CARE_MAP = ('system', 'vendor') +PARTITIONS_WITH_CARE_MAP = ('system', 'vendor', 'product') class OutputFile(object): @@ -172,6 +172,20 @@ def AddVendor(output_zip, prefix="IMAGES/"): return img.name +def AddProduct(output_zip, prefix="IMAGES/"): + """Turn the contents of PRODUCT into a product image and store it in output_zip.""" + + img = OutputFile(output_zip, OPTIONS.input_tmp, prefix, "product.img") + if os.path.exists(img.input_name): + print("product.img already exists in %s, no need to rebuild..." % (prefix,)) + return img.input_name + + block_list = OutputFile(output_zip, OPTIONS.input_tmp, prefix, "product.map") + CreateImage(OPTIONS.input_tmp, OPTIONS.info_dict, "product", img, + block_list=block_list) + return img.name + + def AddDtbo(output_zip, prefix="IMAGES/"): """Adds the DTBO image. @@ -621,13 +635,16 @@ def AddImagesToTargetFiles(filename): print("target_files appears to already contain images.") sys.exit(1) - # vendor.img is unlike system.img or system_other.img. Because it could be - # built from source, or dropped into target_files.zip as a prebuilt blob. We - # consider either of them as vendor.img being available, which could be used - # when generating vbmeta.img for AVB. + # {vendor,product}.img is unlike system.img or system_other.img. Because it could + # be built from source, or dropped into target_files.zip as a prebuilt blob. + # We consider either of them as {vendor,product}.img being available, which could + # be used when generating vbmeta.img for AVB. has_vendor = (os.path.isdir(os.path.join(OPTIONS.input_tmp, "VENDOR")) or os.path.exists(os.path.join(OPTIONS.input_tmp, "IMAGES", "vendor.img"))) + has_product = (os.path.isdir(os.path.join(OPTIONS.input_tmp, "PRODUCT")) or + os.path.exists(os.path.join(OPTIONS.input_tmp, "IMAGES", + "product.img"))) has_system_other = os.path.isdir(os.path.join(OPTIONS.input_tmp, "SYSTEM_OTHER")) @@ -715,6 +732,10 @@ def AddImagesToTargetFiles(filename): banner("vendor") partitions['vendor'] = AddVendor(output_zip) + if has_product: + banner("product") + partitions['product'] = AddProduct(output_zip) + if has_system_other: banner("system_other") AddSystemOther(output_zip) diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py index f07e4b13d1..123ec7cd34 100755 --- a/tools/releasetools/build_image.py +++ b/tools/releasetools/build_image.py @@ -778,6 +778,22 @@ def ImagePropFromGlobalDict(glob_dict, mount_point): copy_prop("vendor_squashfs_disable_4k_align", "squashfs_disable_4k_align") copy_prop("vendor_base_fs_file", "base_fs_file") copy_prop("vendor_extfs_inode_count", "extfs_inode_count") + elif mount_point == "product": + copy_prop("avb_product_hashtree_enable", "avb_hashtree_enable") + copy_prop("avb_product_add_hashtree_footer_args", + "avb_add_hashtree_footer_args") + copy_prop("avb_product_key_path", "avb_key_path") + copy_prop("avb_product_algorithm", "avb_algorithm") + copy_prop("product_fs_type", "fs_type") + copy_prop("product_size", "partition_size") + copy_prop("product_journal_size", "journal_size") + copy_prop("product_verity_block_device", "verity_block_device") + copy_prop("product_squashfs_compressor", "squashfs_compressor") + copy_prop("product_squashfs_compressor_opt", "squashfs_compressor_opt") + copy_prop("product_squashfs_block_size", "squashfs_block_size") + copy_prop("product_squashfs_disable_4k_align", "squashfs_disable_4k_align") + copy_prop("product_base_fs_file", "base_fs_file") + copy_prop("product_extfs_inode_count", "extfs_inode_count") elif mount_point == "oem": copy_prop("fs_type", "fs_type") copy_prop("oem_size", "partition_size") @@ -831,6 +847,8 @@ def main(argv): mount_point = "vendor" elif image_filename == "oem.img": mount_point = "oem" + elif image_filename == "product.img": + mount_point = "product" else: print("error: unknown image file name ", image_filename, file=sys.stderr) sys.exit(1) diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py index faadae9706..632cc11d04 100644 --- a/tools/releasetools/common.py +++ b/tools/releasetools/common.py @@ -78,7 +78,7 @@ SPECIAL_CERT_STRINGS = ("PRESIGNED", "EXTERNAL") # The partitions allowed to be signed by AVB (Android verified boot 2.0). -AVB_PARTITIONS = ('boot', 'recovery', 'system', 'vendor', 'dtbo') +AVB_PARTITIONS = ('boot', 'recovery', 'system', 'vendor', 'product', 'dtbo') class ErrorCode(object):