Home | History | Annotate | Download | only in payload_consumer
      1 //
      2 // Copyright (C) 2014 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 //
     16 
     17 #include "update_engine/payload_consumer/payload_constants.h"
     18 
     19 namespace chromeos_update_engine {
     20 
     21 const uint64_t kChromeOSMajorPayloadVersion = 1;
     22 const uint64_t kBrilloMajorPayloadVersion = 2;
     23 
     24 const uint32_t kFullPayloadMinorVersion = 0;
     25 const uint32_t kInPlaceMinorPayloadVersion = 1;
     26 const uint32_t kSourceMinorPayloadVersion = 2;
     27 const uint32_t kOpSrcHashMinorPayloadVersion = 3;
     28 const uint32_t kImgdiffMinorPayloadVersion = 4;
     29 
     30 const char kLegacyPartitionNameKernel[] = "boot";
     31 const char kLegacyPartitionNameRoot[] = "system";
     32 
     33 const char kDeltaMagic[4] = {'C', 'r', 'A', 'U'};
     34 
     35 // The zlib in Android and Chrome OS are currently compatible with each other,
     36 // so they are sharing the same array, but if in the future they are no longer
     37 // compatible with each other, we coule make the same change on the other one to
     38 // make them compatible again or use ifdef here.
     39 const char kCompatibleZlibFingerprint[][65] = {
     40     "ea973605ccbbdb24f59f449c5f65861a1a9bc7a4353377aaaa06cb3e0f1cfbd7",
     41     "3747fa404cceb00a5ec3606fc779510aaa784d5864ab1d5c28b9e267c40aad5c",
     42     // zlib 1.2.11
     43     "61514794a2985bee78135fd67a2f1fd18e56f3c3e410fbc4552a0e05a701e47a",
     44 };
     45 
     46 const char* InstallOperationTypeName(InstallOperation_Type op_type) {
     47   switch (op_type) {
     48     case InstallOperation::BSDIFF:
     49       return "BSDIFF";
     50     case InstallOperation::MOVE:
     51       return "MOVE";
     52     case InstallOperation::REPLACE:
     53       return "REPLACE";
     54     case InstallOperation::REPLACE_BZ:
     55       return "REPLACE_BZ";
     56     case InstallOperation::SOURCE_COPY:
     57       return "SOURCE_COPY";
     58     case InstallOperation::SOURCE_BSDIFF:
     59       return "SOURCE_BSDIFF";
     60     case InstallOperation::ZERO:
     61       return "ZERO";
     62     case InstallOperation::DISCARD:
     63       return "DISCARD";
     64     case InstallOperation::REPLACE_XZ:
     65       return "REPLACE_XZ";
     66     case InstallOperation::IMGDIFF:
     67       return "IMGDIFF";
     68   }
     69   return "<unknown_op>";
     70 }
     71 
     72 };  // namespace chromeos_update_engine
     73