1.修改build/core/Makefile
@@ -2863,6 +2863,7 @@ endif
$(hide) find
@.list
$(hide) find $(zip_root) -path
@.list
$(hide) $(SOONG_ZIP) -d -o $@ -C $(zip_root) -l $@.list
+ $(hide) ./build/tools/releasetools/replace_img_from_target_files.py $@ $(PRODUCT_OUT)html
replace_img_from_target_files.pyjava
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/msm8909go下的img.
out/target/product/msm8909go/msm8909go-ota-eng…zip //OTA整包
out/target/product/msm8909go/obj/PACKAGING/target_files_intermediates/msm8909go-target_files-eng…zip//制做差分包的资源包A.zip
将两个ota包保存一个位置。
3.代码改动须要升级时,再次执行make;make otapackage;(make clean后执行)android
out下还会生成ota整包和差分的资源包B.zipgit
4.制做差分包
在android目录下执行./build/tools/releasetools/ota_from_target_files -i A.zip B.zip update.zip.
update.zip就是ota差分包web
5.修改bootable/recovery/uncrypt/uncrypt.cpp(若是硬件支持F2FS_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 " << status << ": " << error;
经过日志,查看错误缘由,根据错误修改相应的配置信息.
兼容性校验会校验如下方法中的全部信息:RuntimeInfo.cppapp
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 <conditions> for each <kernel> 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-versionide