制作差分包的命令:./build/tools/releasetools/ota_from_target_files -k <key_path> -i old.zip new.zip update.zip
那么我们如何选择key_path呢?我们在/build/target/product/security/目录下面有很多key文件,那么我们该选择呢?这里MTK平台是由相应的规则的,如下:
我们去查看ProjectConfig.mk中相对应的宏,根据相关宏的值来决定
- 如果MTK_SIGNATURE_CUSTOMIZATION=yes并且MTK_INTERNAL=no,
- 选择build/target/product/security/[Project]/releasekey
- 如果MTK_SIGNATURE_CUSTOMIZATION=yes并且MTK_INTERNAL=yes,
- 选择 build/target/product/security/common/releasekey
- 如果MTK_SIGNATURE_CUSTOMIZATION=no
- 选择build/target/product/security/testkey
参考log信息:
I:Finding update package...
I:Update location: /sdcard/dload/update.zip
I:Opening update package...
I:read key e=65537 hash=20
I:1 key(s) loaded from /res/keys
I:Verifying update package...
I:comment is 1738 bytes; signature 1720 bytes from end
I:failed to verify against key 0
E:failed to verify whole-file signature
I:verify_file returned 1
E:signature verification failed
Installation aborted.