releasetools: Pass non-sparse super_empty.img to update_dynamic_partitions()
* So that updater program can load dynamic partitions metadata from OTA when it fails to load from the device Change-Id: I73687009a2cb243aba1bfec6f357c8ff25f27784
This commit is contained in:
parent
28e997681e
commit
4080494752
4 changed files with 33 additions and 9 deletions
|
@ -787,9 +787,16 @@ def AddSuperEmpty(output_zip):
|
|||
img = OutputFile(output_zip, OPTIONS.input_tmp, "IMAGES", "super_empty.img")
|
||||
if os.path.exists(img.name):
|
||||
logger.info("super_empty.img already exists; no need to rebuild...")
|
||||
return
|
||||
build_super_image.BuildSuperImage(OPTIONS.info_dict, img.name)
|
||||
img.Write()
|
||||
else:
|
||||
build_super_image.BuildSuperImage(OPTIONS.info_dict, img.name)
|
||||
img.Write()
|
||||
|
||||
unsparse_img = OutputFile(output_zip, OPTIONS.input_tmp, "IMAGES", "unsparse_super_empty.img")
|
||||
if os.path.exists(unsparse_img.name):
|
||||
logger.info("unsparse_super_empty.img already exists; no need to rebuild...")
|
||||
else:
|
||||
build_super_image.BuildSuperImage(OPTIONS.info_dict, unsparse_img.name, force_non_sparse=True)
|
||||
unsparse_img.Write()
|
||||
|
||||
|
||||
def AddSuperSplit(output_zip):
|
||||
|
|
|
@ -69,7 +69,7 @@ def GetArgumentsForImage(partition, group, image=None):
|
|||
return cmd
|
||||
|
||||
|
||||
def BuildSuperImageFromDict(info_dict, output):
|
||||
def BuildSuperImageFromDict(info_dict, output, force_non_sparse=False):
|
||||
|
||||
cmd = [info_dict["lpmake"],
|
||||
"--metadata-size", "65536",
|
||||
|
@ -133,7 +133,7 @@ def BuildSuperImageFromDict(info_dict, output):
|
|||
|
||||
cmd += GetArgumentsForImage(partition + "_b", group + "_b", other_image)
|
||||
|
||||
if info_dict.get("build_non_sparse_super_partition") != "true":
|
||||
if info_dict.get("build_non_sparse_super_partition") != "true" and not force_non_sparse:
|
||||
cmd.append("--sparse")
|
||||
|
||||
cmd += ["--output", output]
|
||||
|
@ -178,11 +178,11 @@ def BuildSuperImageFromTargetFiles(inp, out):
|
|||
return BuildSuperImageFromExtractedTargetFiles(input_tmp, out)
|
||||
|
||||
|
||||
def BuildSuperImage(inp, out):
|
||||
def BuildSuperImage(inp, out, force_non_sparse=False):
|
||||
|
||||
if isinstance(inp, dict):
|
||||
logger.info("Building super image from info dict...")
|
||||
return BuildSuperImageFromDict(inp, out)
|
||||
return BuildSuperImageFromDict(inp, out, force_non_sparse=False)
|
||||
|
||||
if isinstance(inp, str):
|
||||
if os.path.isdir(inp):
|
||||
|
|
|
@ -3932,6 +3932,9 @@ class DynamicPartitionsDifference(object):
|
|||
if progress_dict is None:
|
||||
progress_dict = {}
|
||||
|
||||
self._have_super_empty = \
|
||||
info_dict.get("build_super_empty_partition") == "true"
|
||||
|
||||
self._build_without_vendor = build_without_vendor
|
||||
self._remove_all_before_apply = False
|
||||
if source_info_dict is None:
|
||||
|
@ -4029,8 +4032,13 @@ class DynamicPartitionsDifference(object):
|
|||
ZipWrite(output_zip, op_list_path, "dynamic_partitions_op_list")
|
||||
|
||||
script.Comment('Update dynamic partition metadata')
|
||||
script.AppendExtra('assert(update_dynamic_partitions('
|
||||
'package_extract_file("dynamic_partitions_op_list")));')
|
||||
if self._have_super_empty:
|
||||
script.AppendExtra('assert(update_dynamic_partitions('
|
||||
'package_extract_file("dynamic_partitions_op_list"), '
|
||||
'package_extract_file("unsparse_super_empty.img")));')
|
||||
else:
|
||||
script.AppendExtra('assert(update_dynamic_partitions('
|
||||
'package_extract_file("dynamic_partitions_op_list")));')
|
||||
|
||||
if write_verify_script:
|
||||
for p, u in self._partition_updates.items():
|
||||
|
|
|
@ -233,6 +233,15 @@ else if get_stage("%(bcb_dev)s") == "3/3" then
|
|||
progress_dict["system"] = system_progress
|
||||
|
||||
if target_info.get('use_dynamic_partitions') == "true":
|
||||
# Add non-sparse super empty image to OTA package if it exists
|
||||
if target_info.get('build_super_empty_partition') == "true":
|
||||
unsparse_super_empty_image_name = "unsparse_super_empty.img"
|
||||
unsparse_super_empty_image_path = os.path.join(OPTIONS.input_tmp, "IMAGES",
|
||||
unsparse_super_empty_image_name)
|
||||
unsparse_super_empty_image = common.File.FromLocalFile(
|
||||
unsparse_super_empty_image_name, unsparse_super_empty_image_path)
|
||||
common.ZipWriteStr(output_zip, unsparse_super_empty_image_name,
|
||||
unsparse_super_empty_image.data)
|
||||
# Use empty source_info_dict to indicate that all partitions / groups must
|
||||
# be re-added.
|
||||
dynamic_partitions_diff = common.DynamicPartitionsDifference(
|
||||
|
|
Loading…
Reference in a new issue