Allow generating OTA package from non-sparse images.
Test: build OTA package in cuttlefish Bug: 120041578 Change-Id: I246c38e08376c837b7f126aa19cb8c1d73ed1e26
This commit is contained in:
@@ -917,17 +917,14 @@ else if get_stage("%(bcb_dev)s") == "3/3" then
|
||||
|
||||
script.ShowProgress(system_progress, 0)
|
||||
|
||||
# See the notes in WriteBlockIncrementalOTAPackage().
|
||||
allow_shared_blocks = target_info.get('ext4_share_dup_blocks') == "true"
|
||||
|
||||
def GetBlockDifference(partition):
|
||||
# Full OTA is done as an "incremental" against an empty source image. This
|
||||
# has the effect of writing new data from the package to the entire
|
||||
# partition, but lets us reuse the updater code that writes incrementals to
|
||||
# do it.
|
||||
tgt = common.GetSparseImage(partition, OPTIONS.input_tmp, input_zip,
|
||||
allow_shared_blocks)
|
||||
tgt.ResetFileMap()
|
||||
tgt = common.GetUserImage(partition, OPTIONS.input_tmp, input_zip,
|
||||
info_dict=target_info,
|
||||
reset_file_map=True)
|
||||
diff = common.BlockDifference(partition, tgt, src=None)
|
||||
return diff
|
||||
|
||||
@@ -1512,8 +1509,10 @@ def WriteBlockIncrementalOTAPackage(target_zip, source_zip, output_file):
|
||||
device_specific = common.DeviceSpecificParams(
|
||||
source_zip=source_zip,
|
||||
source_version=source_api_version,
|
||||
source_tmp=OPTIONS.source_tmp,
|
||||
target_zip=target_zip,
|
||||
target_version=target_api_version,
|
||||
target_tmp=OPTIONS.target_tmp,
|
||||
output_zip=output_zip,
|
||||
script=script,
|
||||
metadata=metadata,
|
||||
@@ -1529,20 +1528,20 @@ def WriteBlockIncrementalOTAPackage(target_zip, source_zip, output_file):
|
||||
target_recovery = common.GetBootableImage(
|
||||
"/tmp/recovery.img", "recovery.img", OPTIONS.target_tmp, "RECOVERY")
|
||||
|
||||
# When target uses 'BOARD_EXT4_SHARE_DUP_BLOCKS := true', images may contain
|
||||
# shared blocks (i.e. some blocks will show up in multiple files' block
|
||||
# list). We can only allocate such shared blocks to the first "owner", and
|
||||
# disable imgdiff for all later occurrences.
|
||||
# See notes in common.GetUserImage()
|
||||
allow_shared_blocks = (source_info.get('ext4_share_dup_blocks') == "true" or
|
||||
target_info.get('ext4_share_dup_blocks') == "true")
|
||||
system_src = common.GetSparseImage("system", OPTIONS.source_tmp, source_zip,
|
||||
allow_shared_blocks)
|
||||
system_src = common.GetUserImage("system", OPTIONS.source_tmp, source_zip,
|
||||
info_dict=source_info,
|
||||
allow_shared_blocks=allow_shared_blocks)
|
||||
|
||||
hashtree_info_generator = verity_utils.CreateHashtreeInfoGenerator(
|
||||
"system", 4096, target_info)
|
||||
system_tgt = common.GetSparseImage("system", OPTIONS.target_tmp, target_zip,
|
||||
allow_shared_blocks,
|
||||
hashtree_info_generator)
|
||||
system_tgt = common.GetUserImage("system", OPTIONS.target_tmp, target_zip,
|
||||
info_dict=target_info,
|
||||
allow_shared_blocks=allow_shared_blocks,
|
||||
hashtree_info_generator=
|
||||
hashtree_info_generator)
|
||||
|
||||
blockimgdiff_version = max(
|
||||
int(i) for i in target_info.get("blockimgdiff_versions", "1").split(","))
|
||||
@@ -1567,13 +1566,16 @@ def WriteBlockIncrementalOTAPackage(target_zip, source_zip, output_file):
|
||||
if HasVendorPartition(target_zip):
|
||||
if not HasVendorPartition(source_zip):
|
||||
raise RuntimeError("can't generate incremental that adds /vendor")
|
||||
vendor_src = common.GetSparseImage("vendor", OPTIONS.source_tmp, source_zip,
|
||||
allow_shared_blocks)
|
||||
vendor_src = common.GetUserImage("vendor", OPTIONS.source_tmp, source_zip,
|
||||
info_dict=source_info,
|
||||
allow_shared_blocks=allow_shared_blocks)
|
||||
hashtree_info_generator = verity_utils.CreateHashtreeInfoGenerator(
|
||||
"vendor", 4096, target_info)
|
||||
vendor_tgt = common.GetSparseImage(
|
||||
"vendor", OPTIONS.target_tmp, target_zip, allow_shared_blocks,
|
||||
hashtree_info_generator)
|
||||
vendor_tgt = common.GetUserImage(
|
||||
"vendor", OPTIONS.target_tmp, target_zip,
|
||||
info_dict=target_info,
|
||||
allow_shared_blocks=allow_shared_blocks,
|
||||
hashtree_info_generator=hashtree_info_generator)
|
||||
|
||||
# Check first block of vendor partition for remount R/W only if
|
||||
# disk type is ext4
|
||||
|
Reference in New Issue
Block a user