diff options
author | Tao Bao <tbao@google.com> | 2015-04-01 17:33:36 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-04-01 17:33:36 +0000 |
commit | 521a8dbd186710d8e68ce8853822edc44ecaa0d9 (patch) | |
tree | b75c2e8b6afffb4dfc6ea3cef078617139b09cdf /tools/releasetools/common.py | |
parent | cb8436b78f8688737bc69a6992aca824e3f11988 (diff) | |
parent | 93d46584170a9aae1728cdb9010eef41e25b4d4a (diff) | |
download | build-521a8dbd186710d8e68ce8853822edc44ecaa0d9.zip build-521a8dbd186710d8e68ce8853822edc44ecaa0d9.tar.gz build-521a8dbd186710d8e68ce8853822edc44ecaa0d9.tar.bz2 |
am 93d46584: am ae26f5b0: am 53602955: Merge "Add support to sign bootable images with vboot_signer"
* commit '93d46584170a9aae1728cdb9010eef41e25b4d4a':
Add support to sign bootable images with vboot_signer
Diffstat (limited to 'tools/releasetools/common.py')
-rw-r--r-- | tools/releasetools/common.py | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py index 1fd9f76..59e81c1 100644 --- a/tools/releasetools/common.py +++ b/tools/releasetools/common.py @@ -348,8 +348,14 @@ def BuildBootableImage(sourcedir, fs_config_file, info_dict=None): if args and args.strip(): cmd.extend(shlex.split(args)) - cmd.extend(["--ramdisk", ramdisk_img.name, - "--output", img.name]) + img_unsigned = None + if info_dict.get("vboot", None): + img_unsigned = tempfile.NamedTemporaryFile() + cmd.extend(["--ramdisk", ramdisk_img.name, + "--output", img_unsigned.name]) + else: + cmd.extend(["--ramdisk", ramdisk_img.name, + "--output", img.name]) p = Run(cmd, stdout=subprocess.PIPE) p.communicate() @@ -365,6 +371,18 @@ def BuildBootableImage(sourcedir, fs_config_file, info_dict=None): p.communicate() assert p.returncode == 0, "boot_signer of %s image failed" % path + # Sign the image if vboot is non-empty. + elif info_dict.get("vboot", None): + path = "/" + os.path.basename(sourcedir).lower() + img_keyblock = tempfile.NamedTemporaryFile() + cmd = [info_dict["vboot_signer_cmd"], info_dict["futility"], + img_unsigned.name, info_dict["vboot_key"] + ".vbpubk", + info_dict["vboot_key"] + ".vbprivk", img_keyblock.name, + img.name] + p = Run(cmd, stdout=subprocess.PIPE) + p.communicate() + assert p.returncode == 0, "vboot_signer of %s image failed" % path + img.seek(os.SEEK_SET, 0) data = img.read() |