Add super_empty.img to target-files and the update package.

super_empty.img is needed for "fastboot update" to work, as such, it
must be included in the update package. This change adds lpmake
parameters to misc_info.txt for add_img_to_target_files.py, and ensures
that lpmake is packaged with otatools.zip.

The build-superimage-target macro is now split into two functions - one
to generate the device-specific arguments, and another to build the full
command-line for convenience. The former is used to pass arguments
directly to add_img_to_target_files.

Bug: 113524256
Test: make updatepackage builds and includes super_empty.img
      make otatools includes lpmake

Change-Id: I25091c964b036beeea2a8b8f738e2c18937c1eb4
This commit is contained in:
David Anderson
2018-08-30 13:11:47 -07:00
parent acdaa8fbac
commit 1ef03e2b79
3 changed files with 50 additions and 12 deletions

View File

@@ -625,6 +625,22 @@ def AddPackRadioImages(output_zip, images):
shutil.copy(img_radio_path, prebuilt_path)
def AddSuperEmpty(output_zip):
"""Create a super_empty.img and store it in output_zip."""
img = OutputFile(output_zip, OPTIONS.input_tmp, "IMAGES", "super_empty.img")
cmd = [OPTIONS.info_dict.get('lpmake')]
cmd += shlex.split(OPTIONS.info_dict.get('lpmake_args').strip())
cmd += ['--output', img.name]
p = common.Run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdoutdata, _ = p.communicate()
assert p.returncode == 0, \
"lpmake tool failed:\n{}".format(stdoutdata)
img.Write()
def ReplaceUpdatedFiles(zip_filename, files_list):
"""Updates all the ZIP entries listed in files_list.
@@ -793,6 +809,10 @@ def AddImagesToTargetFiles(filename):
banner("vbmeta")
AddVBMeta(output_zip, partitions)
if OPTIONS.info_dict.get("super_size"):
banner("super_empty")
AddSuperEmpty(output_zip)
banner("radio")
ab_partitions_txt = os.path.join(OPTIONS.input_tmp, "META",
"ab_partitions.txt")