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
This commit is contained in:
Yifan Hong 2018-06-19 16:23:16 -07:00
parent bbcba1e353
commit 749062d379
4 changed files with 17 additions and 2 deletions

View File

@ -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.

View File

@ -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
# ###############################################################

View File

@ -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

View File

@ -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