From b1a9e080b446f09788d73645c42e2e78ae6f2d15 Mon Sep 17 00:00:00 2001 From: Shashikant Baviskar Date: Thu, 12 Apr 2018 12:37:21 +0900 Subject: A/B update: Replace the zip FileHeader mechanism for update package When the update package gets larger than 2 GiB, payload.bin offset mentioned in metadata file for ota-streaming-property-files gets shifted (CrAU of payload.bin) because ZipInfo FileHeader() returns incorrect value. To solve the issue, offset is re-calculated from fixed bytes of central directory file header, filename length and extra length. Test: manually create an A/B update package and run it using update_device.py Bug: 111198589 Change-Id: Iadb2e8bbff478d9b006bb155d57fea35968d84b7 --- scripts/update_device.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'scripts/update_device.py') diff --git a/scripts/update_device.py b/scripts/update_device.py index 64cfbe3b..5c19b89a 100755 --- a/scripts/update_device.py +++ b/scripts/update_device.py @@ -89,7 +89,9 @@ class AndroidOTAPackage(object): otazip = zipfile.ZipFile(otafilename, 'r') payload_info = otazip.getinfo(self.OTA_PAYLOAD_BIN) - self.offset = payload_info.header_offset + len(payload_info.FileHeader()) + self.offset = payload_info.header_offset + self.offset += zipfile.sizeFileHeader + self.offset += len(payload_info.extra) + len(payload_info.filename) self.size = payload_info.file_size self.properties = otazip.read(self.OTA_PAYLOAD_PROPERTIES_TXT) -- cgit v1.2.3