找回密码
 立即注册
查看: 187|回复: 0

AB升级(1): 使用Python脚本模拟升级

[复制链接]
发表于 2022-5-25 08:44 | 显示全部楼层 |阅读模式
升级过程


system/update_engine/scripts/update_device.py --file full-ota-xxx.zip
执行命令以后,终端打印信息,Android系统中没有任何提示信息
python system/update_engine/scripts/update_device.py out/target/product/dl36/dl36-ota-1640654433.zipINFO:root:Running: adb shell su 0 update_engine_client --helpINFO:root:Running: adb reverse tcp:1234 tcp:391331234INFO:root:Running: adb shell su 0 update_engine_client --update --follow --payload=http://127.0.0.1:1234/payload --offset=1808 --size=1345770359 --headers="FILE_HASH=clGjz1kJ/Toxcax0Ap8d2cCVupI1xoBBXgqOzNK+IeQ=FILE_SIZE=1345770359METADATA_HASH=EG0gbI1eQ5PCQhcOovjiP8zK1H14T6CL8znOwAnQRnE=METADATA_SIZE=98416USER_AGENT=Dalvik (something, something)NETWORK_ID=0"[INFO:update_engine_client_android.cc(92)] onStatusUpdate(UPDATE_STATUS_IDLE (0), 0)[INFO:update_engine_client_android.cc(92)] onStatusUpdate(UPDATE_STATUS_UPDATE_AVAILABLE (2), 0)[INFO:update_engine_client_android.cc(92)] onStatusUpdate(UPDATE_STATUS_CLEANUP_PREVIOUS_UPDATE (11), 0)127.0.0.1 - - [28/Dec/2021 15:16:24] "GET /payload HTTP/1.1" 206 -INFO:root:Serving request for /payload from out/target/product/dl36/dl36-ota-1640654433.zip [1808, 1345772167) length: 1345770359[INFO:update_engine_client_android.cc(92)] onStatusUpdate(UPDATE_STATUS_DOWNLOADING (3), 1.33515e-05)[INFO:update_engine_client_android.cc(92)] onStatusUpdate(UPDATE_STATUS_DOWNLOADING (3), 9.8739e-05)[INFO:update_engine_client_android.cc(92)] onStatusUpdate(UPDATE_STATUS_DOWNLOADING (3), 0.0101061)[INFO:update_engine_client_android.cc(92)] onStatusUpdate(UPDATE_STATUS_DOWNLOADING (3), 0.0201135)... ...[INFO:update_engine_client_android.cc(92)] onStatusUpdate(UPDATE_STATUS_DOWNLOADING (3), 0.960808)[INFO:update_engine_client_android.cc(92)] onStatusUpdate(UPDATE_STATUS_DOWNLOADING (3), 0.970815)[INFO:update_engine_client_android.cc(92)] onStatusUpdate(UPDATE_STATUS_DOWNLOADING (3), 0.980823)[INFO:update_engine_client_android.cc(92)] onStatusUpdate(UPDATE_STATUS_DOWNLOADING (3), 0.99083)[INFO:update_engine_client_android.cc(92)] onStatusUpdate(UPDATE_STATUS_FINALIZING (5), 0)[INFO:update_engine_client_android.cc(92)] onStatusUpdate(UPDATE_STATUS_FINALIZING (5), 0)[INFO:update_engine_client_android.cc(92)] onStatusUpdate(UPDATE_STATUS_FINALIZING (5), 0.01)[INFO:update_engine_client_android.cc(92)] onStatusUpdate(UPDATE_STATUS_FINALIZING (5), 0.02)[INFO:update_engine_client_android.cc(92)] onStatusUpdate(UPDATE_STATUS_FINALIZING (5), 0.04) ... ...[INFO:update_engine_client_android.cc(92)] onStatusUpdate(UPDATE_STATUS_FINALIZING (5), 0.95)[INFO:update_engine_client_android.cc(92)] onStatusUpdate(UPDATE_STATUS_FINALIZING (5), 0.96)[INFO:update_engine_client_android.cc(92)] onStatusUpdate(UPDATE_STATUS_FINALIZING (5), 0.97)[INFO:update_engine_client_android.cc(92)] onStatusUpdate(UPDATE_STATUS_FINALIZING (5), 0.98)[INFO:update_engine_client_android.cc(92)] onStatusUpdate(UPDATE_STATUS_FINALIZING (5), 0.99)[INFO:update_engine_client_android.cc(92)] onStatusUpdate(UPDATE_STATUS_FINALIZING (5), 1)[INFO:update_engine_client_android.cc(92)] onStatusUpdate(UPDATE_STATUS_FINALIZING (5), 1)[INFO:update_engine_client_android.cc(92)] onStatusUpdate(UPDATE_STATUS_FINALIZING (5), 1)[INFO:update_engine_client_android.cc(92)] onStatusUpdate(UPDATE_STATUS_UPDATED_NEED_REBOOT (6), 0)[INFO:update_engine_client_android.cc(100)] onPayloadApplicationComplete(ErrorCode::kSuccess (0))INFO:root:Running: adb reverse --remove tcp:1234INFO:root:Server Terminated
重启前
adb shell getprop | grep slot_suffix

手动重启以后,通知栏会出现"Finishing system update..."字样

adb shell getprop | grep slot_suffix

系统成功由slot A切换到slot B
环境问题


执行脚本出现如下错误:
ImportError: No module named google.protobu
update_device.py以及相关脚本都是使用python2编写,如果使用python3需要大量改动。需要安装3.17.3这个是python2支持的protobuf最后一个版本,不然会出现各种编译的问题。
sudo pip install protobuf==3.17.3
懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Unity开发者联盟 ( 粤ICP备20003399号 )

GMT+8, 2024-11-27 02:45 , Processed in 0.062252 second(s), 22 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表