diff options
author | Amin Hassani <ahassani@google.com> | 2017-10-11 10:27:27 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-10-16 14:14:00 -0700 |
commit | ae85374770d4492d28e62d792824eea55349c981 (patch) | |
tree | 6c9a2649d1cba64a81982927d965becb318cde90 /scripts/update_payload/checker.py | |
parent | a6f74d62033fb0291aa1d135fef640e26ffffab5 (diff) |
update_payload: Fix larger source issue
the _CheckOperations() function passes the new usable partition size as the old
usable partition size. If the source image is larger than the target image,
this will be errornous as some checks fail.
BUG=chromium:773336
TEST=scripts/paycheck.py --check delta.bin (10002.0.0 reef -> 10019.0.0 reef)
Change-Id: I8c30129831daff8e70df3dcb9639ff240e4a37ba
Reviewed-on: https://chromium-review.googlesource.com/713463
Commit-Ready: Amin Hassani <ahassani@chromium.org>
Tested-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Amin Hassani <ahassani@chromium.org>
Diffstat (limited to 'scripts/update_payload/checker.py')
-rw-r--r-- | scripts/update_payload/checker.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/scripts/update_payload/checker.py b/scripts/update_payload/checker.py index 31443959..74044083 100644 --- a/scripts/update_payload/checker.py +++ b/scripts/update_payload/checker.py @@ -1011,8 +1011,8 @@ class PayloadChecker(object): itertools.repeat(0, self._SizeToNumBlocks(total_size))) def _CheckOperations(self, operations, report, base_name, old_fs_size, - new_fs_size, new_usable_size, prev_data_offset, - allow_signature): + new_fs_size, old_usable_size, new_usable_size, + prev_data_offset, allow_signature): """Checks a sequence of update operations. Args: @@ -1021,6 +1021,7 @@ class PayloadChecker(object): base_name: The name of the operation block. old_fs_size: The old filesystem size in bytes. new_fs_size: The new filesystem size in bytes. + old_usable_size: The overall usable size of the old partition in bytes. new_usable_size: The overall usable size of the new partition in bytes. prev_data_offset: Offset of last used data bytes. allow_signature: Whether this sequence may contain signature operations. @@ -1062,7 +1063,7 @@ class PayloadChecker(object): blob_hash_counts['signature'] = 0 # Allocate old and new block counters. - old_block_counters = (self._AllocBlockCounters(new_usable_size) + old_block_counters = (self._AllocBlockCounters(old_usable_size) if old_fs_size else None) new_block_counters = self._AllocBlockCounters(new_usable_size) @@ -1079,7 +1080,7 @@ class PayloadChecker(object): is_last = op_num == len(operations) curr_data_used = self._CheckOperation( op, op_name, is_last, old_block_counters, new_block_counters, - new_usable_size if old_fs_size else 0, new_usable_size, + old_usable_size, new_usable_size, prev_data_offset + total_data_used, allow_signature, blob_hash_counts) if curr_data_used: @@ -1229,10 +1230,13 @@ class PayloadChecker(object): # exceed the filesystem size when moving data blocks around. # - Otherwise, use the encoded filesystem size. new_rootfs_usable_size = self.new_rootfs_fs_size + old_rootfs_usable_size = self.old_rootfs_fs_size if rootfs_part_size: new_rootfs_usable_size = rootfs_part_size + old_rootfs_usable_size = rootfs_part_size elif self.payload_type == _TYPE_DELTA and self.minor_version in (None, 1): new_rootfs_usable_size = _OLD_DELTA_USABLE_PART_SIZE + old_rootfs_usable_size = _OLD_DELTA_USABLE_PART_SIZE # Part 3: Examine rootfs operations. # TODO(garnold)(chromium:243559) only default to the filesystem size if @@ -1242,7 +1246,8 @@ class PayloadChecker(object): total_blob_size = self._CheckOperations( self.payload.manifest.install_operations, report, 'install_operations', self.old_rootfs_fs_size, - self.new_rootfs_fs_size, new_rootfs_usable_size, 0, False) + self.new_rootfs_fs_size, old_rootfs_usable_size, + new_rootfs_usable_size, 0, False) # Part 4: Examine kernel operations. # TODO(garnold)(chromium:243559) as above. @@ -1251,6 +1256,7 @@ class PayloadChecker(object): self.payload.manifest.kernel_install_operations, report, 'kernel_install_operations', self.old_kernel_fs_size, self.new_kernel_fs_size, + kernel_part_size if kernel_part_size else self.old_kernel_fs_size, kernel_part_size if kernel_part_size else self.new_kernel_fs_size, total_blob_size, True) |