Skip to content

Commit

Permalink
add option for differential OTA
Browse files Browse the repository at this point in the history
  • Loading branch information
vm03 committed Aug 20, 2019
1 parent 5170d8a commit cbdce5e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Empty file added old/.gitkeep
Empty file.
15 changes: 12 additions & 3 deletions payload_dumper.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def verify_contiguous(exts):

return True

def data_for_op(op,out_file):
def data_for_op(op,out_file,old_file):
args.payloadfile.seek(data_offset + op.data_offset)
data = args.payloadfile.read(op.data_length)

Expand Down Expand Up @@ -61,15 +61,24 @@ def dump_part(part):
out_file = open('%s/%s.img' % (args.out, part.partition_name), 'wb')
h = hashlib.sha256()

if args.diff:
old_file = open('%s/%s.img' % (args.old, part.partition_name), 'rb')
else:
old_file = None

for op in part.operations:
data = data_for_op(op,out_file)
data = data_for_op(op,out_file,old_file)


parser = argparse.ArgumentParser(description='OTA payload dumper')
parser.add_argument('payloadfile', type=argparse.FileType('rb'),
help='payload file name')
parser.add_argument('--out', default='output',
help='output directory')
help='output directory (defaul: output)')
parser.add_argument('--diff',action='store_true',
help='extract differential OTA, you need put original images to old dir')
parser.add_argument('--old', default='old',
help='directory with original images for differential OTA (defaul: old)')
args = parser.parse_args()

magic = args.payloadfile.read(4)
Expand Down

0 comments on commit cbdce5e

Please sign in to comment.