Android OTA差分包制作(RK平台)

一、步骤说明

1. 编译两个新旧版本,需要用到两个版本的rk3566_r-target_files-eng.zip文件。

2. 将两个版本的rockdev/Image-rk3566_r/rk3566_r-target_files-eng.zip拷贝到某个制作空间下,建议文件命名带上型号及版本号,方便维护,如:

rk3566_r-target_files-XXModel-V3.0.0.zip

rk3566_r-target_files-XXModel-V3.0.1.zip

3. 在源码目录下执行source和 launch操作。

4. 使用源码中ota_from_target_files脚本制作差分包:

./build/tools/releasetools/ota_from_target_files -p out/host/linux-x86 -k build/target/product/security/testkey -i version_low.zip version_high.zip ota_version_low_to_version_high.zip

参数含义:

-p:执行脚本所需的依赖库路径

-k:指定系统所使用的签名

注:

1.以上两个参数必须带上,否则会报错;

2.会依赖 out/host/linux-x86目录下的相关资源。

不同平台估计有差异,以实际为准。

二、示例

1. 拷贝版本到制作空间

cp /data/version/rk3566_r11/Image-rk3566_r_83372e_1123/rk3566_r-target_files-eng.zip ota_diff_space/rk3566_r-target_XXX_V3.0.0.zip

cp rkcode_sdk11.0_r11/rockdev/Image-rk3566_r/rk3566_r-target_files-eng.zip ota_diff_space/rk3566_r-target_XXX_V3.0.1.zip

2. 进到源码根目录,先执行source和lunch

source build/envsetup.sh

lunch 51

3. 执行差分包制作命令:

KVM:/data/workspace/RK_3566_USER_R11/rkcode_sdk11.0_r11$ ./build/tools/releasetools/ota_from_target_files -p out/host/linux-x86 -k build/target/product/security/testkey -i ../ota_diff_space/rk3566_r-target_XXX_V3.0.0.zip ../ota_diff_space/rk3566_r-target_XXX_V3.0.1.zip ../ota_diff_space/rk3566_r_ota_XXX_V3.0.0_to_V3.0.1.zip 2022-12-02 10:12:31 - common.py - WARNING : Failed to read SYSTEM/etc/build.prop 2022-12-02 10:12:31 - common.py - WARNING : Failed to read VENDOR/etc/build.prop 2022-12-02 10:12:31 - common.py - WARNING : Failed to read PRODUCT/etc/build.prop 2022-12-02 10:12:31 - common.py - WARNING : Failed to read SYSTEM_EXT/etc/build.prop 2022-12-02 10:12:31 - common.py - WARNING : Failed to read SYSTEM/etc/build.prop 2022-12-02 10:12:31 - common.py - WARNING : Failed to read VENDOR/etc/build.prop 2022-12-02 10:12:31 - common.py - WARNING : Failed to read PRODUCT/etc/build.prop 2022-12-02 10:12:31 - common.py - WARNING : Failed to read SYSTEM_EXT/etc/build.prop 2022-12-02 10:15:25 - common.py - WARNING : Failed to read SYSTEM/etc/build.prop 2022-12-02 10:15:25 - common.py - WARNING : Failed to read VENDOR/etc/build.prop 2022-12-02 10:15:25 - common.py - WARNING : Failed to read PRODUCT/etc/build.prop 2022-12-02 10:15:25 - common.py - WARNING : Failed to read SYSTEM_EXT/etc/build.prop 2022-12-02 10:15:26 - common.py - WARNING : Failed to read SYSTEM/etc/build.prop 2022-12-02 10:15:26 - common.py - WARNING : Failed to read VENDOR/etc/build.prop 2022-12-02 10:15:26 - common.py - WARNING : Failed to read PRODUCT/etc/build.prop 2022-12-02 10:15:26 - common.py - WARNING : Failed to read SYSTEM_EXT/etc/build.prop 2022-12-02 10:15:26 - common.py - WARNING : Failed to read SYSTEM/etc/build.prop 2022-12-02 10:15:26 - common.py - WARNING : Failed to read VENDOR/etc/build.prop 2022-12-02 10:15:26 - common.py - WARNING : Failed to read PRODUCT/etc/build.prop 2022-12-02 10:15:26 - common.py - WARNING : Failed to read SYSTEM_EXT/etc/build.prop 2022-12-02 10:15:26 - common.py - WARNING : Failed to read SYSTEM/etc/build.prop 2022-12-02 10:15:26 - common.py - WARNING : Failed to read VENDOR/etc/build.prop 2022-12-02 10:15:26 - common.py - WARNING : Failed to read PRODUCT/etc/build.prop 2022-12-02 10:15:26 - common.py - WARNING : Failed to read SYSTEM_EXT/etc/build.prop 2022-12-02 10:15:26 - common.py - WARNING : Failed to read SYSTEM/etc/build.prop 2022-12-02 10:15:26 - common.py - WARNING : Failed to read VENDOR/etc/build.prop 2022-12-02 10:15:26 - common.py - WARNING : Failed to read PRODUCT/etc/build.prop 2022-12-02 10:15:26 - common.py - WARNING : Failed to read SYSTEM_EXT/etc/build.prop 2022-12-02 10:15:26 - common.py - WARNING : Failed to read SYSTEM/etc/build.prop 2022-12-02 10:15:26 - common.py - WARNING : Failed to read VENDOR/etc/build.prop 2022-12-02 10:15:26 - common.py - WARNING : Failed to read PRODUCT/etc/build.prop 2022-12-02 10:15:26 - common.py - WARNING : Failed to read SYSTEM_EXT/etc/build.prop 2022-12-02 10:15:43 - ota_from_target_files - WARNING : Duplicate block difference found. Device specific block diff for partition 'system_ext' overrides the one in generic script. 2022-12-02 10:15:43 - ota_from_target_files - WARNING : Duplicate block difference found. Device specific block diff for partition 'product' overrides the one in generic script. 2022-12-02 10:15:43 - ota_from_target_files - WARNING : Duplicate block difference found. Device specific block diff for partition 'odm' overrides the one in generic script. trust unchanged; skipping vbmeta unchanged; skipping dtbo unchanged; skipping write uboot now... charge unchanged; skipping resource unchanged; skipping warning: rk loader bin missing from target; not flashing loader warning: rk loader bin missing from source; not flashing loader loader unchanged; skipping vendor_boot unchanged; skipping logo unchanged; skipping

三、错误记录

其中-p参数没有配置上的话,将会出现如下错误:

2022-11-29 19:50:02 - ota_from_target_files.py - ERROR : ERROR: Traceback (most recent call last): File "../../../build/tools/releasetools/ota_from_target_files.py", line 2258, in <module> main(sys.argv[1:]) File "../../../build/tools/releasetools/ota_from_target_files.py", line 2237, in main source_file=OPTIONS.incremental_source) File "../../../build/tools/releasetools/ota_from_target_files.py", line 1992, in GenerateNonAbOtaPackage output_file) File "../../../build/tools/releasetools/ota_from_target_files.py", line 1616, in WriteBlockIncrementalOTAPackage FinalizeMetadata(metadata, staging_file, output_file, needed_property_files) File "../../../build/tools/releasetools/ota_from_target_files.py", line 1328, in FinalizeMetadata prelim_signing = ComputeAllPropertyFiles(input_file, needed_property_files) File "../../../build/tools/releasetools/ota_from_target_files.py", line 1314, in ComputeAllPropertyFiles SignOutput(input_file, prelim_signing) File "../../../build/tools/releasetools/ota_from_target_files.py", line 492, in SignOutput whole_file=True) File "/data/workspace/RK_3566_USER_R11/rkcode_sdk11.0_r11/build/make/tools/releasetools/common.py", line 1854, in SignFile proc.returncode, stdoutdata)) ExternalError: Failed to run signapk.jar: return code 1: Exception in thread "main" java.lang.ExceptionInInitializerError at org.conscrypt.OpenSSLBIOInputStream.<init>(OpenSSLBIOInputStream.java:34) at org.conscrypt.OpenSSLX509Certificate.fromX509PemInputStream(OpenSSLX509Certificate.java:119) at org.conscrypt.OpenSSLX509CertificateFactory$1.fromX509PemInputStream(OpenSSLX509CertificateFactory.java:220) at org.conscrypt.OpenSSLX509CertificateFactory$1.fromX509PemInputStream(OpenSSLX509CertificateFactory.java:216) at org.conscrypt.OpenSSLX509CertificateFactory$Parser.generateItem(OpenSSLX509CertificateFactory.java:94) at org.conscrypt.OpenSSLX509CertificateFactory.engineGenerateCertificate(OpenSSLX509CertificateFactory.java:272) at java.base/java.security.cert.CertificateFactory.generateCertificate(CertificateFactory.java:355) at com.android.signapk.SignApk.readPublicKey(SignApk.java:184) at com.android.signapk.SignApk.main(SignApk.java:1007) Caused by: java.lang.IllegalArgumentException: Failed to load any of the given libraries: [conscrypt_openjdk_jni-linux-x86_64, conscrypt_openjdk_jni-linux-x86_64-fedora, conscrypt_openjdk_jni] at org.conscrypt.NativeLibraryLoader.loadFirstAvailable(NativeLibraryLoader.java:160) at org.conscrypt.NativeCryptoJni.init(NativeCryptoJni.java:49) at org.conscrypt.NativeCrypto.<clinit>(NativeCrypto.java:53) ... 9 more

四、参考

RK3326平台Android9.0OTA差分包制作_abner.Li的博客-CSDN博客_android ota差分包制作