fix transfer list for full OTAs

The erase command we insert at the top for full OTAs was getting
inserted in the wrong place for version 2.

Change-Id: I9caf03a40efbdba79f3428f73e50d4319d9ba371
This commit is contained in:
Doug Zongker 2014-09-09 12:38:47 -07:00
parent 846cb3a9e6
commit e985f6f4d8

View file

@ -247,7 +247,6 @@ class BlockImageDiff(object):
def WriteTransfers(self, prefix):
out = []
out.append("%d\n" % (self.version,)) # format version number
total = 0
performs_read = False
@ -372,12 +371,6 @@ class BlockImageDiff(object):
else:
raise ValueError, "unknown transfer style '%s'\n" % (xf.style,)
out.insert(1, str(total) + "\n")
if self.version >= 2:
# version 2 only: after the total block count, we give the number
# of stash slots needed, and the maximum size needed (in blocks)
out.insert(2, str(next_stash_id) + "\n")
out.insert(3, str(max_stashed_blocks) + "\n")
# sanity check: abort if we're going to need more than 512 MB if
# stash space
@ -394,7 +387,15 @@ class BlockImageDiff(object):
else:
# if nothing is read (ie, this is a full OTA), then we can start
# by erasing the entire partition.
out.insert(2, "erase %s\n" % (all_tgt.to_string_raw(),))
out.insert(0, "erase %s\n" % (all_tgt.to_string_raw(),))
out.insert(0, "%d\n" % (self.version,)) # format version number
out.insert(1, str(total) + "\n")
if self.version >= 2:
# version 2 only: after the total block count, we give the number
# of stash slots needed, and the maximum size needed (in blocks)
out.insert(2, str(next_stash_id) + "\n")
out.insert(3, str(max_stashed_blocks) + "\n")
with open(prefix + ".transfer.list", "wb") as f:
for i in out: