summaryrefslogtreecommitdiffstats
path: root/tools/releasetools/img_from_target_files
diff options
context:
space:
mode:
Diffstat (limited to 'tools/releasetools/img_from_target_files')
-rwxr-xr-xtools/releasetools/img_from_target_files35
1 files changed, 24 insertions, 11 deletions
diff --git a/tools/releasetools/img_from_target_files b/tools/releasetools/img_from_target_files
index 4a23ab4..c5b9886 100755
--- a/tools/releasetools/img_from_target_files
+++ b/tools/releasetools/img_from_target_files
@@ -23,6 +23,10 @@ Usage: img_from_target_files [flags] input_target_files output_image_zip
-b (--board_config) <file>
Deprecated.
+ -z (--bootable_zip)
+ Include only the bootable images (eg 'boot' and 'recovery') in
+ the output.
+
"""
import sys
@@ -78,7 +82,7 @@ def AddUserdata(output_zip):
build_command.append(user_dir)
build_command.append(img.name)
- p = common.Run(build_command)
+ p = common.Run(build_command);
p.communicate()
assert p.returncode == 0, "build userdata.img image failed"
@@ -149,35 +153,44 @@ def CopyInfo(output_zip):
def main(argv):
+ bootable_only = [False]
def option_handler(o, a):
if o in ("-b", "--board_config"):
pass # deprecated
+ if o in ("-z", "--bootable_zip"):
+ bootable_only[0] = True
else:
return False
return True
args = common.ParseOptions(argv, __doc__,
- extra_opts="b:",
- extra_long_opts=["board_config="],
+ extra_opts="b:z",
+ extra_long_opts=["board_config=",
+ "bootable_zip"],
extra_option_handler=option_handler)
+ bootable_only = bootable_only[0]
+
if len(args) != 2:
common.Usage(__doc__)
sys.exit(1)
- OPTIONS.input_tmp = common.UnzipTemp(args[0])
-
- input_zip = zipfile.ZipFile(args[0], "r")
+ OPTIONS.input_tmp, input_zip = common.UnzipTemp(args[0])
OPTIONS.info_dict = common.LoadInfoDict(input_zip)
output_zip = zipfile.ZipFile(args[1], "w", compression=zipfile.ZIP_DEFLATED)
- common.AddBoot(output_zip, OPTIONS.info_dict)
- common.AddRecovery(output_zip, OPTIONS.info_dict)
- AddSystem(output_zip)
- AddUserdata(output_zip)
- CopyInfo(output_zip)
+ common.GetBootableImage(
+ "boot.img", "boot.img", OPTIONS.input_tmp, "BOOT").AddToZip(output_zip)
+ common.GetBootableImage(
+ "recovery.img", "recovery.img", OPTIONS.input_tmp,
+ "RECOVERY").AddToZip(output_zip)
+
+ if not bootable_only:
+ AddSystem(output_zip)
+ AddUserdata(output_zip)
+ CopyInfo(output_zip)
print "cleaning up..."
output_zip.close()