Android OTA?升級之一:編譯升級包
作者: 宋立新
Email?:?zjujoe@yahoo.com
前言
???????OTA?升級是?Android?系統提供的標準軟件升級方式。?它功能強大,提供了完全升級、增量升級模式,可以通過?SD?卡升級,也可以通過網絡升級。
???????這里,我們先研究最簡單的情況,通過?SD?卡進行完全升級。
???????如何執行升級就不多說了,網上有很多資料。(比如,介紹?HTC?手機如何升級)。我們感興趣的是它是如何實現的,作為開發者,如何修改它以符合我們的定制化需求。
???????首先,我們研究一下?ota?升級包的編譯過程。
Quick start
???????首先編譯出?android,?然后執行:
make otapackage
????即可獲得:?out/target/product/{product_name}/?{product_name}?-ota-eng.{uid}.zip
????將該文件改名為?update.zip?放到?T?卡根目錄?,?即可開始?recovery?模式下的?OTA?升級。
編譯過程研究
?
主要分兩步,第一步,?會準備一個包,其中包含升級需要的內容?(?原材料?)?,比如,?system?目錄。
第二步,運行?python?腳本?./build/tools/releasetools/ota_from_target_files?,以步驟一準備的?ZIP?包作為輸入,最終生成需要的升級包。
?
步驟一
編譯腳本如下?:
(From: build/core/Makefile)
?
?
1073?#?Depending?on?the?various?images?guarantees?that?the?underlying??1074?#?directories?are?up-to-date.??1075?$(BUILT_TARGET_FILES_PACKAGE):?/??1076?????????????????$(INSTALLED_BOOTIMAGE_TARGET)?/??1077?????????????????$(INSTALLED_RADIOIMAGE_TARGET)?/??1078?????????????????$(INSTALLED_RECOVERYIMAGE_TARGET)?/??1079?????????????????$(INSTALLED_FACTORYIMAGE_TARGET)?/??1080?????????????????$(INSTALLED_SYSTEMIMAGE)?/??1081?????????????????$(INSTALLED_USERDATAIMAGE_TARGET)?/??1082?????????????????$(INSTALLED_SECROIMAGE_TARGET)?/??1083?????????????????$(INSTALLED_ANDROID_INFO_TXT_TARGET)?/??1084?????????????????$(built_ota_tools)?/??1085?????????????????$(APKCERTS_FILE)?/??1086?????????????????$(HOST_OUT_EXECUTABLES)/fs_config?/??1087?????????????????|?$(ACP)??1088?????????@echo?"Package?target?files:?$@"???1089?????????$(hide)?rm?-rf?$@?$(zip_root)??1090?????????$(hide)?mkdir?-p?$(dir?$@)?$(zip_root)??1091?????????@#?Components?of?the?recovery?image??1092?????????$(hide)?mkdir?-p?$(zip_root)/RECOVERY??1093?????????$(hide)?$(call?package_files-copy-root,?/??1094?????????????????$(TARGET_RECOVERY_ROOT_OUT),$(zip_root)/RECOVERY/RAMDISK)??1095?ifdef?INSTALLED_KERNEL_TARGET??1096?????????$(hide)?$(ACP)?$(INSTALLED_KERNEL_TARGET)?$(zip_root)/RECOVERY/kernel??1097?????????$(hide)?$(ACP)?$(recovery_ramdisk)?$(zip_root)/RECOVERY/ramdisk??1098?endif??1099?ifdef?INSTALLED_2NDBOOTLOADER_TARGET??1100?????????$(hide)?$(ACP)?/??1101?????????????????$(INSTALLED_2NDBOOTLOADER_TARGET)?$(zip_root)/RECOVERY/second??1102?endif??1103?ifdef?BOARD_KERNEL_CMDLINE??1104?????????$(hide)?echo?"$(BOARD_KERNEL_CMDLINE)"??>?$(zip_root)/RECOVERY/cmdline??1105?endif??1106?ifdef?BOARD_KERNEL_BASE??1107?????????$(hide)?echo?"$(BOARD_KERNEL_BASE)"??>?$(zip_root)/RECOVERY/?base???1108?endif??1109?????????@#?Components?of?the?factory?image??1110?????????$(hide)?mkdir?-p?$(zip_root)/FACTORY??1111?????????$(hide)?$(call?package_files-copy-root,?/??1112?????????????????$(TARGET_FACTORY_ROOT_OUT),$(zip_root)/FACTORY/RAMDISK)??1113?ifdef?INSTALLED_KERNEL_TARGET??1114?????????$(hide)?$(ACP)?$(INSTALLED_KERNEL_TARGET)?$(zip_root)/FACTORY/kernel??1115?endif??1116?ifdef?INSTALLED_2NDBOOTLOADER_TARGET??1117?????????$(hide)?$(ACP)?/??1118?????????????????$(INSTALLED_2NDBOOTLOADER_TARGET)?$(zip_root)/FACTORY/second??1119?endif??1120?ifdef?BOARD_KERNEL_CMDLINE??1121?????????$(hide)?echo?"$(BOARD_KERNEL_CMDLINE)"??>?$(zip_root)/FACTORY/cmdline??1122?endif??1123?ifdef?BOARD_KERNEL_BASE??1124?????????$(hide)?echo?"$(BOARD_KERNEL_BASE)"??>?$(zip_root)/FACTORY/?base???1125?endif??1126?????????@#?Components?of?the?boot?image??1127?????????$(hide)?mkdir?-p?$(zip_root)/BOOT??1128?????????$(hide)?$(call?package_files-copy-root,?/??1129?????????????????$(TARGET_ROOT_OUT),$(zip_root)/BOOT/RAMDISK)??1130?ifdef?INSTALLED_KERNEL_TARGET??1131?????????$(hide)?$(ACP)?$(INSTALLED_KERNEL_TARGET)?$(zip_root)/BOOT/kernel??1132?????????$(hide)?$(ACP)?$(INSTALLED_RAMDISK_TARGET)?$(zip_root)/BOOT/ramdisk??1133?endif??1134?ifdef?INSTALLED_2NDBOOTLOADER_TARGET??1135?????????$(hide)?$(ACP)?/??1136?????????????????$(INSTALLED_2NDBOOTLOADER_TARGET)?$(zip_root)/BOOT/second??1137?endif??1138?ifdef?BOARD_KERNEL_CMDLINE??1139?????????$(hide)?echo?"$(BOARD_KERNEL_CMDLINE)"??>?$(zip_root)/BOOT/cmdline??1140?endif??1141?ifdef?BOARD_KERNEL_BASE??1142?????????$(hide)?echo?"$(BOARD_KERNEL_BASE)"??>?$(zip_root)/BOOT/?base???1143?endif??1144?????????$(hide)?$(foreach??t,$(INSTALLED_RADIOIMAGE_TARGET),/??1145?????????????????????mkdir?-p?$(zip_root)/RADIO;?/??1146?????????????????????$(ACP)?$(t)?$(zip_root)/RADIO/$(notdir?$(t));)??1147?????????@#?Contents?of?the?system?image??1148?????????$(hide)?$(call?package_files-copy-root,?/??1149?????????????????$(SYSTEMIMAGE_SOURCE_DIR),$(zip_root)/SYSTEM)??1150?????????@#?Contents?of?the?data?image??1151?????????$(hide)?$(call?package_files-copy-root,?/??1152?????????????????$(TARGET_OUT_DATA),$(zip_root)/DATA)??1153?????????@#?Extra?contents?of?the?OTA?package??1154?????????$(hide)?mkdir?-p?$(zip_root)/OTA/bin??1155?????????$(hide)?$(ACP)?$(INSTALLED_ANDROID_INFO_TXT_TARGET)?$(zip_root)/OTA/??1156?????????$(hide)?$(ACP)?$(PRIVATE_OTA_TOOLS)?$(zip_root)/OTA/bin/??1157?????????@#?Files?that?do??not?end?up??in??any?images,?but?are?necessary?to??1158?????????@#?build?them.??1159?????????$(hide)?mkdir?-p?$(zip_root)/META??1160?????????$(hide)?$(ACP)?$(APKCERTS_FILE)?$(zip_root)/META/apkcerts.txt??1161?????????$(hide)?echo?"$(PRODUCT_OTA_PUBLIC_KEYS)"??>?$(zip_root)/META/otakeys.txt??1162?????????$(hide)?echo?"$(PRIVATE_RECOVERY_API_VERSION)"??>?$(zip_root)/META/recovery-api-version.txt??1163?????????$(hide)?echo?"blocksize?$(BOARD_FLASH_BLOCK_SIZE)"?>?$(zip_root)/META/imagesizes.txt??1164?????????$(hide)?echo?"boot?$(call?image-size-from-data-size,$(BOARD_BOOTIMAGE_PARTITION_SIZE))"??>>?$(zip_root)/META/imagesizes.txt??1165?????????$(hide)?echo?"recovery?$(call?image-size-from-data-size,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE))"??>>?$(zip_root)/META/imagesizes.txt??1166?????????$(hide)?echo?"system?$(call?image-size-from-data-size,$(BOARD_SYSTEMIMAGE_PARTITION_SIZE))"??>>?$(zip_root)/META/imagesizes.txt??1167?????????$(hide)?echo?"secro?$(call?image-size-from-data-size,$(BOARD_SECROIMAGE_PARTITION_SIZE))"??>>?$(zip_root)/META/imagesizes.txt??1168?????????$(hide)?echo?"userdata?$(call?image-size-from-data-size,$(BOARD_USERDATAIMAGE_PARTITION_SIZE))"??>>?$(zip_root)/META/imagesizes.txt??1169?????????$(hide)?echo?"$(tool_extensions)"??>?$(zip_root)/META/tool-extensions.txt??1170?????????@#?Zip?everything?up,?preserving?symlinks??1171?????????$(hide)?(cd?$(zip_root)?&&?zip?-qry?../$(notdir?$@)?.)??1172?????????@#?Run?fs_config?on?all?the?system?files?in??the?zip,?and?save?the?output??1173?????????$(hide)?zipinfo?-1?$@?|?awk?-F/?'BEGIN?{?OFS="/"?}?/^SYSTEM///?{$$1?=?"system";?print}'?|?$(HOST_OUT_EXECUTABLES)/fs_config?>?$(zip_root)/META/filesystem_config.txt??1174?????????$(hide)?(cd?$(zip_root)?&&?zip?-q?../$(notdir?$@)?META/filesystem_config.txt)?? 1073???#?Depending?on?the?various?images?guarantees?that?the?underlying??1074?#?directories?are?up-to-date.??1075?$(BUILT_TARGET_FILES_PACKAGE):?/??1076?????????????????$(INSTALLED_BOOTIMAGE_TARGET)?/??1077?????????????????$(INSTALLED_RADIOIMAGE_TARGET)?/??1078?????????????????$(INSTALLED_RECOVERYIMAGE_TARGET)?/??1079?????????????????$(INSTALLED_FACTORYIMAGE_TARGET)?/??1080?????????????????$(INSTALLED_SYSTEMIMAGE)?/??1081?????????????????$(INSTALLED_USERDATAIMAGE_TARGET)?/??1082?????????????????$(INSTALLED_SECROIMAGE_TARGET)?/??1083?????????????????$(INSTALLED_ANDROID_INFO_TXT_TARGET)?/??1084?????????????????$(built_ota_tools)?/??1085?????????????????$(APKCERTS_FILE)?/??1086?????????????????$(HOST_OUT_EXECUTABLES)/fs_config?/??1087?????????????????|?$(ACP)??1088?????????@echo?"Package?target?files:?$@"??1089?????????$(hide)?rm?-rf?$@?$(zip_root)??1090?????????$(hide)?mkdir?-p?$(dir?$@)?$(zip_root)??1091?????????@#?Components?of?the?recovery?image??1092?????????$(hide)?mkdir?-p?$(zip_root)/RECOVERY??1093?????????$(hide)?$(call?package_files-copy-root,?/??1094???????????????????$(TARGET_RECOVERY_ROOT_OUT),$(zip_root)/RECOVERY/RAMDISK)??1095?ifdef?INSTALLED_KERNEL_TARGET??1096?????????$(hide)?$(ACP)?$(INSTALLED_KERNEL_TARGET)???$(zip_root)/RECOVERY/kernel??1097?????????$(hide)?$(ACP)?$(recovery_ramdisk)???$(zip_root)/RECOVERY/ramdisk??1098?endif??1099?ifdef?INSTALLED_2NDBOOTLOADER_TARGET??1100?????????$(hide)?$(ACP)?/??1101?????????????????$(INSTALLED_2NDBOOTLOADER_TARGET)???$(zip_root)/RECOVERY/second??1102?endif??1103?ifdef?BOARD_KERNEL_CMDLINE??1104?????????$(hide)?echo?"$(BOARD_KERNEL_CMDLINE)"?>???$(zip_root)/RECOVERY/cmdline??1105?endif??1106?ifdef?BOARD_KERNEL_BASE??1107?????????$(hide)?echo?"$(BOARD_KERNEL_BASE)"?>???$(zip_root)/RECOVERY/base??1108?endif??1109?????????@#?Components?of?the?factory?image??1110?????????$(hide)?mkdir?-p?$(zip_root)/FACTORY??1111?????????$(hide)?$(call?package_files-copy-root,?/??1112???????????????????$(TARGET_FACTORY_ROOT_OUT),$(zip_root)/FACTORY/RAMDISK)??1113?ifdef?INSTALLED_KERNEL_TARGET??1114?????????$(hide)?$(ACP)?$(INSTALLED_KERNEL_TARGET)???$(zip_root)/FACTORY/kernel??1115?endif??1116?ifdef?INSTALLED_2NDBOOTLOADER_TARGET??1117?????????$(hide)?$(ACP)?/??1118?????????????????$(INSTALLED_2NDBOOTLOADER_TARGET)???$(zip_root)/FACTORY/second??1119?endif??1120?ifdef?BOARD_KERNEL_CMDLINE??1121?????????$(hide)?echo?"$(BOARD_KERNEL_CMDLINE)"?>???$(zip_root)/FACTORY/cmdline??1122?endif??1123?ifdef?BOARD_KERNEL_BASE??1124?????????$(hide)?echo?"$(BOARD_KERNEL_BASE)"?>???$(zip_root)/FACTORY/base??1125?endif??1126?????????@#?Components?of?the?boot?image??1127?????????$(hide)?mkdir?-p?$(zip_root)/BOOT??1128?????????$(hide)?$(call?package_files-copy-root,?/??1129?????????????????$(TARGET_ROOT_OUT),$(zip_root)/BOOT/RAMDISK)??1130?ifdef?INSTALLED_KERNEL_TARGET??1131?????????$(hide)?$(ACP)?$(INSTALLED_KERNEL_TARGET)???$(zip_root)/BOOT/kernel??1132?????????$(hide)?$(ACP)?$(INSTALLED_RAMDISK_TARGET)???$(zip_root)/BOOT/ramdisk??1133?endif??1134?ifdef?INSTALLED_2NDBOOTLOADER_TARGET??1135?????????$(hide)?$(ACP)?/??1136?????????????????$(INSTALLED_2NDBOOTLOADER_TARGET)???$(zip_root)/BOOT/second??1137?endif??1138?ifdef?BOARD_KERNEL_CMDLINE??1139?????????$(hide)?echo?"$(BOARD_KERNEL_CMDLINE)"?>???$(zip_root)/BOOT/cmdline??1140?endif??1141?ifdef?BOARD_KERNEL_BASE??1142?????????$(hide)?echo?"$(BOARD_KERNEL_BASE)"?>???$(zip_root)/BOOT/base??1143?endif??1144?????????$(hide)?$(foreach?t,$(INSTALLED_RADIOIMAGE_TARGET),/??1145?????????????????????mkdir?-p?$(zip_root)/RADIO;?/??1146?????????????????????$(ACP)?$(t)?$(zip_root)/RADIO/$(notdir?$(t));)??1147?????????@#?Contents?of?the?system?image??1148?????????$(hide)?$(call?package_files-copy-root,?/??1149?????????????????$(SYSTEMIMAGE_SOURCE_DIR),$(zip_root)/SYSTEM)??1150?????????@#?Contents?of?the?data?image??1151?????????$(hide)?$(call?package_files-copy-root,?/??1152?????????????????$(TARGET_OUT_DATA),$(zip_root)/DATA)??1153?????????@#?Extra?contents?of?the?OTA?package??1154?????????$(hide)?mkdir?-p?$(zip_root)/OTA/bin??1155?????????$(hide)?$(ACP)?$(INSTALLED_ANDROID_INFO_TXT_TARGET)???$(zip_root)/OTA/??1156?????????$(hide)?$(ACP)?$(PRIVATE_OTA_TOOLS)?$(zip_root)/OTA/bin/??1157?????????@#?Files?that?do?not?end?up?in?any?images,?but?are???necessary?to??1158?????????@#?build?them.??1159?????????$(hide)?mkdir?-p?$(zip_root)/META??1160?????????$(hide)?$(ACP)?$(APKCERTS_FILE)???$(zip_root)/META/apkcerts.txt??1161?????????$(hide)?echo?"$(PRODUCT_OTA_PUBLIC_KEYS)"?>???$(zip_root)/META/otakeys.txt??1162?????????$(hide)?echo?"$(PRIVATE_RECOVERY_API_VERSION)"?>???$(zip_root)/META/recovery-api-version.txt??1163?????????$(hide)?echo?"blocksize?$(BOARD_FLASH_BLOCK_SIZE)"?>???$(zip_root)/META/imagesizes.txt??1164?????????$(hide)?echo?"boot?$(call???image-size-from-data-size,$(BOARD_BOOTIMAGE_PARTITION_SIZE))"?>>???$(zip_root)/META/imagesizes.txt??1165?????????$(hide)?echo?"recovery?$(call???image-size-from-data-size,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE))"???>>?$(zip_root)/META/imagesizes.txt??1166?????????$(hide)?echo?"system?$(call???image-size-from-data-size,$(BOARD_SYSTEMIMAGE_PARTITION_SIZE))"?>>???$(zip_root)/META/imagesizes.txt??1167?????????$(hide)?echo?"secro?$(call???image-size-from-data-size,$(BOARD_SECROIMAGE_PARTITION_SIZE))"?>>???$(zip_root)/META/imagesizes.txt??1168?????????$(hide)?echo?"userdata?$(call???image-size-from-data-size,$(BOARD_USERDATAIMAGE_PARTITION_SIZE))"???>>?$(zip_root)/META/imagesizes.txt??1169?????????$(hide)?echo?"$(tool_extensions)"?>???$(zip_root)/META/tool-extensions.txt??1170?????????@#?Zip?everything?up,?preserving?symlinks??1171?????????$(hide)?(cd?$(zip_root)?&&?zip?-qry?../$(notdir?$@)???.)??1172?????????@#?Run?fs_config?on?all?the?system?files?in?the?zip,?and???save?the?output??1173?????????$(hide)?zipinfo?-1?$@?|?awk?-F/?'BEGIN?{?OFS="/"?}???/^SYSTEM///?{$$1?=?"system";?print}'?|?$(HOST_OUT_EXECUTABLES)/fs_config???>?$(zip_root)/META/filesystem_config.txt??1174?????????$(hide)?(cd?$(zip_root)?&&?zip?-q?../$(notdir?$@)???META/filesystem_config.txt)?? ?
?
可見往里面添加了很多內容。
L1089-1090 ,?造一個目錄。
L1091-1108?,填充?RECOVERY?子目錄的內容。用于生成recovery.img?。包括:kernel?的image, recovery?根文件系統的?image, recovery?根文件系統的內容: RECOVERY$ tree -L 2 ├──?kernel ├──?ramdisk └──?RAMDISK ????├──?advanced_meta_init.rc ????├──?data ????├──?default.prop ????├──?dev ????├──?etc ????├──?init ????├──?init.factory.rc ????├──?init.goldfish.rc ????├──?init.mt6516.rc ????├──?init.rc ????├──?meta_init.rc ????├──?proc ????├──?res ????├──?sbin ????├──?sys ????├──?system ????└──?tmp
L1109-1125,?填充?FACTORY?子目錄的內容, 沒有用到,包括:kernel?的image L1126-1143,?填充?BOOT?子目錄的內容,用于生成boot.img?。和?RECOVERY?目錄類似,包括:kernel?的image,?根文件系統的image,?根文件系統的內容: BOOT$ tree -L 2 . ├──?kernel ├──?ramdisk └──?RAMDISK ????├──?advanced_meta_init.rc ????├──?data ????├──?default.prop ????├──?dev ????├──?init ????├──?init.factory.rc ????├──?init.goldfish.rc ????├──?init.mt6516.rc ????├──?init.rc ????├──?meta_init.rc ????├──?proc ????├──?res -> /system/res ????├──?sbin ????├──?sys ????└──?system ? L1144-1146,?填充?RADIO?子目錄的內容, 沒有用到。 L1147-1149,?填充?SYSTEM?子目錄的內容。 這是升級的主要內容。 L1150-1152,?填充?DATA?子目錄的內容。缺省沒有用到。 L1153-1156,?填充?OTA/bin?子目錄的內容,?這是OTA?升級自己使用的程序。后面會遇到。 OTA/bin$ tree . ├──?applypatch ├──?applypatch_static ├──?check_prereq └──?updater L1159-1169,?填充?META?子目錄的內容,?這里包含了OTA?腳本需要的一些附加信息。 L1170-1171,?將所有內容打包。供下一階段使用。 L1173-1174,?生成?META/filesystem_config.txt?并將其加入到?zip?包中。該文件保存了?system?目錄下各目錄、文件的權限及owner. $ head META/filesystem_config.txt system 0 0 755 system/usr 0 0 755 system/usr/srec 0 0 755 system/usr/srec/config 0 0 755 system/usr/srec/config/en.us 0 0 755 system/usr/srec/config/en.us/grammars 0 0 755 system/usr/srec/config/en.us/grammars/phone_type_choice.g2g 0 0 644 system/usr/srec/config/en.us/grammars/VoiceDialer.g2g 0 0 644 system/usr/srec/config/en.us/grammars/boolean.g2g 0 0 644 system/usr/srec/config/en.us/g2p 0 0 755 ? 這里,目錄由?zipinfo –l?提供, 而權限則由?fs_config?設定。此程序的源碼位于:build/tools/fs_config,?其中fs_config包含了一個頭文件: 54?#include "?private/android_filesystem_config.h?" 這個文件(
system/core/include/private/android_filesystem_config.h?)?以hardcoding?的方式設定了?system?下各目錄、文件的權限、屬主。比如: 152??????{ 00440,?AID_ROOT?,??????AID_SHELL?,?????"system/etc/init.goldfish.rc"?}, 153??????{ 00550,?AID_ROOT?,??????AID_SHELL?,?????"system/etc/init.goldfish.sh"?}, 154??????{ 00440,?AID_ROOT?,??????AID_SHELL?,?????"system/etc/init.trout.rc"?}, 155??????{ 00550,?AID_ROOT?,??????AID_SHELL?,?????"system/etc/init.ril"?}, ? 如果需要升級其它內容,比如?bootloader,?則可以在這里加入。 ?
步驟二
編譯腳本如下?:
(From: build/core/Makefile)
?
1186?name?:=?$(TARGET_PRODUCT)??1187?ifeq?($(TARGET_BUILD_TYPE),debug)??1188???name?:=?$(name)_debug??1189?endif??1190?name?:=?$(name)-ota-$(FILE_NAME_TAG)??1191???1192?INTERNAL_OTA_PACKAGE_TARGET?:=?$(PRODUCT_OUT)/$(name).zip??1193???1194?$(INTERNAL_OTA_PACKAGE_TARGET):?KEY_CERT_PAIR?:=?$(DEFAULT_KEY_CERT_PAIR)??1195???1196?ifeq?($(TARGET_OTA_SCRIPT_MODE),)??1197?#?default??to??"auto"???1198?$(INTERNAL_OTA_PACKAGE_TARGET):?scriptmode?:=?auto??1199?else???1200?$(INTERNAL_OTA_PACKAGE_TARGET):?scriptmode?:=?$(TARGET_OTA_SCRIPT_MODE)??1201?endif??1202???1203?$(INTERNAL_OTA_PACKAGE_TARGET):?$(BUILT_TARGET_FILES_PACKAGE)?$(OTATOOLS)??1204?????????@echo?"Package?OTA:?$@"???1205?????????$(hide)?./build/tools/releasetools/ota_from_target_files?/??1206????????????-m?$(scriptmode)?/??1207????????????-p?$(HOST_OUT)?/??1208????????????-k?$(KEY_CERT_PAIR)?/??1209????????????$(BUILT_TARGET_FILES_PACKAGE)?$@?? 1186?name?:=?$(TARGET_PRODUCT)??1187?ifeq?($(TARGET_BUILD_TYPE),debug)??1188???name?:=?$(name)_debug??1189?endif??1190?name?:=?$(name)-ota-$(FILE_NAME_TAG)??1191???1192?INTERNAL_OTA_PACKAGE_TARGET?:=?$(PRODUCT_OUT)/$(name).zip??1193???1194?$(INTERNAL_OTA_PACKAGE_TARGET):?KEY_CERT_PAIR?:=?$(DEFAULT_KEY_CERT_PAIR)??1195???1196?ifeq?($(TARGET_OTA_SCRIPT_MODE),)??1197?#?default?to?"auto"??1198?$(INTERNAL_OTA_PACKAGE_TARGET):?scriptmode?:=?auto??1199?else??1200?$(INTERNAL_OTA_PACKAGE_TARGET):?scriptmode?:=?$(TARGET_OTA_SCRIPT_MODE)??1201?endif??1202???1203?$(INTERNAL_OTA_PACKAGE_TARGET):?$(BUILT_TARGET_FILES_PACKAGE)?$(OTATOOLS)??1204?????????@echo?"Package?OTA:?$@"??1205?????????$(hide)?./build/tools/releasetools/ota_from_target_files?/??1206????????????-m?$(scriptmode)?/??1207????????????-p?$(HOST_OUT)?/??1208????????????-k?$(KEY_CERT_PAIR)?/??1209????????????$(BUILT_TARGET_FILES_PACKAGE)?$@?? ?
?
核心是一個python?腳本: ota_from_target_files,?它以前一步驟生成的ZIP?包作為輸入,生成可用于OTA?升級的zip?包。 具體內容我們后文繼續分析。
轉載于:https://www.cnblogs.com/perseus/articles/2348029.html
總結
以上是生活随笔為你收集整理的【转】Android OTA 升级之一:编译升级包的全部內容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。