Android編譯ota包移除compatibility.zip
阿新 • • 發佈:2021-01-31
簡介
Android有個Treble專案,詳細的情況感興趣的自行百度,簡單的來說就是編譯一個系統映象能夠在很多手機上執行。也就涉及到了相容性問題,compatibility.zip裡面有四個檔案,分別說明,裝置提供了什麼,裝置需要什麼,框架提供了什麼,框架需要什麼。如果ota包,也就是卡刷包裡面有這個壓縮包,那麼recovery會去校驗,如果不匹配的話無法安裝。相關連結:谷歌文件.
操作
順著make otapackage 這個命令找,最後定位到了build/make/tools/releasetools/ota_from_target_files.py這個檔案,裡面有個AddCompatibilityArchiveIfTrebleEnabled方法,顧名思義。往下看有一處程式碼
if not HasTrebleEnabled(target_zip, target_info):
return
然後
def HasTrebleEnabled(target_files_zip, target_info):
return (HasVendorPartition(target_files_zip) and
target_info.GetBuildProp("ro.treble.enabled") == "true")
將HasTrebleEnabled方法改成返回False就行了