releasetools: Support generating verify packages.

We can generate a special OTA package that verifies all the partitions
(boot, recovery, system, vendor and etc) on a device. It also calls
device-specific script to verify bootloader and radio images. This
ensures a flashed device contains all the desired images faithfully.

Usage:
ota_from_target_files.py --gen_verify target_files.zip output.zip

Bug: 24679956
Change-Id: Ib3091d98c4b17a6fad305b3edf16d09efbda5c38
This commit is contained in:
Tao Bao
2015-11-09 16:58:28 -08:00
parent 767e3ac246
commit 9bc6bb23b5
3 changed files with 116 additions and 1 deletions

View File

@@ -152,6 +152,15 @@ class EdifyGenerator(object):
"".join([', "%s"' % (i,) for i in sha1]) +
') || abort("\\"%s\\" has unexpected contents.");' % (filename,))
def Verify(self, filename):
"""Check that the given file (or MTD reference) has one of the
given hashes (encoded in the filename)."""
self.script.append(
'apply_patch_check("{filename}") && '
'ui_print(" Verified.") || '
'ui_print("\\"{filename}\\" has unexpected contents.");'.format(
filename=filename))
def FileCheck(self, filename, *sha1):
"""Check that the given file (or MTD reference) has one of the
given *sha1 hashes."""