From a00eafc419f18133be7ea66e5ab38efd03d42c9d Mon Sep 17 00:00:00 2001 From: lishutong Date: Mon, 2 Aug 2021 21:53:40 +0000 Subject: [PATCH] Add support for move, bsdiff, imgdiff to OTA analyzer. Now the OTA analyzer could properly parse the installation operations like move, bsdiff, imgdiff in non-A/B packages. It still cannot properly parse the stash and free operations. Which means any operation involve stash-id cannot be parsed properly. Test: tested by a non-A/B incremental OTA package. Change-Id: I08c5ab162e8ed62ea3313ec53b4fa4577a28799a --- tools/ota_analysis/src/services/map_parser.js | 3 +++ tools/ota_analysis/src/services/payload_nonab.js | 14 +++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/tools/ota_analysis/src/services/map_parser.js b/tools/ota_analysis/src/services/map_parser.js index 37b1d1822..6bc16d0d0 100644 --- a/tools/ota_analysis/src/services/map_parser.js +++ b/tools/ota_analysis/src/services/map_parser.js @@ -115,5 +115,8 @@ function InsertMap(map, name, left, right) { function queryMap(map, left, right) { // Assuming the consecutive blocks belong to the same file // Only the start block is queried here. + if (!map[left]) { + return 'unknown' + } return map[left] } \ No newline at end of file diff --git a/tools/ota_analysis/src/services/payload_nonab.js b/tools/ota_analysis/src/services/payload_nonab.js index 5f43401a1..dd0769a7b 100644 --- a/tools/ota_analysis/src/services/payload_nonab.js +++ b/tools/ota_analysis/src/services/payload_nonab.js @@ -53,15 +53,20 @@ export class PayloadNonAB extends chromeos_update_engine.DeltaArchiveManifest{ * zero [rangeset] : fill zeros * new [rangeset] : fill with new data from * erase [rangeset] : mark given blocks as empty - * move <...> - * bsdiff <...> - * imgdiff <...> : + * move <...> + * bsdiff <...> + * imgdiff <...> : * Read the source blocks and apply (not for move op) to the target blocks * stash : load the given source range to memory * free : free the given * format: * [rangeset]: <# of pairs>, , , ... * : a hex number with length of 40 + * <...>: We expect to parse the remainder of the parameter tokens as one of: + * (loads data from source image only) + * - <[stash_id:stash_range] ...> (loads data from stashes only) + * <[stash_id:stash_range] ...> + * (loads data from both source image and stashes) */ partition.operations = new Array() let newDataSize = await this.sizeNewData(partition.partitionName) @@ -87,14 +92,17 @@ export class PayloadNonAB extends chromeos_update_engine.DeltaArchiveManifest{ op.dstExtents = elements.slice(1).reduce(parseRange, []) break case 'move': + op.dstExtents = parseRange([], elements[2]) break case 'bsdiff': op.dataOffset = parseInt(elements[1]) op.dataLength = parseInt(elements[2]) + op.dstExtents = parseRange([], elements[5]) break case 'imgdiff': op.dataOffset = parseInt(elements[1]) op.dataLength = parseInt(elements[2]) + op.dstExtents = parseRange([], elements[5]) break case 'stash': break