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
This commit is contained in:
lishutong
2021-08-02 21:53:40 +00:00
parent 5bf9ad0eed
commit a00eafc419
2 changed files with 14 additions and 3 deletions

View File

@@ -115,5 +115,8 @@ function InsertMap(map, name, left, right) {
function queryMap(map, left, right) { function queryMap(map, left, right) {
// Assuming the consecutive blocks belong to the same file // Assuming the consecutive blocks belong to the same file
// Only the start block is queried here. // Only the start block is queried here.
if (!map[left]) {
return 'unknown'
}
return map[left] return map[left]
} }

View File

@@ -53,15 +53,20 @@ export class PayloadNonAB extends chromeos_update_engine.DeltaArchiveManifest{
* zero [rangeset] : fill zeros * zero [rangeset] : fill zeros
* new [rangeset] : fill with new data from <partitionName.new.data> * new [rangeset] : fill with new data from <partitionName.new.data>
* erase [rangeset] : mark given blocks as empty * erase [rangeset] : mark given blocks as empty
* move <...> * move <src_hash> <...>
* bsdiff <patchstart> <patchlen> <...> * bsdiff <patchstart> <patchlen> <src_hash> <tgt_hash> <...>
* imgdiff <patchstart> <patchlen> <...> : * imgdiff <patchstart> <patchlen> <src_hash> <tgt_hash> <...> :
* Read the source blocks and apply (not for move op) to the target blocks * Read the source blocks and apply (not for move op) to the target blocks
* stash <stash_id> <src_range> : load the given source range to memory * stash <stash_id> <src_range> : load the given source range to memory
* free <stash_id> : free the given <stash_id> * free <stash_id> : free the given <stash_id>
* format: * format:
* [rangeset]: <# of pairs>, <pair A start>, <pair A end>, ... * [rangeset]: <# of pairs>, <pair A start>, <pair A end>, ...
* <stash_id>: a hex number with length of 40 * <stash_id>: a hex number with length of 40
* <...>: We expect to parse the remainder of the parameter tokens as one of:
* <tgt_range> <src_block_count> <src_range> (loads data from source image only)
* <tgt_range> <src_block_count> - <[stash_id:stash_range] ...> (loads data from stashes only)
* <tgt_range> <src_block_count> <src_range> <src_loc> <[stash_id:stash_range] ...>
* (loads data from both source image and stashes)
*/ */
partition.operations = new Array() partition.operations = new Array()
let newDataSize = await this.sizeNewData(partition.partitionName) 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, []) op.dstExtents = elements.slice(1).reduce(parseRange, [])
break break
case 'move': case 'move':
op.dstExtents = parseRange([], elements[2])
break break
case 'bsdiff': case 'bsdiff':
op.dataOffset = parseInt(elements[1]) op.dataOffset = parseInt(elements[1])
op.dataLength = parseInt(elements[2]) op.dataLength = parseInt(elements[2])
op.dstExtents = parseRange([], elements[5])
break break
case 'imgdiff': case 'imgdiff':
op.dataOffset = parseInt(elements[1]) op.dataOffset = parseInt(elements[1])
op.dataLength = parseInt(elements[2]) op.dataLength = parseInt(elements[2])
op.dstExtents = parseRange([], elements[5])
break break
case 'stash': case 'stash':
break break