Skip to content

Commit

Permalink
Merge pull request #17 from vasishath/master
Browse files Browse the repository at this point in the history
Add optional argument to specify images to extract
  • Loading branch information
vm03 authored Jul 7, 2021
2 parents 6fffb9e + 876d660 commit dde7651
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions payload_dumper.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ def dump_part(part):
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)')
parser.add_argument('--images', default="",
help='images to extract (default: empty)')
args = parser.parse_args()

#Check for --out directory exists
Expand Down Expand Up @@ -150,12 +152,15 @@ def dump_part(part):
dam.ParseFromString(manifest)
block_size = dam.block_size

for part in dam.partitions:
# for op in part.operations:
# assert op.type in (op.REPLACE, op.REPLACE_BZ, op.REPLACE_XZ), \
# 'unsupported op'
if args.images == "":
for part in dam.partitions:
dump_part(part)
else:
images = args.images.split(",")
for image in images:
partition = [part for part in dam.partitions if part.partition_name == image]
if partition:
dump_part(partition[0])
else:
sys.stderr.write("Partition %s not found in payload!\n" % image)

# extents = flatten([op.dst_extents for op in part.operations])
# assert verify_contiguous(extents), 'operations do not span full image'

dump_part(part)

0 comments on commit dde7651

Please sign in to comment.