OTAアップグレード

6593 ワード

1.build/core/Makefile@@@2663,6+2863,7@@endif$(hide)find(z i p r o t)/M E T A∣s o r t>(zip_root)/META|sort>(zipr oot)/META∣sort>@を修正する.list $(hide) find $(zip_root) -path ( z i p r o o t )/M E T A − p r u n e − o − p r i n t ∣ s o r t >> (zip_root)/META -prune -o -print | sort >> (zipr​oot)/META−prune−o−print∣sort>>@.list $(hide) $(SOONG_ZIP) -d -o $@ -C $(zip_root) -l [email protected] + $(hide) ./build/tools/releasetools/replace_img_from_target_files.py $@ $(PRODUCT_OUT)
replace_img_from_target_files.py
import sys
import errno
import os
import re
import shutil
import subprocess
import tempfile
import zipfile
image_replace_list = ["boot.img","system.img","vendor.img","recovery.img"]

if sys.hexversion < 0x02070000:
  print("Python 2.7 or newer is required.")
  sys.exit(1)

if not hasattr(os, "SEEK_SET"):
   os.SEEK_SET = 0

def main(argv):

   if len(argv) != 2:
     sys.exit(1)

   if not os.path.exists(argv[0]):
     print "Target file:%s is invalid" % argv[0]
     sys.exit(1)

   if not os.path.exists(argv[1]):
     print "Output dir:%s is invalid" % argv[1]
     sys.exit(1)

   zf = zipfile.ZipFile(argv[0], 'r')

   for img in zf.namelist():
     if img.find("IMAGES/") != -1:
       if img.find(".img") != -1:
          data = zf.read(img)
          name = img.replace("IMAGES/", '')
          if name in image_replace_list:
             print "Replace %s" % name
             name = '/'.join((argv[1], name))
             file = open(name, "w")
             file.write(data)
             file.close()

if __name__ == '__main__':
   main(sys.argv[1:])


2.make;make otapackage; 録画/out/target/product/msm 8909 goでのimg.out/target/product/msm 8909 go/msm 8909 go-ota-eng...zip//OTAパッケージout/target/product/msm 8909 go/obj/PAKAGING/target_files_intermediates/msm8909go-target_files-eng...zip//差分パケットを作成するリソースパケットA.zipは、2つのotaパケットを1つの場所に保存します.3.コード変更をアップグレードする必要がある場合、再度makeを実行する.make otapackage;(make clean後に実行)
outではotaパケット全体と差分リソースパケットB.zipも生成される
4.差分パケットを作成androidディレクトリで実行する./build/tools/releasetools/ota_from_target_files -i A.zip B.zip update.zip. update.zipはota差分パッケージです
5.bootable/recovery/uncrypt/uncryptを修正する.cpp(ハードウェアがF 2 FS_IOC_SET_DONTMOVEをサポートする場合、変更しなくてもアップグレードに失敗する)diff-git a/uncrypt/uncrypt.cpp b/uncrypt/uncrypt.cpp index bb43c2c…d1aa560 100644 — a/uncrypt/uncrypt.cpp+++ b/uncrypt/uncrypt.cpp @@ -321,7 +321,7 @@ static int produce_block_map(const char* path, const char* map_file, const char* #endif if (f2fs_fs && ioctl(fd, F2FS_IOC_SET_DONTMOVE) < 0) { PLOG(ERROR) << "Failed to set non-movable file for f2fs: "<< path << "on "<< blk_dev; - return kUncryptIoctlError; +//return kUncryptIoctlError; } 6.java.security.SignatureException:package compatibility verification failedオープンandroid_os_VintfObject.cppファイルのverifyメソッドのログ//if(status)LOG(WARNING)<「VintfObject.verify()returns」<bool RuntimeInfo::checkCompatibility(const CompatibilityMatrix& mat, std::string* error,DisabledChecks disabledChecks) const { if (mat.mType != SchemaType::FRAMEWORK) { if (error != nullptr) { *error = "Should not check runtime info against " + to_string(mat.mType) + " compatibility matrix."; } return false; } if (kernelSepolicyVersion() < mat.framework.mSepolicy.kernelSepolicyVersion()) { if (error != nullptr) { *error = "kernelSepolicyVersion = " + to_string(kernelSepolicyVersion()) + " but required >= " + to_string(mat.framework.mSepolicy.kernelSepolicyVersion()); } return false; } // mat.mSepolicy.sepolicyVersion() is checked against static // HalManifest.device.mSepolicyVersion in HalManifest::checkCompatibility. bool foundMatchedKernelVersion = false; bool foundMatchedConditions = false; for (const MatrixKernel& matrixKernel : mat.framework.mKernels) { if (!matchKernelVersion(matrixKernel.minLts())) { continue; } foundMatchedKernelVersion = true; // ignore this fragment if not all conditions are met. if (!matchKernelConfigs(matrixKernel.conditions(), error)) { continue; } foundMatchedConditions = true; if (!matchKernelConfigs(matrixKernel.configs(), error)) { return false; } } if (!foundMatchedKernelVersion) { if (error != nullptr) { std::stringstream ss; ss << "Framework is incompatible with kernel version " << mKernelVersion << ", compatible kernel versions are"; for (const MatrixKernel& matrixKernel : mat.framework.mKernels) ss << " " << matrixKernel.minLts(); *error = ss.str(); } return false; } if (!foundMatchedConditions) { // This should not happen because first for each must be // empty. Reject here for inconsistency. if (error != nullptr) { error->insert(0, "Framework match kernel version with unmet conditions:"); } return false; } if (error != nullptr) { error->clear(); } if ((disabledChecks & DISABLE_AVB_CHECK) == 0) { const Version& matAvb = mat.framework.mAvbMetaVersion; if (mBootAvbVersion.majorVer != matAvb.majorVer || mBootAvbVersion.minorVer < matAvb.minorVer) { if (error != nullptr) { std::stringstream ss; ss << "AVB version " << mBootAvbVersion << " does not match framework matrix " << matAvb; *error = ss.str(); } return false; } if (mBootVbmetaAvbVersion.majorVer != matAvb.majorVer || mBootVbmetaAvbVersion.minorVer < matAvb.minorVer) { if (error != nullptr) { std::stringstream ss; ss << "Vbmeta version " << mBootVbmetaAvbVersion << " does not match framework matrix " << matAvb; *error = ss.str(); } return false; } } return true; }
一致規則は参照できますhttps://source.android.google.cn/devices/architecture/vintf/match-rules#avb-version