From 749062d379a88d290adc5bcd686d98083810079e Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Tue, 19 Jun 2018 16:23:16 -0700 Subject: [PATCH] build_image.py recognize BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE Test: `make vendorimage` Test: `make vendorimage` with the following: - install a large file to vendor image fails as expected (because _PARTITION_SIZE is exceeded) Test: `make vendorimage` with the following: - set PRODUCT_USE_LOGICAL_PARTITIONS to true - set BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE fails as expected (BOARD_VENDORIMAGE_PARTITION_SIZE needs to be undefined) Test: `make vendorimage` with the following: - install a large file to vendor image - set PRODUCT_USE_LOGICAL_PARTIIONS to true - add a small BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE - remove BOARD_VENDORIMAGE_PARTITION_SIZE build succeeds. Bug: 79106666 Change-Id: Ica8fdce64e8f37d91e66e3d49c0c74fadd15a832 --- core/Makefile | 8 ++++++-- core/config.mk | 7 +++++++ core/product.mk | 1 + tools/releasetools/build_image.py | 3 +++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/core/Makefile b/core/Makefile index 27252e249f..3eb4211cac 100644 --- a/core/Makefile +++ b/core/Makefile @@ -1139,6 +1139,7 @@ $(if $(filter $(2),vendor),\ $(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_VENDORIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "vendor_reserved_size=$(BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE)" >> $(1)) ) $(if $(filter $(2),product),\ $(if $(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "product_fs_type=$(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE)" >> $(1)) @@ -2094,8 +2095,11 @@ define build-vendorimage-target $(call build-image-kernel-modules,$(BOARD_VENDOR_KERNEL_MODULES),$(TARGET_OUT_VENDOR),vendor/,$(call intermediates-dir-for,PACKAGING,depmod_vendor))) $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \ build/make/tools/releasetools/build_image.py \ - $(TARGET_OUT_VENDOR) $(vendorimage_intermediates)/vendor_image_info.txt $(INSTALLED_VENDORIMAGE_TARGET) $(TARGET_OUT) - $(hide) $(call assert-max-image-size,$(INSTALLED_VENDORIMAGE_TARGET),$(BOARD_VENDORIMAGE_PARTITION_SIZE)) + $(TARGET_OUT_VENDOR) $(vendorimage_intermediates)/vendor_image_info.txt $(INSTALLED_VENDORIMAGE_TARGET) $(TARGET_OUT) \ + $(vendorimage_intermediates)/generated_vendor_image_info.txt + $(hide) $(call assert-max-image-size,$(INSTALLED_VENDORIMAGE_TARGET),\ + $(call read-image-prop-dictionary,\ + $(vendorimage_intermediates)/generated_vendor_image_info.txt,vendor_size)) endef # We just build this directly to the install location. diff --git a/core/config.mk b/core/config.mk index f92375c05b..17c9eaba5e 100644 --- a/core/config.mk +++ b/core/config.mk @@ -936,6 +936,13 @@ $(error Should not define BOARD_SYSTEMIMAGE_PARTITION_SIZE and \ endif endif +ifneq ($(BOARD_VENDORIMAGE_PARTITION_SIZE),) +ifneq ($(BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE),) +$(error Should not define BOARD_VENDORIMAGE_PARTITION_SIZE and \ + BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE together) +endif +endif + endif # USE_LOGICAL_PARTITIONS # ############################################################### diff --git a/core/product.mk b/core/product.mk index 6a5add3322..9eeacf06db 100644 --- a/core/product.mk +++ b/core/product.mk @@ -379,6 +379,7 @@ _product_stash_var_list += \ # Logical partitions related variables. _product_stash_var_list += \ BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE \ + BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE \ # # Mark the variables in _product_stash_var_list as readonly diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py index 4e690fe779..7b4831fb2f 100755 --- a/tools/releasetools/build_image.py +++ b/tools/releasetools/build_image.py @@ -855,6 +855,7 @@ def ImagePropFromGlobalDict(glob_dict, mount_point): copy_prop("vendor_extfs_inode_count", "extfs_inode_count") if not copy_prop("vendor_extfs_rsv_pct", "extfs_rsv_pct"): d["extfs_rsv_pct"] = "0" + copy_prop("vendor_reserved_size", "partition_reserved_size") elif mount_point == "product": copy_prop("avb_product_hashtree_enable", "avb_hashtree_enable") copy_prop("avb_product_add_hashtree_footer_args", @@ -911,6 +912,8 @@ def GlobalDictFromImageProp(image_prop, mount_point): copy_prop("partition_size", "system_size") elif mount_point == "system_other": copy_prop("partition_size", "system_size") + elif mount_point == "vendor": + copy_prop("partition_size", "vendor_size") return d