Android14 OTA差分包升级报kPayloadTimestampError (51)

发布于:2025-03-06 ⋅ 阅读:(10) ⋅ 点赞:(0)

由于VF 架构, 所以镜像的打包时间可能存在偏差, 如 boot.img 和 客制化的一些镜像打包 可能会在 vendor 侧进行打包。
而 与system 侧进行merge 时,时间戳比较乱,为了解决这个问题,让时间戳进行统一。

使用adb方式验证

  • 进入recovery模式
adb reboot recovery
  • 稍等一会界面会提示
Now send the package you want to apply 
to the device with "adb sidelaod <filename>"...
  • 输入命令开始升级
adb sideload Z:\xxx\xxx\ota\update.zip

update.zip是制作好的差分包

报ErrorCode::kPayloadTimestampError (51)

[   41.140193] update_engine_sideload E 11-29 07:06:04   361   361 [ERROR:delta_performer.cc(1170)] The current OS build timestamp (1732851959) is newer than the maximum timestamp in the manifest (1732851610)
[   41.140394] update_engine_sideload E 11-29 07:06:04   361   361 [ERROR:download_action.cc(222)] Error ErrorCode::kPayloadTimestampError (51) in DeltaPerformer's Write method when processing the received payload -- Terminating processing
[   41.140478] update_engine_sideload I 11-29 07:06:04   361   361 [INFO:delta_performer.cc(217)] Discarding 210485 unused downloaded bytes
[   41.153646] update_engine_sideload I 11-29 07:06:04   361   361 [INFO:multi_range_http_fetcher.cc(177)] Received transfer terminated.
[   41.153736] update_engine_sideload I 11-29 07:06:04   361   361 [INFO:multi_range_http_fetcher.cc(129)] TransferEnded w/ code 200
[   41.153787] update_engine_sideload I 11-29 07:06:04   361   361 [INFO:multi_range_http_fetcher.cc(131)] Terminating.
[   41.153866] update_engine_sideload I 11-29 07:06:04   361   361 [INFO:action_processor.cc(116)] ActionProcessor: finished DownloadAction with code ErrorCode::kPayloadTimestampError
[   41.153917] update_engine_sideload I 11-29 07:06:04   361   361 [INFO:action_processor.cc(121)] ActionProcessor: Aborting processing due to failure.
[   41.153994] update_engine_sideload I 11-29 07:06:04   361   361 [INFO:update_attempter_android.cc(548)] Processing Done.

由于 打包时间 差异,所以导致 时间戳 比较乱。

解决办法

提取 目标版本 和源版本 的镜像中的 时间戳。
按时间戳 大的 (最后编译)进行打包到 ota 升级包中

  • /vendor_ap_s0/build/make/tools/releasetools/ota_utils.py
 target_boot_timestamp = 0
   source_boot_timestamp = 0
+  target_system_timestamp = 0
+  source_system_timestamp = 0
   if target_info:
     partition_prop = target_info.get("boot.build.prop")
     if partition_prop:
       boot_timestamp = partition_prop.GetProp("ro.bootimage.build.date.utc")
       if boot_timestamp:
         target_boot_timestamp = int(boot_timestamp)
+    partition_prop = target_info.get("system.build.prop")
+    if partition_prop:
+      system_timestamp = partition_prop.GetProp("ro.system.build.date.utc")
+      if system_timestamp:
+        target_system_timestamp = int(system_timestamp)    
   if source_info:
     partition_prop = source_info.get("boot.build.prop")
     if partition_prop:
       boot_timestamp = partition_prop.GetProp("ro.bootimage.build.date.utc")
       if boot_timestamp:
         source_boot_timestamp = int(boot_timestamp)
-  target_max_timestamp = max(target_boot_timestamp, source_boot_timestamp)
-  source_max_timestamp = source_boot_timestamp
+    partition_prop = source_info.get("system.build.prop")
+    if partition_prop:
+      system_timestamp = partition_prop.GetProp("ro.system.build.date.utc")
+      if system_timestamp:
+        source_system_timestamp = int(system_timestamp)    
+  target_max_timestamp = max(target_boot_timestamp, source_boot_timestamp, target_system_timestamp,
+    source_system_timestamp)
+  source_max_timestamp = max(source_boot_timestamp, source_system_timestamp)
   for partition in PARTITIONS_WITH_BUILD_PROP:
     partition_prop_key = "{}.build.prop".format(partition)
     if partition == "boot":

boot.img 编译时间ro.bootimage.build.date.utc
system 编译时间ro.system.build.date.utc

比较哪个数值越大,就表明版本后面编译的时间来决定。


网站公告

今日签到

点亮在社区的每一天
去签到