update_payload: Allow specifying partition options for major version 2
This commit adds the ability to specify partition options for more than just
kernel/rootfs.
This supersedes -p/--root-part-size, -P/--kern-part-size, --dst_kern,
--dst_root, --src_kern, --src_root, --out_dst_kern, and --out_dst_root.
They are replaced by --part_names used in conjunction with --part_sizes,
--dst_part_paths, --src_part_paths, and --out_dst_part_paths.
Backwards-compatibility with the old flags is kept, so long as they are
not used alongside the new flags.
BUG=b:794404
TEST=no errors during run_unittests and test_paycheck.sh
Change-Id: Icc1118abbf89dd268be3eafe41723657c5178197
Reviewed-on: https://chromium-review.googlesource.com/1103063
Commit-Ready: Tudor Brindus <tbrindus@chromium.org>
Tested-by: Tudor Brindus <tbrindus@chromium.org>
Reviewed-by: Amin Hassani <ahassani@chromium.org>
diff --git a/scripts/update_payload/applier.py b/scripts/update_payload/applier.py
index 9582b3d..dad5ba3 100644
--- a/scripts/update_payload/applier.py
+++ b/scripts/update_payload/applier.py
@@ -622,21 +622,24 @@
_VerifySha256(new_part_file, new_part_info.hash,
'new ' + part_name, length=new_part_info.size)
- def Run(self, new_kernel_part, new_rootfs_part, old_kernel_part=None,
- old_rootfs_part=None):
+ def Run(self, new_parts, old_parts=None):
"""Applier entry point, invoking all update operations.
Args:
- new_kernel_part: name of dest kernel partition file
- new_rootfs_part: name of dest rootfs partition file
- old_kernel_part: name of source kernel partition file (optional)
- old_rootfs_part: name of source rootfs partition file (optional)
+ new_parts: map of partition name to dest partition file
+ old_parts: map of partition name to source partition file (optional)
Raises:
PayloadError if payload application failed.
"""
self.payload.ResetFile()
+ # TODO(tbrindus): make payload applying work for major version 2 partitions
+ new_kernel_part = new_parts[common.KERNEL]
+ new_rootfs_part = new_parts[common.ROOTFS]
+ old_kernel_part = old_parts.get(common.KERNEL, None) if old_parts else None
+ old_rootfs_part = old_parts.get(common.ROOTFS, None) if old_parts else None
+
# Make sure the arguments are sane and match the payload.
if not (new_kernel_part and new_rootfs_part):
raise PayloadError('missing dst {kernel,rootfs} partitions')