Alex Deymo | aea4c1c | 2015-08-19 20:24:43 -0700 | [diff] [blame] | 1 | // |
| 2 | // Copyright (C) 2010 The Android Open Source Project |
| 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 | // |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 16 | |
Sen Jiang | cb13124 | 2019-01-22 17:07:58 -0800 | [diff] [blame] | 17 | // Update file format: An update file contains all the operations needed |
| 18 | // to update a system to a specific version. It can be a full payload which |
| 19 | // can update from any version, or a delta payload which can only update |
| 20 | // from a specific version. |
| 21 | // The update format is represented by this struct pseudocode: |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 22 | // struct delta_update_file { |
| 23 | // char magic[4] = "CrAU"; |
Sen Jiang | cb13124 | 2019-01-22 17:07:58 -0800 | [diff] [blame] | 24 | // uint64 file_format_version; // payload major version |
Andrew de los Reyes | 1e338b8 | 2010-01-22 14:57:27 -0800 | [diff] [blame] | 25 | // uint64 manifest_size; // Size of protobuf DeltaArchiveManifest |
Alex Deymo | c1d7f12 | 2015-09-10 15:15:42 -0700 | [diff] [blame] | 26 | // |
Sen Jiang | cb13124 | 2019-01-22 17:07:58 -0800 | [diff] [blame] | 27 | // // Only present if format_version >= 2: |
Alex Deymo | c1d7f12 | 2015-09-10 15:15:42 -0700 | [diff] [blame] | 28 | // uint32 metadata_signature_size; |
| 29 | // |
Sen Jiang | cb13124 | 2019-01-22 17:07:58 -0800 | [diff] [blame] | 30 | // // The DeltaArchiveManifest protobuf serialized, not compressed. |
| 31 | // char manifest[manifest_size]; |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 32 | // |
Alex Deymo | c1d7f12 | 2015-09-10 15:15:42 -0700 | [diff] [blame] | 33 | // // The signature of the metadata (from the beginning of the payload up to |
| 34 | // // this location, not including the signature itself). This is a serialized |
| 35 | // // Signatures message. |
Sen Jiang | cb13124 | 2019-01-22 17:07:58 -0800 | [diff] [blame] | 36 | // char metadata_signature_message[metadata_signature_size]; |
Alex Deymo | c1d7f12 | 2015-09-10 15:15:42 -0700 | [diff] [blame] | 37 | // |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 38 | // // Data blobs for files, no specific format. The specific offset |
| 39 | // // and length of each data blob is recorded in the DeltaArchiveManifest. |
| 40 | // struct { |
| 41 | // char data[]; |
| 42 | // } blobs[]; |
| 43 | // |
Sen Jiang | cb13124 | 2019-01-22 17:07:58 -0800 | [diff] [blame] | 44 | // // The signature of the entire payload, everything up to this location, |
| 45 | // // except that metadata_signature_message is skipped to simplify signing |
| 46 | // // process. These two are not signed: |
Alex Deymo | c1d7f12 | 2015-09-10 15:15:42 -0700 | [diff] [blame] | 47 | // uint64 payload_signatures_message_size; |
Sen Jiang | cb13124 | 2019-01-22 17:07:58 -0800 | [diff] [blame] | 48 | // // This is a serialized Signatures message. |
| 49 | // char payload_signatures_message[payload_signatures_message_size]; |
Andrew de los Reyes | 94f025d | 2010-08-16 17:17:27 -0700 | [diff] [blame] | 50 | // |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 51 | // }; |
| 52 | |
Andrew de los Reyes | 1e338b8 | 2010-01-22 14:57:27 -0800 | [diff] [blame] | 53 | // The DeltaArchiveManifest protobuf is an ordered list of InstallOperation |
| 54 | // objects. These objects are stored in a linear array in the |
| 55 | // DeltaArchiveManifest. Each operation is applied in order by the client. |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 56 | |
Andrew de los Reyes | 1e338b8 | 2010-01-22 14:57:27 -0800 | [diff] [blame] | 57 | // The DeltaArchiveManifest also contains the initial and final |
| 58 | // checksums for the device. |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 59 | |
Andrew de los Reyes | 1e338b8 | 2010-01-22 14:57:27 -0800 | [diff] [blame] | 60 | // The client will perform each InstallOperation in order, beginning even |
| 61 | // before the entire delta file is downloaded (but after at least the |
| 62 | // protobuf is downloaded). The types of operations are explained: |
| 63 | // - REPLACE: Replace the dst_extents on the drive with the attached data, |
| 64 | // zero padding out to block size. |
| 65 | // - REPLACE_BZ: bzip2-uncompress the attached data and write it into |
| 66 | // dst_extents on the drive, zero padding to block size. |
| 67 | // - MOVE: Copy the data in src_extents to dst_extents. Extents may overlap, |
| 68 | // so it may be desirable to read all src_extents data into memory before |
Sen Jiang | cb13124 | 2019-01-22 17:07:58 -0800 | [diff] [blame] | 69 | // writing it out. (deprecated) |
Alex Deymo | c1d7f12 | 2015-09-10 15:15:42 -0700 | [diff] [blame] | 70 | // - SOURCE_COPY: Copy the data in src_extents in the old partition to |
| 71 | // dst_extents in the new partition. There's no overlapping of data because |
| 72 | // the extents are in different partitions. |
Andrew de los Reyes | 1e338b8 | 2010-01-22 14:57:27 -0800 | [diff] [blame] | 73 | // - BSDIFF: Read src_length bytes from src_extents into memory, perform |
| 74 | // bspatch with attached data, write new data to dst_extents, zero padding |
Sen Jiang | cb13124 | 2019-01-22 17:07:58 -0800 | [diff] [blame] | 75 | // to block size. (deprecated) |
Alex Deymo | c1d7f12 | 2015-09-10 15:15:42 -0700 | [diff] [blame] | 76 | // - SOURCE_BSDIFF: Read the data in src_extents in the old partition, perform |
| 77 | // bspatch with the attached data and write the new data to dst_extents in the |
| 78 | // new partition. |
| 79 | // - ZERO: Write zeros to the destination dst_extents. |
| 80 | // - DISCARD: Discard the destination dst_extents blocks on the physical medium. |
Andrew Lassalle | d04ca0c | 2019-11-18 11:33:57 -0800 | [diff] [blame] | 81 | // the data read from those blocks is undefined. |
Alex Deymo | c1d7f12 | 2015-09-10 15:15:42 -0700 | [diff] [blame] | 82 | // - REPLACE_XZ: Replace the dst_extents with the contents of the attached |
| 83 | // xz file after decompression. The xz file should only use crc32 or no crc at |
| 84 | // all to be compatible with xz-embedded. |
Amin Hassani | cdeb6e6 | 2017-10-11 10:15:11 -0700 | [diff] [blame] | 85 | // - PUFFDIFF: Read the data in src_extents in the old partition, perform |
| 86 | // puffpatch with the attached data and write the new data to dst_extents in |
| 87 | // the new partition. |
Alex Deymo | c1d7f12 | 2015-09-10 15:15:42 -0700 | [diff] [blame] | 88 | // |
| 89 | // The operations allowed in the payload (supported by the client) depend on the |
Sen Jiang | 771f648 | 2018-04-04 17:59:10 -0700 | [diff] [blame] | 90 | // major and minor version. See InstallOperation.Type below for details. |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 91 | |
Amin Hassani | 489875a | 2017-08-04 13:20:52 -0700 | [diff] [blame] | 92 | syntax = "proto2"; |
| 93 | |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 94 | package chromeos_update_engine; |
Alex Deymo | b8f16a1 | 2014-06-10 18:59:22 -0700 | [diff] [blame] | 95 | option optimize_for = LITE_RUNTIME; |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 96 | |
Andrew de los Reyes | 1e338b8 | 2010-01-22 14:57:27 -0800 | [diff] [blame] | 97 | // Data is packed into blocks on disk, always starting from the beginning |
| 98 | // of the block. If a file's data is too large for one block, it overflows |
| 99 | // into another block, which may or may not be the following block on the |
| 100 | // physical partition. An ordered list of extents is another |
| 101 | // representation of an ordered list of blocks. For example, a file stored |
| 102 | // in blocks 9, 10, 11, 2, 18, 12 (in that order) would be stored in |
| 103 | // extents { {9, 3}, {2, 1}, {18, 1}, {12, 1} } (in that order). |
| 104 | // In general, files are stored sequentially on disk, so it's more efficient |
| 105 | // to use extents to encode the block lists (this is effectively |
| 106 | // run-length encoding). |
| 107 | // A sentinel value (kuint64max) as the start block denotes a sparse-hole |
| 108 | // in a file whose block-length is specified by num_blocks. |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 109 | |
Sen Jiang | cb13124 | 2019-01-22 17:07:58 -0800 | [diff] [blame] | 110 | message Extent { |
| 111 | optional uint64 start_block = 1; |
| 112 | optional uint64 num_blocks = 2; |
| 113 | } |
| 114 | |
Andrew de los Reyes | 94f025d | 2010-08-16 17:17:27 -0700 | [diff] [blame] | 115 | // Signatures: Updates may be signed by the OS vendor. The client verifies |
| 116 | // an update's signature by hashing the entire download. The section of the |
Jay Srinivasan | 74475bf | 2012-09-13 19:26:26 -0700 | [diff] [blame] | 117 | // download that contains the signature is at the end of the file, so when |
Andrew de los Reyes | 94f025d | 2010-08-16 17:17:27 -0700 | [diff] [blame] | 118 | // signing a file, only the part up to the signature part is signed. |
| 119 | // Then, the client looks inside the download's Signatures message for a |
| 120 | // Signature message that it knows how to handle. Generally, a client will |
| 121 | // only know how to handle one type of signature, but an update may contain |
| 122 | // many signatures to support many different types of client. Then client |
| 123 | // selects a Signature message and uses that, along with a known public key, |
| 124 | // to verify the download. The public key is expected to be part of the |
| 125 | // client. |
| 126 | |
Andrew de los Reyes | 94f025d | 2010-08-16 17:17:27 -0700 | [diff] [blame] | 127 | message Signatures { |
| 128 | message Signature { |
Tianjie Xu | 7bbe015 | 2019-10-09 18:11:15 -0700 | [diff] [blame] | 129 | optional uint32 version = 1 [deprecated = true]; |
Andrew de los Reyes | 0c44005 | 2010-08-20 11:25:54 -0700 | [diff] [blame] | 130 | optional bytes data = 2; |
Tianjie Xu | 7bbe015 | 2019-10-09 18:11:15 -0700 | [diff] [blame] | 131 | |
| 132 | // The DER encoded signature size of EC keys is nondeterministic for |
| 133 | // different input of sha256 hash. However, we need the size of the |
| 134 | // serialized signatures protobuf string to be fixed before signing; |
| 135 | // because this size is part of the content to be signed. Therefore, we |
| 136 | // always pad the signature data to the maximum possible signature size of |
| 137 | // a given key. And the payload verifier will truncate the signature to |
| 138 | // its correct size based on the value of |unpadded_signature_size|. |
| 139 | optional fixed32 unpadded_signature_size = 3; |
Andrew de los Reyes | 94f025d | 2010-08-16 17:17:27 -0700 | [diff] [blame] | 140 | } |
| 141 | repeated Signature signatures = 1; |
| 142 | } |
| 143 | |
Darin Petkov | 36a5822 | 2010-10-07 22:00:09 -0700 | [diff] [blame] | 144 | message PartitionInfo { |
| 145 | optional uint64 size = 1; |
| 146 | optional bytes hash = 2; |
| 147 | } |
| 148 | |
Don Garrett | 0dd3985 | 2013-04-03 16:55:42 -0700 | [diff] [blame] | 149 | // Describe an image we are based on in a human friendly way. |
| 150 | // Examples: |
| 151 | // dev-channel, x86-alex, 1.2.3, mp-v3 |
| 152 | // nplusone-channel, x86-alex, 1.2.4, mp-v3, dev-channel, 1.2.3 |
| 153 | // |
| 154 | // All fields will be set, if this message is present. |
| 155 | message ImageInfo { |
Vyshu | a81598b | 2020-09-17 21:37:21 +0000 | [diff] [blame] | 156 | optional string board = 1 [deprecated = true]; |
| 157 | optional string key = 2 [deprecated = true]; |
| 158 | optional string channel = 3 [deprecated = true]; |
| 159 | optional string version = 4 [deprecated = true]; |
Don Garrett | 0dd3985 | 2013-04-03 16:55:42 -0700 | [diff] [blame] | 160 | |
| 161 | // If these values aren't present, they should be assumed to match |
| 162 | // the equivalent value above. They are normally only different for |
| 163 | // special image types such as nplusone images. |
Vyshu | a81598b | 2020-09-17 21:37:21 +0000 | [diff] [blame] | 164 | optional string build_channel = 5 [deprecated = true]; |
| 165 | optional string build_version = 6 [deprecated = true]; |
Don Garrett | 0dd3985 | 2013-04-03 16:55:42 -0700 | [diff] [blame] | 166 | } |
| 167 | |
Alex Deymo | a12ee11 | 2015-08-12 22:19:32 -0700 | [diff] [blame] | 168 | message InstallOperation { |
| 169 | enum Type { |
Amin Hassani | 0f59a9a | 2019-09-27 10:24:31 -0700 | [diff] [blame] | 170 | REPLACE = 0; // Replace destination extents w/ attached data. |
| 171 | REPLACE_BZ = 1; // Replace destination extents w/ attached bzipped data. |
| 172 | MOVE = 2 [deprecated = true]; // Move source extents to target extents. |
| 173 | BSDIFF = 3 [deprecated = true]; // The data is a bsdiff binary diff. |
Alex Deymo | ac6246a | 2015-08-13 14:00:22 -0700 | [diff] [blame] | 174 | |
Alex Deymo | c1d7f12 | 2015-09-10 15:15:42 -0700 | [diff] [blame] | 175 | // On minor version 2 or newer, these operations are supported: |
Vyshu | 852f57d | 2020-10-09 17:35:14 +0000 | [diff] [blame] | 176 | SOURCE_COPY = 4; // Copy from source to target partition |
| 177 | SOURCE_BSDIFF = 5; // Like BSDIFF, but read from source partition |
Alex Deymo | ac6246a | 2015-08-13 14:00:22 -0700 | [diff] [blame] | 178 | |
Alex Deymo | c1d7f12 | 2015-09-10 15:15:42 -0700 | [diff] [blame] | 179 | // On minor version 3 or newer and on major version 2 or newer, these |
| 180 | // operations are supported: |
Vyshu | 852f57d | 2020-10-09 17:35:14 +0000 | [diff] [blame] | 181 | REPLACE_XZ = 8; // Replace destination extents w/ attached xz data. |
Sen Jiang | 3317b88 | 2016-01-08 17:48:57 +0800 | [diff] [blame] | 182 | |
| 183 | // On minor version 4 or newer, these operations are supported: |
Vyshu | 852f57d | 2020-10-09 17:35:14 +0000 | [diff] [blame] | 184 | ZERO = 6; // Write zeros in the destination. |
Amin Hassani | df3a866 | 2017-12-07 12:17:45 -0800 | [diff] [blame] | 185 | DISCARD = 7; // Discard the destination blocks, reading as undefined. |
Amin Hassani | efa62d9 | 2017-11-09 13:46:56 -0800 | [diff] [blame] | 186 | BROTLI_BSDIFF = 10; // Like SOURCE_BSDIFF, but compressed with brotli. |
Amin Hassani | 77d7cbc | 2018-02-07 16:21:33 -0800 | [diff] [blame] | 187 | |
| 188 | // On minor version 5 or newer, these operations are supported: |
| 189 | PUFFDIFF = 9; // The data is in puffdiff format. |
Tianjie | c700169 | 2021-08-26 16:06:05 -0700 | [diff] [blame] | 190 | |
| 191 | // On minor version 8 or newer, these operations are supported: |
| 192 | ZUCCHINI = 11; |
Kelvin Zhang | f67dc49 | 2021-12-08 15:35:31 -0800 | [diff] [blame] | 193 | |
| 194 | // On minor version 9 or newer, these operations are supported: |
| 195 | LZ4DIFF_BSDIFF = 12; |
| 196 | LZ4DIFF_PUFFDIFF = 13; |
Andrew de los Reyes | 1e338b8 | 2010-01-22 14:57:27 -0800 | [diff] [blame] | 197 | } |
Alex Deymo | a12ee11 | 2015-08-12 22:19:32 -0700 | [diff] [blame] | 198 | required Type type = 1; |
Sen Jiang | 9edcd04 | 2018-11-12 16:46:06 -0800 | [diff] [blame] | 199 | |
| 200 | // Only minor version 6 or newer support 64 bits |data_offset| and |
| 201 | // |data_length|, older client will read them as uint32. |
Alex Deymo | a12ee11 | 2015-08-12 22:19:32 -0700 | [diff] [blame] | 202 | // The offset into the delta file (after the protobuf) |
| 203 | // where the data (if any) is stored |
Sen Jiang | 9edcd04 | 2018-11-12 16:46:06 -0800 | [diff] [blame] | 204 | optional uint64 data_offset = 2; |
Alex Deymo | a12ee11 | 2015-08-12 22:19:32 -0700 | [diff] [blame] | 205 | // The length of the data in the delta file |
Sen Jiang | 9edcd04 | 2018-11-12 16:46:06 -0800 | [diff] [blame] | 206 | optional uint64 data_length = 3; |
Alex Deymo | a12ee11 | 2015-08-12 22:19:32 -0700 | [diff] [blame] | 207 | |
| 208 | // Ordered list of extents that are read from (if any) and written to. |
| 209 | repeated Extent src_extents = 4; |
| 210 | // Byte length of src, equal to the number of blocks in src_extents * |
Amin Hassani | f5a06d8 | 2017-10-19 15:06:38 -0700 | [diff] [blame] | 211 | // block_size. It is used for BSDIFF and SOURCE_BSDIFF, because we need to |
| 212 | // pass that external program the number of bytes to read from the blocks we |
| 213 | // pass it. This is not used in any other operation. |
Alex Deymo | a12ee11 | 2015-08-12 22:19:32 -0700 | [diff] [blame] | 214 | optional uint64 src_length = 5; |
| 215 | |
| 216 | repeated Extent dst_extents = 6; |
| 217 | // Byte length of dst, equal to the number of blocks in dst_extents * |
Amin Hassani | f5a06d8 | 2017-10-19 15:06:38 -0700 | [diff] [blame] | 218 | // block_size. Used for BSDIFF and SOURCE_BSDIFF, but not in any other |
| 219 | // operation. |
Alex Deymo | a12ee11 | 2015-08-12 22:19:32 -0700 | [diff] [blame] | 220 | optional uint64 dst_length = 7; |
| 221 | |
| 222 | // Optional SHA 256 hash of the blob associated with this operation. |
| 223 | // This is used as a primary validation for http-based downloads and |
| 224 | // as a defense-in-depth validation for https-based downloads. If |
| 225 | // the operation doesn't refer to any blob, this field will have |
| 226 | // zero bytes. |
| 227 | optional bytes data_sha256_hash = 8; |
Alex Deymo | ac6246a | 2015-08-13 14:00:22 -0700 | [diff] [blame] | 228 | |
| 229 | // Indicates the SHA 256 hash of the source data referenced in src_extents at |
| 230 | // the time of applying the operation. If present, the update_engine daemon |
| 231 | // MUST read and verify the source data before applying the operation. |
| 232 | optional bytes src_sha256_hash = 9; |
| 233 | } |
| 234 | |
Tianjie | e9156ec | 2020-08-11 11:13:54 -0700 | [diff] [blame] | 235 | // Hints to VAB snapshot to skip writing some blocks if these blocks are |
| 236 | // identical to the ones on the source image. The src & dst extents for each |
| 237 | // CowMergeOperation should be contiguous, and they're a subset of an OTA |
| 238 | // InstallOperation. |
| 239 | // During merge time, we need to follow the pre-computed sequence to avoid |
| 240 | // read after write, similar to the inplace update schema. |
| 241 | message CowMergeOperation { |
| 242 | enum Type { |
Kelvin Zhang | 0de22fc | 2021-06-14 13:24:39 -0400 | [diff] [blame] | 243 | COW_COPY = 0; // identical blocks |
| 244 | COW_XOR = 1; // used when src/dst blocks are highly similar |
| 245 | COW_REPLACE = 2; // Raw replace operation |
Tianjie | e9156ec | 2020-08-11 11:13:54 -0700 | [diff] [blame] | 246 | } |
| 247 | optional Type type = 1; |
| 248 | |
| 249 | optional Extent src_extent = 2; |
| 250 | optional Extent dst_extent = 3; |
Kelvin Zhang | 0de22fc | 2021-06-14 13:24:39 -0400 | [diff] [blame] | 251 | // For COW_XOR, source location might be unaligned, so this field is in range |
| 252 | // [0, block_size), representing how much should the src_extent shift toward |
| 253 | // larger block number. If this field is non-zero, then src_extent will |
| 254 | // include 1 extra block in the end, as the merge op actually references the |
| 255 | // first |src_offset| bytes of that extra block. For example, if |dst_extent| |
| 256 | // is [10, 15], |src_offset| is 500, then src_extent might look like [25, 31]. |
| 257 | // Note that |src_extent| contains 1 extra block than the |dst_extent|. |
| 258 | optional uint32 src_offset = 4; |
Tianjie | e9156ec | 2020-08-11 11:13:54 -0700 | [diff] [blame] | 259 | } |
| 260 | |
Alex Deymo | ac6246a | 2015-08-13 14:00:22 -0700 | [diff] [blame] | 261 | // Describes the update to apply to a single partition. |
| 262 | message PartitionUpdate { |
| 263 | // A platform-specific name to identify the partition set being updated. For |
| 264 | // example, in Chrome OS this could be "ROOT" or "KERNEL". |
| 265 | required string partition_name = 1; |
| 266 | |
Alex Deymo | eb86e55 | 2015-09-21 16:00:38 -0700 | [diff] [blame] | 267 | // Whether this partition carries a filesystem with post-install program that |
| 268 | // must be run to finalize the update process. See also |postinstall_path| and |
| 269 | // |filesystem_type|. |
Alex Deymo | ac6246a | 2015-08-13 14:00:22 -0700 | [diff] [blame] | 270 | optional bool run_postinstall = 2; |
| 271 | |
Alex Deymo | eb86e55 | 2015-09-21 16:00:38 -0700 | [diff] [blame] | 272 | // The path of the executable program to run during the post-install step, |
| 273 | // relative to the root of this filesystem. If not set, the default "postinst" |
| 274 | // will be used. This setting is only used when |run_postinstall| is set and |
| 275 | // true. |
| 276 | optional string postinstall_path = 3; |
| 277 | |
| 278 | // The filesystem type as passed to the mount(2) syscall when mounting the new |
| 279 | // filesystem to run the post-install program. If not set, a fixed list of |
| 280 | // filesystems will be attempted. This setting is only used if |
| 281 | // |run_postinstall| is set and true. |
| 282 | optional string filesystem_type = 4; |
| 283 | |
Alex Deymo | ac6246a | 2015-08-13 14:00:22 -0700 | [diff] [blame] | 284 | // If present, a list of signatures of the new_partition_info.hash signed with |
| 285 | // different keys. If the update_engine daemon requires vendor-signed images |
| 286 | // and has its public key installed, one of the signatures should be valid |
| 287 | // for /postinstall to run. |
Alex Deymo | eb86e55 | 2015-09-21 16:00:38 -0700 | [diff] [blame] | 288 | repeated Signatures.Signature new_partition_signature = 5; |
Alex Deymo | ac6246a | 2015-08-13 14:00:22 -0700 | [diff] [blame] | 289 | |
Alex Deymo | eb86e55 | 2015-09-21 16:00:38 -0700 | [diff] [blame] | 290 | optional PartitionInfo old_partition_info = 6; |
| 291 | optional PartitionInfo new_partition_info = 7; |
Alex Deymo | ac6246a | 2015-08-13 14:00:22 -0700 | [diff] [blame] | 292 | |
| 293 | // The list of operations to be performed to apply this PartitionUpdate. The |
| 294 | // associated operation blobs (in operations[i].data_offset, data_length) |
| 295 | // should be stored contiguously and in the same order. |
Alex Deymo | eb86e55 | 2015-09-21 16:00:38 -0700 | [diff] [blame] | 296 | repeated InstallOperation operations = 8; |
Alex Deymo | 5b91c6b | 2016-08-04 20:33:36 -0700 | [diff] [blame] | 297 | |
| 298 | // Whether a failure in the postinstall step for this partition should be |
| 299 | // ignored. |
| 300 | optional bool postinstall_optional = 9; |
Sen Jiang | 57f9180 | 2017-11-14 17:42:13 -0800 | [diff] [blame] | 301 | |
| 302 | // On minor version 6 or newer, these fields are supported: |
| 303 | |
| 304 | // The extent for data covered by verity hash tree. |
| 305 | optional Extent hash_tree_data_extent = 10; |
| 306 | |
| 307 | // The extent to store verity hash tree. |
| 308 | optional Extent hash_tree_extent = 11; |
| 309 | |
| 310 | // The hash algorithm used in verity hash tree. |
| 311 | optional string hash_tree_algorithm = 12; |
| 312 | |
| 313 | // The salt used for verity hash tree. |
| 314 | optional bytes hash_tree_salt = 13; |
| 315 | |
| 316 | // The extent for data covered by FEC. |
| 317 | optional Extent fec_data_extent = 14; |
| 318 | |
| 319 | // The extent to store FEC. |
| 320 | optional Extent fec_extent = 15; |
| 321 | |
| 322 | // The number of FEC roots. |
| 323 | optional uint32 fec_roots = 16 [default = 2]; |
Kelvin Zhang | d719103 | 2020-08-11 10:48:16 -0400 | [diff] [blame] | 324 | |
| 325 | // Per-partition version used for downgrade detection, added |
| 326 | // as an effort to support partial updates. For most partitions, |
| 327 | // this is the build timestamp. |
| 328 | optional string version = 17; |
Tianjie | e9156ec | 2020-08-11 11:13:54 -0700 | [diff] [blame] | 329 | |
| 330 | // A sorted list of CowMergeOperation. When writing cow, we can choose to |
| 331 | // skip writing the raw bytes for these extents. During snapshot merge, the |
| 332 | // bytes will read from the source partitions instead. |
| 333 | repeated CowMergeOperation merge_operations = 18; |
Kelvin Zhang | 7d64e28 | 2020-09-02 15:27:34 -0400 | [diff] [blame] | 334 | |
| 335 | // Estimated size for COW image. This is used by libsnapshot |
| 336 | // as a hint. If set to 0, libsnapshot should use alternative |
| 337 | // methods for estimating size. |
| 338 | optional uint64 estimate_cow_size = 19; |
Alex Deymo | a12ee11 | 2015-08-12 22:19:32 -0700 | [diff] [blame] | 339 | } |
| 340 | |
Yifan Hong | 398cb54 | 2018-10-18 11:29:40 -0700 | [diff] [blame] | 341 | message DynamicPartitionGroup { |
| 342 | // Name of the group. |
| 343 | required string name = 1; |
| 344 | |
| 345 | // Maximum size of the group. The sum of sizes of all partitions in the group |
| 346 | // must not exceed the maximum size of the group. |
| 347 | optional uint64 size = 2; |
| 348 | |
| 349 | // A list of partitions that belong to the group. |
| 350 | repeated string partition_names = 3; |
| 351 | } |
| 352 | |
| 353 | // Metadata related to all dynamic partitions. |
| 354 | message DynamicPartitionMetadata { |
Sen Jiang | cb13124 | 2019-01-22 17:07:58 -0800 | [diff] [blame] | 355 | // All updatable groups present in |partitions| of this DeltaArchiveManifest. |
Yifan Hong | 398cb54 | 2018-10-18 11:29:40 -0700 | [diff] [blame] | 356 | // - If an updatable group is on the device but not in the manifest, it is |
| 357 | // not updated. Hence, the group will not be resized, and partitions cannot |
| 358 | // be added to or removed from the group. |
| 359 | // - If an updatable group is in the manifest but not on the device, the group |
| 360 | // is added to the device. |
| 361 | repeated DynamicPartitionGroup groups = 1; |
Yifan Hong | 05b3b96 | 2019-09-26 17:19:21 -0700 | [diff] [blame] | 362 | |
| 363 | // Whether dynamic partitions have snapshots during the update. If this is |
| 364 | // set to true, the update_engine daemon creates snapshots for all dynamic |
| 365 | // partitions if possible. If this is unset, the update_engine daemon MUST |
| 366 | // NOT create snapshots for dynamic partitions. |
| 367 | optional bool snapshot_enabled = 2; |
Kelvin Zhang | ad8ea10 | 2021-01-14 10:14:44 -0500 | [diff] [blame] | 368 | |
| 369 | // If this is set to false, update_engine should not use VABC regardless. If |
| 370 | // this is set to true, update_engine may choose to use VABC if device |
| 371 | // supports it, but not guaranteed. |
| 372 | // VABC stands for Virtual AB Compression |
| 373 | optional bool vabc_enabled = 3; |
Kelvin Zhang | 4ca06c1 | 2021-02-04 17:16:40 -0500 | [diff] [blame] | 374 | |
| 375 | // The compression algorithm used by VABC. Available ones are "gz", "brotli". |
| 376 | // See system/core/fs_mgr/libsnapshot/cow_writer.cpp for available options, |
| 377 | // as this parameter is ultimated forwarded to libsnapshot's CowWriter |
| 378 | optional string vabc_compression_param = 4; |
Akilesh Kailash | 3632df9 | 2021-04-13 22:30:15 +0000 | [diff] [blame] | 379 | |
| 380 | // COW version used by VABC. The represents the major version in the COW |
| 381 | // header |
| 382 | optional uint32 cow_version = 5; |
Yifan Hong | 398cb54 | 2018-10-18 11:29:40 -0700 | [diff] [blame] | 383 | } |
| 384 | |
Mohammad Samiul Islam | 9dd2d4f | 2021-01-20 21:33:54 +0000 | [diff] [blame] | 385 | // Definition has been duplicated from |
| 386 | // $ANDROID_BUILD_TOP/build/tools/releasetools/ota_metadata.proto. Keep in sync. |
| 387 | message ApexInfo { |
| 388 | optional string package_name = 1; |
| 389 | optional int64 version = 2; |
| 390 | optional bool is_compressed = 3; |
| 391 | optional int64 decompressed_size = 4; |
| 392 | } |
| 393 | |
Kelvin Zhang | deb3445 | 2021-01-21 11:54:36 -0500 | [diff] [blame] | 394 | // Definition has been duplicated from |
| 395 | // $ANDROID_BUILD_TOP/build/tools/releasetools/ota_metadata.proto. Keep in sync. |
| 396 | message ApexMetadata { |
| 397 | repeated ApexInfo apex_info = 1; |
| 398 | } |
| 399 | |
Alex Deymo | a12ee11 | 2015-08-12 22:19:32 -0700 | [diff] [blame] | 400 | message DeltaArchiveManifest { |
Alex Deymo | c1d7f12 | 2015-09-10 15:15:42 -0700 | [diff] [blame] | 401 | // Only present in major version = 1. List of install operations for the |
| 402 | // kernel and rootfs partitions. For major version = 2 see the |partitions| |
| 403 | // field. |
Amin Hassani | 55c7541 | 2019-10-07 11:20:39 -0700 | [diff] [blame] | 404 | repeated InstallOperation install_operations = 1 [deprecated = true]; |
| 405 | repeated InstallOperation kernel_install_operations = 2 [deprecated = true]; |
Andrew de los Reyes | 1e338b8 | 2010-01-22 14:57:27 -0800 | [diff] [blame] | 406 | |
| 407 | // (At time of writing) usually 4096 |
Andrew de los Reyes | f4c7ef1 | 2010-04-30 10:37:00 -0700 | [diff] [blame] | 408 | optional uint32 block_size = 3 [default = 4096]; |
Andrew de los Reyes | 94f025d | 2010-08-16 17:17:27 -0700 | [diff] [blame] | 409 | |
| 410 | // If signatures are present, the offset into the blobs, generally |
Andrew de los Reyes | 932bc4c | 2010-08-23 18:14:09 -0700 | [diff] [blame] | 411 | // tacked onto the end of the file, and the length. We use an offset |
| 412 | // rather than a bool to allow for more flexibility in future file formats. |
| 413 | // If either is absent, it means signatures aren't supported in this |
Andrew de los Reyes | 94f025d | 2010-08-16 17:17:27 -0700 | [diff] [blame] | 414 | // file. |
| 415 | optional uint64 signatures_offset = 4; |
Andrew de los Reyes | 932bc4c | 2010-08-23 18:14:09 -0700 | [diff] [blame] | 416 | optional uint64 signatures_size = 5; |
Darin Petkov | 36a5822 | 2010-10-07 22:00:09 -0700 | [diff] [blame] | 417 | |
Alex Deymo | c1d7f12 | 2015-09-10 15:15:42 -0700 | [diff] [blame] | 418 | // Only present in major version = 1. Partition metadata used to validate the |
| 419 | // update. For major version = 2 see the |partitions| field. |
Amin Hassani | 55c7541 | 2019-10-07 11:20:39 -0700 | [diff] [blame] | 420 | optional PartitionInfo old_kernel_info = 6 [deprecated = true]; |
| 421 | optional PartitionInfo new_kernel_info = 7 [deprecated = true]; |
| 422 | optional PartitionInfo old_rootfs_info = 8 [deprecated = true]; |
| 423 | optional PartitionInfo new_rootfs_info = 9 [deprecated = true]; |
Don Garrett | 0dd3985 | 2013-04-03 16:55:42 -0700 | [diff] [blame] | 424 | |
| 425 | // old_image_info will only be present for delta images. |
Vyshu | a81598b | 2020-09-17 21:37:21 +0000 | [diff] [blame] | 426 | optional ImageInfo old_image_info = 10 [deprecated = true]; |
Don Garrett | 0dd3985 | 2013-04-03 16:55:42 -0700 | [diff] [blame] | 427 | |
Vyshu | a81598b | 2020-09-17 21:37:21 +0000 | [diff] [blame] | 428 | optional ImageInfo new_image_info = 11 [deprecated = true]; |
Don Garrett | b8dd1d9 | 2013-11-22 17:40:02 -0800 | [diff] [blame] | 429 | |
Alex Deymo | c1d7f12 | 2015-09-10 15:15:42 -0700 | [diff] [blame] | 430 | // The minor version, also referred as "delta version", of the payload. |
Sen Jiang | cb13124 | 2019-01-22 17:07:58 -0800 | [diff] [blame] | 431 | // Minor version 0 is full payload, everything else is delta payload. |
Don Garrett | b8dd1d9 | 2013-11-22 17:40:02 -0800 | [diff] [blame] | 432 | optional uint32 minor_version = 12 [default = 0]; |
Alex Deymo | ac6246a | 2015-08-13 14:00:22 -0700 | [diff] [blame] | 433 | |
Alex Deymo | c1d7f12 | 2015-09-10 15:15:42 -0700 | [diff] [blame] | 434 | // Only present in major version >= 2. List of partitions that will be |
| 435 | // updated, in the order they will be updated. This field replaces the |
| 436 | // |install_operations|, |kernel_install_operations| and the |
| 437 | // |{old,new}_{kernel,rootfs}_info| fields used in major version = 1. This |
| 438 | // array can have more than two partitions if needed, and they are identified |
| 439 | // by the partition name. |
Alex Deymo | ac6246a | 2015-08-13 14:00:22 -0700 | [diff] [blame] | 440 | repeated PartitionUpdate partitions = 13; |
Sen Jiang | 5011df6 | 2017-06-28 17:13:19 -0700 | [diff] [blame] | 441 | |
| 442 | // The maximum timestamp of the OS allowed to apply this payload. |
| 443 | // Can be used to prevent downgrading the OS. |
| 444 | optional int64 max_timestamp = 14; |
Yifan Hong | 398cb54 | 2018-10-18 11:29:40 -0700 | [diff] [blame] | 445 | |
| 446 | // Metadata related to all dynamic partitions. |
| 447 | optional DynamicPartitionMetadata dynamic_partition_metadata = 15; |
Tianjie | d3865d1 | 2020-06-03 15:25:17 -0700 | [diff] [blame] | 448 | |
| 449 | // If the payload only updates a subset of partitions on the device. |
| 450 | optional bool partial_update = 16; |
Mohammad Samiul Islam | 9dd2d4f | 2021-01-20 21:33:54 +0000 | [diff] [blame] | 451 | |
| 452 | // Information on compressed APEX to figure out how much space is required for |
| 453 | // their decompression |
| 454 | repeated ApexInfo apex_info = 17; |
Andrew de los Reyes | 1e338b8 | 2010-01-22 14:57:27 -0800 | [diff] [blame] | 455 | } |