Add support for /odm partition
This CL is largely an adaptation of Change-Id
I5d229f6ac729ea6df9ff1f14cee2e28972cd9b4d
tools/vendor_buildinfo.sh is also renamed to tools/device_buildinfo.sh.
The caller then can invoke device_buildinfo.sh "vendor" | "odm" to
generate properties for vendor.img and odm.img, respectively.
It adds the following variables:
- BOARD_AVB_ODM_KEY_PATH
- BOARD_AVB_ODM_ALGORITHM
- BOARD_AVB_ODM_ROLLBACK_INDEX_LOCATION
- BOARD_ODMIMAGE_FILE_SYSTEM_TYPE
- BOARD_ODMIMAGE_EXTFS_INODE_COUNT
- BOARD_ODMIMAGE_EXTFS_RSV_PCT
- BOARD_ODMIMAGE_PARTITION_SIZE
- BOARD_ODMIMAGE_JOURNAL_SIZE
- BOARD_ODMIMAGE_SQUASHFS_BLOCK_SIZE
- BOARD_ODMIMAGE_SQUASHFS_COMPRESSOR
- BOARD_ODMIMAGE_SQUASHFS_COMPRESSOR_OPT
- BOARD_ODMIMAGE_SQUASHFS_DISABLE_4K_ALIGN
- BOARD_PREBUILT_ODMIMAGE
- BOARD_USES_ODMIMAGE
- LOCAL_ODM_MODULE
- PRODUCT_ODM_BASE_FS_PATH
- PRODUCT_ODM_VERITY_PARTITION
- PRODUCT_ODM_PROPERTIES
- TARGET_COPY_OUT_ODM
- TARGET_OUT_ODM
- TARGET_OUT_ODM_*
Bug: 64195575
Test: boot a Taimen with existing images
Test: `make odmimage` with
- BOARD_AVB_ENABLE := true
- BOARD_ODMIMAGE_PARTITION_SIZE := 62914560
- BOARD_ODMIMAGE_FILE_SYSTEM_TYPE := ext4
- TARGET_COPY_OUT_ODM := odm
- PRODUCT_ODM_PROPERTIES += odm.test.build=success
Test: `make odmimage` with
- BOARD_ODMIMAGE_PARTITION_RESERVED_SIZE := 10485760
- BOARD_ODMIMAGE_FILE_SYSTEM_TYPE := ext4
- BOARD_AVB_ENABLE := true
- TARGET_COPY_OUT_ODM := odm
- PRODUCT_ODM_PROPERTIES += odm.test.build=success
- PRODUCT_USE_DYNAMIC_PARTITION_SIZE := true
Change-Id: I4dea7b567ec49a766c7a4683decaf81c7e921d55
diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py
index fb4b882..932fab9 100755
--- a/tools/releasetools/add_img_to_target_files.py
+++ b/tools/releasetools/add_img_to_target_files.py
@@ -73,12 +73,14 @@
OPTIONS.is_signing = False
# Partitions that should have their care_map added to META/care_map.txt.
-PARTITIONS_WITH_CARE_MAP = ('system', 'vendor', 'product', 'product-services')
+PARTITIONS_WITH_CARE_MAP = ('system', 'vendor', 'product', 'product-services',
+ 'odm')
# Use a fixed timestamp (01/01/2009 00:00:00 UTC) for files when packaging
# images. (b/24377993, b/80600931)
FIXED_FILE_TIMESTAMP = (datetime.datetime(2009, 1, 1, 0, 0, 0, 0, None)
- datetime.datetime.utcfromtimestamp(0)).total_seconds()
+
class OutputFile(object):
def __init__(self, output_zip, input_dir, prefix, name):
self._output_zip = output_zip
@@ -215,6 +217,22 @@
return img.name
+def AddOdm(output_zip):
+ """Turn the contents of ODM into an odm image and store it in output_zip."""
+
+ img = OutputFile(output_zip, OPTIONS.input_tmp, "IMAGES", "odm.img")
+ if os.path.exists(img.input_name):
+ print("odm.img already exists; no need to rebuild...")
+ return img.input_name
+
+ block_list = OutputFile(
+ output_zip, OPTIONS.input_tmp, "IMAGES", "odm.map")
+ CreateImage(
+ OPTIONS.input_tmp, OPTIONS.info_dict, "odm", img,
+ block_list=block_list)
+ return img.name
+
+
def AddDtbo(output_zip):
"""Adds the DTBO image.
@@ -631,7 +649,7 @@
has_recovery = OPTIONS.info_dict.get("no_recovery") != "true"
- # {vendor,product,product-services}.img are unlike system.img or
+ # {vendor,odm,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
@@ -639,6 +657,9 @@
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_odm = (os.path.isdir(os.path.join(OPTIONS.input_tmp, "ODM")) or
+ os.path.exists(os.path.join(OPTIONS.input_tmp, "IMAGES",
+ "odm.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")))
@@ -727,6 +748,10 @@
banner("product-services")
partitions['product-services'] = AddProductServices(output_zip)
+ if has_odm:
+ banner("odm")
+ partitions['odm'] = AddOdm(output_zip)
+
if has_system_other:
banner("system_other")
AddSystemOther(output_zip)