GitLab will be updated to 13.0 during this weekend. It may be unavailable between 21:00 and midnight UTC every night Friday-Sunday.

Commit cd9e2fcf authored by Christian Oder's avatar Christian Oder Committed by Nolen Johnson

build: Allow building disabled vbmeta images in signing process

If we sign builds out of tree there's no way to create a disabled vbmeta.img

Tests: Set
BOARD_AVB_ENABLE := false
BOARD_BUILD_DISABLED_VBMETAIMAGE := true
for taimen and follow https://source.android.com/devices/tech/ota/sign_builds
Result: signing will no longer fail due to missing vbmeta.img

Change-Id: If93182d0339d5fbc310373059716a56114d68d89
parent 9b627eb4
...@@ -2600,6 +2600,9 @@ ifdef BOARD_AVB_BOOT_KEY_PATH ...@@ -2600,6 +2600,9 @@ ifdef BOARD_AVB_BOOT_KEY_PATH
$(hide) echo "avb_boot_rollback_index_location=$(BOARD_AVB_BOOT_ROLLBACK_INDEX_LOCATION)" >> $(zip_root)/META/misc_info.txt $(hide) echo "avb_boot_rollback_index_location=$(BOARD_AVB_BOOT_ROLLBACK_INDEX_LOCATION)" >> $(zip_root)/META/misc_info.txt
endif # BOARD_AVB_BOOT_KEY_PATH endif # BOARD_AVB_BOOT_KEY_PATH
endif # BOARD_AVB_ENABLE endif # BOARD_AVB_ENABLE
ifeq ($(BOARD_BUILD_DISABLED_VBMETAIMAGE),true)
$(hide) echo "avb_disabled_vbmeta=true" >> $(zip_root)/META/misc_info.txt
endif # BOARD_BUILD_DISABLED_VBMETAIMAGE
ifdef BOARD_BPT_INPUT_FILES ifdef BOARD_BPT_INPUT_FILES
$(hide) echo "board_bpt_enable=true" >> $(zip_root)/META/misc_info.txt $(hide) echo "board_bpt_enable=true" >> $(zip_root)/META/misc_info.txt
$(hide) echo "board_bpt_make_table_args=$(BOARD_BPT_MAKE_TABLE_ARGS)" >> $(zip_root)/META/misc_info.txt $(hide) echo "board_bpt_make_table_args=$(BOARD_BPT_MAKE_TABLE_ARGS)" >> $(zip_root)/META/misc_info.txt
......
...@@ -418,6 +418,23 @@ def AddVBMeta(output_zip, boot_img_path, system_img_path, vendor_img_path, ...@@ -418,6 +418,23 @@ def AddVBMeta(output_zip, boot_img_path, system_img_path, vendor_img_path,
assert p.returncode == 0, "avbtool make_vbmeta_image failed" assert p.returncode == 0, "avbtool make_vbmeta_image failed"
img.Write() img.Write()
def AddDisabledVBMeta(output_zip):
"""Creates a disabled VBMeta image and store it in output_zip.
Args:
output_zip: The output zip file, which needs to be already open.
"""
img = OutputFile(output_zip, OPTIONS.input_tmp, "IMAGES", "vbmeta.img")
if os.path.exists(img.input_name):
print("vbmeta.img already exists; not rebuilding...")
return img.input_name
avbtool = os.getenv('AVBTOOL') or OPTIONS.info_dict["avb_avbtool"]
cmd = [avbtool, "make_vbmeta_image", "--flag", "2", "--padding_size", "4096", "--output", img.name]
p = common.Run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
p.communicate()
assert p.returncode == 0, "avbtool make_vbmeta_image failed"
img.Write()
def AddPartitionTable(output_zip, prefix="IMAGES/"): def AddPartitionTable(output_zip, prefix="IMAGES/"):
"""Create a partition table image and store it in output_zip.""" """Create a partition table image and store it in output_zip."""
...@@ -640,6 +657,10 @@ def AddImagesToTargetFiles(filename): ...@@ -640,6 +657,10 @@ def AddImagesToTargetFiles(filename):
AddVBMeta(output_zip, boot_contents.name, system_img_path, AddVBMeta(output_zip, boot_contents.name, system_img_path,
vendor_img_path, dtbo_img_path) vendor_img_path, dtbo_img_path)
if OPTIONS.info_dict.get("avb_disabled_vbmeta") == "true":
banner("vbmeta")
AddDisabledVBMeta(output_zip)
# For devices using A/B update, copy over images from RADIO/ and/or # For devices using A/B update, copy over images from RADIO/ and/or
# VENDOR_IMAGES/ to IMAGES/ and make sure we have all the needed # VENDOR_IMAGES/ to IMAGES/ and make sure we have all the needed
# images ready under IMAGES/. All images should have '.img' as extension. # images ready under IMAGES/. All images should have '.img' as extension.
......
...@@ -654,6 +654,7 @@ def ImagePropFromGlobalDict(glob_dict, mount_point): ...@@ -654,6 +654,7 @@ def ImagePropFromGlobalDict(glob_dict, mount_point):
"verity_signer_cmd", "verity_signer_cmd",
"verity_fec", "verity_fec",
"avb_enable", "avb_enable",
"avb_disabled_vbmeta",
"avb_avbtool", "avb_avbtool",
"avb_salt", "avb_salt",
) )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment