Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit dfad36f5 authored by Christian Oder's avatar Christian Oder Committed by Rashed Abdel-Tawab
Browse files

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 db9ace80
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -2807,6 +2807,9 @@ ifdef BOARD_AVB_RECOVERY_KEY_PATH
	$(hide) echo "avb_recovery_rollback_index_location=$(BOARD_AVB_RECOVERY_ROLLBACK_INDEX_LOCATION)" >> $(zip_root)/META/misc_info.txt
endif # BOARD_AVB_RECOVERY_KEY_PATH
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
	$(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
+21 −0
Original line number Diff line number Diff line
@@ -420,6 +420,23 @@ def AddVBMeta(output_zip, partitions):
  assert p.returncode == 0, "avbtool make_vbmeta_image failed"
  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):
  """Create a partition table image and store it in output_zip."""
@@ -756,6 +773,10 @@ def AddImagesToTargetFiles(filename):
    banner("vbmeta")
    AddVBMeta(output_zip, partitions)

  if OPTIONS.info_dict.get("avb_disabled_vbmeta") == "true":
    banner("vbmeta")
    AddDisabledVBMeta(output_zip)

  banner("radio")
  ab_partitions_txt = os.path.join(OPTIONS.input_tmp, "META",
                                   "ab_partitions.txt")
+1 −0
Original line number Diff line number Diff line
@@ -713,6 +713,7 @@ def ImagePropFromGlobalDict(glob_dict, mount_point):
      "verity_fec",
      "verity_disable",
      "avb_enable",
      "avb_disabled_vbmeta",
      "avb_avbtool",
      "avb_salt",
  )