Add support for /product-services partition

This CL is largely an adaptation of Change-Id
I774e6a38003734421591e51bed103802ff84f432

It adds the following variables:

- BOARD_AVB_PRODUCT_SERVICES_KEY_PATH
- BOARD_AVB_PRODUCT_SERVICES_ALGORITHM
- BOARD_AVB_PRODUCT_SERVICES_ROLLBACK_INDEX_LOCATION
- BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE
- BOARD_PRODUCT_SERVICESIMAGE_EXTFS_INODE_COUNT
- BOARD_PRODUCT_SERVICESIMAGE_EXTFS_RSV_PCT
- BOARD_PRODUCT_SERVICESIMAGE_PARTITION_SIZE
- BOARD_PRODUCT_SERVICESIMAGE_JOURNAL_SIZE
- BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_BLOCK_SIZE
- BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_COMPRESSOR
- BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_COMPRESSOR_OPT
- BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_DISABLE_4K_ALIGN
- BOARD_PREBUILT_PRODUCT_SERVICESIMAGE
- BOARD_USES_PRODUCT_SERVICESIMAGE
- LOCAL_PRODUCT_SERVICES_MODULE
- PRODUCT_PRODUCT_SERVICES_BASE_FS_PATH
- PRODUCT_PRODUCT_SERVICES_VERITY_PARTITION
- PRODUCT_PRODUCT_SERVICES_PROPERTIES
- TARGET_COPY_OUT_PRODUCT_SERVICES
- TARGET_OUT_PRODUCT_SERVICES
- TARGET_OUT_PRODUCT_SERVICES_*

Bug: 80741439
Test: Successfully built product-services.img with one module in it, and flashed
on device. Also successfully built image with /system/product-services directory
and no /product-services partition.
Change-Id: I5d229f6ac729ea6df9ff1f14cee2e28972cd9b4d
This commit is contained in:
Dario Freni
2018-05-29 13:09:01 +01:00
parent f1429b1c31
commit 5f681e1dd7
15 changed files with 317 additions and 10 deletions

View File

@@ -74,7 +74,7 @@ OPTIONS.is_signing = False
# Partitions that should have their care_map added to META/care_map.txt.
PARTITIONS_WITH_CARE_MAP = ('system', 'vendor', 'product')
PARTITIONS_WITH_CARE_MAP = ('system', 'vendor', 'product', 'product-services')
class OutputFile(object):
@@ -196,6 +196,24 @@ def AddProduct(output_zip):
return img.name
def AddProductServices(output_zip):
"""Turn the contents of PRODUCT_SERVICES into a product-services image and
store it in output_zip."""
img = OutputFile(output_zip, OPTIONS.input_tmp, "IMAGES",
"product-services.img")
if os.path.exists(img.input_name):
print("product-services.img already exists; no need to rebuild...")
return img.input_name
block_list = OutputFile(
output_zip, OPTIONS.input_tmp, "IMAGES", "product-services.map")
CreateImage(
OPTIONS.input_tmp, OPTIONS.info_dict, "product-services", img,
block_list=block_list)
return img.name
def AddDtbo(output_zip):
"""Adds the DTBO image.
@@ -628,16 +646,22 @@ def AddImagesToTargetFiles(filename):
has_recovery = OPTIONS.info_dict.get("no_recovery") != "true"
# {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.
# {vendor,product,product-services}.img are 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,product-services}.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_productservices = (os.path.isdir(os.path.join(OPTIONS.input_tmp,
"PRODUCTSERVICES")) or
os.path.exists(os.path.join(OPTIONS.input_tmp,
"IMAGES",
"product-services.img")))
has_system_other = os.path.isdir(os.path.join(OPTIONS.input_tmp,
"SYSTEM_OTHER"))
@@ -714,6 +738,10 @@ def AddImagesToTargetFiles(filename):
banner("product")
partitions['product'] = AddProduct(output_zip)
if has_productservices:
banner("product-services")
partitions['product-services'] = AddProductServices(output_zip)
if has_system_other:
banner("system_other")
AddSystemOther(output_zip)

View File

@@ -875,6 +875,27 @@ def ImagePropFromGlobalDict(glob_dict, mount_point):
copy_prop("product_extfs_inode_count", "extfs_inode_count")
if not copy_prop("product_extfs_rsv_pct", "extfs_rsv_pct"):
d["extfs_rsv_pct"] = "0"
elif mount_point == "product-services":
copy_prop("avb_productservices_hashtree_enable", "avb_hashtree_enable")
copy_prop("avb_productservices_add_hashtree_footer_args",
"avb_add_hashtree_footer_args")
copy_prop("avb_productservices_key_path", "avb_key_path")
copy_prop("avb_productservices_algorithm", "avb_algorithm")
copy_prop("productservices_fs_type", "fs_type")
copy_prop("productservices_size", "partition_size")
if not copy_prop("productservices_journal_size", "journal_size"):
d["journal_size"] = "0"
copy_prop("productservices_verity_block_device", "verity_block_device")
copy_prop("productservices_squashfs_compressor", "squashfs_compressor")
copy_prop("productservices_squashfs_compressor_opt",
"squashfs_compressor_opt")
copy_prop("productservices_squashfs_block_size", "squashfs_block_size")
copy_prop("productservices_squashfs_disable_4k_align",
"squashfs_disable_4k_align")
copy_prop("productservices_base_fs_file", "base_fs_file")
copy_prop("productservices_extfs_inode_count", "extfs_inode_count")
if not copy_prop("productservices_extfs_rsv_pct", "extfs_rsv_pct"):
d["extfs_rsv_pct"] = "0"
elif mount_point == "oem":
copy_prop("fs_type", "fs_type")
copy_prop("oem_size", "partition_size")
@@ -955,6 +976,8 @@ def main(argv):
mount_point = "oem"
elif image_filename == "product.img":
mount_point = "product"
elif image_filename == "product-services.img":
mount_point = "product-services"
else:
print("error: unknown image file name ", image_filename, file=sys.stderr)
sys.exit(1)

View File

@@ -78,7 +78,8 @@ SPECIAL_CERT_STRINGS = ("PRESIGNED", "EXTERNAL")
# The partitions allowed to be signed by AVB (Android verified boot 2.0).
AVB_PARTITIONS = ('boot', 'recovery', 'system', 'vendor', 'product', 'dtbo')
AVB_PARTITIONS = ('boot', 'recovery', 'system', 'vendor', 'product',
'product-services', 'dtbo')
class ErrorCode(object):