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
diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py
index e47c038..4479bed 100755
--- a/tools/releasetools/add_img_to_target_files.py
+++ b/tools/releasetools/add_img_to_target_files.py
@@ -625,6 +625,22 @@
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 @@
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")