forked from openkylin/platform_build
Merge "Add pvmfw partition to target files" am: 5553b5704c
Original change: https://android-review.googlesource.com/c/platform/build/+/1595341 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I83e3ecd8d6cf9847c38508ab088ccb66d193c7a7
This commit is contained in:
commit
2f8015f71a
|
@ -350,6 +350,41 @@ def AddDtbo(output_zip):
|
|||
img.Write()
|
||||
return img.name
|
||||
|
||||
def AddPvmfw(output_zip):
|
||||
"""Adds the pvmfw image.
|
||||
|
||||
Uses the image under IMAGES/ if it already exists. Otherwise looks for the
|
||||
image under PREBUILT_IMAGES/, signs it as needed, and returns the image name.
|
||||
"""
|
||||
img = OutputFile(output_zip, OPTIONS.input_tmp, "IMAGES", "pvmfw.img")
|
||||
if os.path.exists(img.name):
|
||||
logger.info("pvmfw.img already exists; no need to rebuild...")
|
||||
return img.name
|
||||
|
||||
pvmfw_prebuilt_path = os.path.join(
|
||||
OPTIONS.input_tmp, "PREBUILT_IMAGES", "pvmfw.img")
|
||||
assert os.path.exists(pvmfw_prebuilt_path)
|
||||
shutil.copy(pvmfw_prebuilt_path, img.name)
|
||||
|
||||
# AVB-sign the image as needed.
|
||||
if OPTIONS.info_dict.get("avb_enable") == "true":
|
||||
# Signing requires +w
|
||||
os.chmod(img.name, os.stat(img.name).st_mode | stat.S_IWUSR)
|
||||
|
||||
avbtool = OPTIONS.info_dict["avb_avbtool"]
|
||||
part_size = OPTIONS.info_dict["pvmfw_size"]
|
||||
# The AVB hash footer will be replaced if already present.
|
||||
cmd = [avbtool, "add_hash_footer", "--image", img.name,
|
||||
"--partition_size", str(part_size), "--partition_name", "pvmfw"]
|
||||
common.AppendAVBSigningArgs(cmd, "pvmfw")
|
||||
args = OPTIONS.info_dict.get("avb_pvmfw_add_hash_footer_args")
|
||||
if args and args.strip():
|
||||
cmd.extend(shlex.split(args))
|
||||
common.RunAndCheckOutput(cmd)
|
||||
|
||||
img.Write()
|
||||
return img.name
|
||||
|
||||
def AddCustomImages(output_zip, partition_name):
|
||||
"""Adds and signs custom images in IMAGES/.
|
||||
|
||||
|
@ -948,6 +983,10 @@ def AddImagesToTargetFiles(filename):
|
|||
banner("dtbo")
|
||||
partitions['dtbo'] = AddDtbo(output_zip)
|
||||
|
||||
if OPTIONS.info_dict.get("has_pvmfw") == "true":
|
||||
banner("pvmfw")
|
||||
partitions['pvmfw'] = AddPvmfw(output_zip)
|
||||
|
||||
# Custom images.
|
||||
custom_partitions = OPTIONS.info_dict.get(
|
||||
"avb_custom_images_partition_list", "").strip().split()
|
||||
|
|
|
@ -110,9 +110,9 @@ SPECIAL_CERT_STRINGS = ("PRESIGNED", "EXTERNAL")
|
|||
# The partitions allowed to be signed by AVB (Android Verified Boot 2.0). Note
|
||||
# that system_other is not in the list because we don't want to include its
|
||||
# descriptor into vbmeta.img.
|
||||
AVB_PARTITIONS = ('boot', 'dtbo', 'odm', 'product', 'recovery', 'system',
|
||||
'system_ext', 'vendor', 'vendor_boot', 'vendor_dlkm',
|
||||
'odm_dlkm')
|
||||
AVB_PARTITIONS = ('boot', 'dtbo', 'odm', 'product', 'pvmfw', 'recovery',
|
||||
'system', 'system_ext', 'vendor', 'vendor_boot',
|
||||
'vendor_dlkm', 'odm_dlkm')
|
||||
|
||||
# Chained VBMeta partitions.
|
||||
AVB_VBMETA_PARTITIONS = ('vbmeta_system', 'vbmeta_vendor')
|
||||
|
|
Loading…
Reference in New Issue