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
This commit is contained in:
@@ -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()
|
||||
|
||||
|
Reference in New Issue
Block a user