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