Add modules partition.

Modules partition is a dynamic read-write partition.
- AVB is not enabled on the partition
- OTA is file-based; see follow up CL for details
- No build prop files; in particular, no build fingerprint
- No fs_config
- No notice files; notice files are included in individual APEXes

Test: build on CF
Bug: 163543381

Change-Id: Ie397b9ec61dfd1c158450d050196024604854d4d
This commit is contained in:
Yifan Hong
2020-08-10 16:48:52 -07:00
parent 897cfaee46
commit c0f187f5f9
10 changed files with 225 additions and 5 deletions

View File

@@ -296,6 +296,7 @@ def AddVendorDlkm(output_zip):
block_list=block_list)
return img.name
def AddOdmDlkm(output_zip):
"""Turn the contents of OdmDlkm into an odm_dlkm image and store it in output_zip."""
@@ -312,6 +313,22 @@ def AddOdmDlkm(output_zip):
return img.name
def AddModules(output_zip):
"""Turn the contents of Modules into an modules image and store it in output_zip."""
img = OutputFile(output_zip, OPTIONS.input_tmp, "IMAGES", "modules.img")
if os.path.exists(img.name):
logger.info("modules.img already exists; no need to rebuild...")
return img.name
block_list = OutputFile(
output_zip, OPTIONS.input_tmp, "IMAGES", "modules.map")
CreateImage(
OPTIONS.input_tmp, OPTIONS.info_dict, "modules", img,
block_list=block_list)
return img.name
def AddDtbo(output_zip):
"""Adds the DTBO image.
@@ -420,7 +437,9 @@ def CreateImage(input_dir, info_dict, what, output_file, block_list=None):
# Use repeatable ext4 FS UUID and hash_seed UUID (based on partition name and
# build fingerprint).
build_info = common.BuildInfo(info_dict)
uuid_seed = what + "-" + build_info.GetPartitionFingerprint(what)
uuid_seed = what
if what != "modules":
uuid_seed += "-" + build_info.GetPartitionFingerprint(what)
image_props["uuid"] = str(uuid.uuid5(uuid.NAMESPACE_URL, uuid_seed))
hash_seed = "hash_seed-" + uuid_seed
image_props["hash_seed"] = str(uuid.uuid5(uuid.NAMESPACE_URL, hash_seed))
@@ -798,6 +817,12 @@ def AddImagesToTargetFiles(filename):
OPTIONS.info_dict.get("building_product_image") == "true") or
os.path.exists(
os.path.join(OPTIONS.input_tmp, "IMAGES", "product.img")))
has_modules = ((os.path.isdir(os.path.join(OPTIONS.input_tmp,
"MODULES")) and
OPTIONS.info_dict.get("building_modules_image")
== "true") or
os.path.exists(os.path.join(OPTIONS.input_tmp, "IMAGES",
"modules.img")))
has_system_ext = (
(os.path.isdir(os.path.join(OPTIONS.input_tmp, "SYSTEM_EXT")) and
OPTIONS.info_dict.get("building_system_ext_image") == "true") or
@@ -927,6 +952,10 @@ def AddImagesToTargetFiles(filename):
banner("odm_dlkm")
partitions['odm_dlkm'] = AddOdmDlkm(output_zip)
if has_modules:
banner("modules")
partitions['modules'] = AddModules(output_zip)
if has_system_other:
banner("system_other")
AddSystemOther(output_zip)