From c4f737406ada95198ee009a48830dd6ab9dd3e65 Mon Sep 17 00:00:00 2001 From: Kelvin Zhang Date: Wed, 30 Aug 2023 14:41:40 -0700 Subject: [PATCH] Mark boot OTAs as partial OTAs Boot partition only OTA must be marked as "partial". This is required for update_engine to correctly copy non-updated partitions to the target slot. Test: th Bug: 293313353 Change-Id: Ic89d03f214e12fa43f686d37854d6fed1d78a6a3 --- tools/releasetools/ota_from_raw_img.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/releasetools/ota_from_raw_img.py b/tools/releasetools/ota_from_raw_img.py index 37504d19ad..63f88ea925 100644 --- a/tools/releasetools/ota_from_raw_img.py +++ b/tools/releasetools/ota_from_raw_img.py @@ -71,16 +71,22 @@ def main(argv): if not args.partition_names: args.partition_names = [os.path.os.path.splitext(os.path.basename(path))[ 0] for path in args.images] - with tempfile.NamedTemporaryFile() as unsigned_payload: + with tempfile.NamedTemporaryFile() as unsigned_payload, tempfile.NamedTemporaryFile() as dynamic_partition_info_file: + dynamic_partition_info_file.writelines( + [b"virtual_ab=true\n", b"super_partition_groups=\n"]) + dynamic_partition_info_file.flush() cmd = [ResolveBinaryPath("delta_generator", args.search_path)] cmd.append("--partition_names=" + ",".join(args.partition_names)) + cmd.append("--dynamic_partition_info_file=" + + dynamic_partition_info_file.name) cmd.append("--new_partitions=" + ",".join(args.images)) cmd.append("--out_file=" + unsigned_payload.name) + cmd.append("--is_partial_update") if args.max_timestamp: cmd.append("--max_timestamp=" + str(args.max_timestamp)) logger.info("Running %s", cmd) - subprocess.run(cmd) + subprocess.check_call(cmd) generator = PayloadGenerator() generator.payload_file = unsigned_payload.name logger.info("Payload size: %d", os.path.getsize(generator.payload_file))