高通Android13本地Recovery差分升级失败报错kInstallDeviceOpenError (7)原因分析

编译版本差分包出来验证差分升级过程中发现有时候能成功升级有时候不能。

现象描述:adb reboot recovery,选择Apply update from ADB。 然后输入命令adb reboot sideload ./OTApackage.zip进行本地差分升级。升级过程中升级失败并且提示如下信息:

问题分析:更换debug版本固件,重复上述操作步骤,看到升级失败提示后提取recovery.log出来分析。

js 复制代码
adb pull /tmp/recovery.log

把升级失败的日志和成功的日志进行对比发现存在如下区别:

js 复制代码
    成功部分日志
[   28.880965] update_engine_sideload I 01-01 02:40:52   445   445 snapshot.cpp:3447] Successfully created snapshot partition for odm_b
[   28.885833] update_engine_sideload I 01-01 02:40:52   445   445 snapshot.cpp:3447] Successfully created snapshot partition for product_b
[   28.904324] update_engine_sideload I 01-01 02:40:52   445   445 snapshot.cpp:3447] Successfully created snapshot partition for system_b
[   28.904664] update_engine_sideload I 01-01 02:40:52   445   445 snapshot.cpp:3447] Successfully created snapshot partition for system_dlkm_b
[   28.906182] update_engine_sideload I 01-01 02:40:52   445   445 snapshot.cpp:3447] Successfully created snapshot partition for system_ext_b
[   28.909221] update_engine_sideload I 01-01 02:40:52   445   445 snapshot.cpp:3447] Successfully created snapshot partition for vendor_b
[   28.909635] update_engine_sideload I 01-01 02:40:52   445   445 snapshot.cpp:3447] Successfully created snapshot partition for vendor_dlkm_b
[   28.909711] update_engine_sideload I 01-01 02:40:52   445   445 snapshot.cpp:3459] Successfully created snapshot for odm_b
[   28.909750] update_engine_sideload I 01-01 02:40:52   445   445 snapshot.cpp:3459] Successfully created snapshot for product_b
[   28.909788] update_engine_sideload I 01-01 02:40:52   445   445 snapshot.cpp:3459] Successfully created snapshot for system_b
[   28.909826] update_engine_sideload I 01-01 02:40:52   445   445 snapshot.cpp:3459] Successfully created snapshot for system_dlkm_b
[   28.909862] update_engine_sideload I 01-01 02:40:52   445   445 snapshot.cpp:3459] Successfully created snapshot for system_ext_b
[   28.909900] update_engine_sideload I 01-01 02:40:52   445   445 snapshot.cpp:3459] Successfully created snapshot for vendor_b
[   28.909937] update_engine_sideload I 01-01 02:40:52   445   445 snapshot.cpp:3459] Successfully created snapshot for vendor_dlkm_b
[   29.161509] update_engine_sideload I 01-01 02:40:52   445   445 snapshot.cpp:3314] Successfully created all snapshots for target slot _b
js 复制代码
    失败部分日志
[    6.701408] update_engine_sideload I 01-06 03:09:12   405   405 snapshot.cpp:3447] Successfully created snapshot partition for odm_b
[    6.706411] update_engine_sideload I 01-06 03:09:12   405   405 snapshot.cpp:3447] Successfully created snapshot partition for product_b
[    6.786439] update_engine_sideload I 01-06 03:09:12   405   405 snapshot.cpp:3447] Successfully created snapshot partition for system_b
[    6.786776] update_engine_sideload I 01-06 03:09:12   405   405 snapshot.cpp:3447] Successfully created snapshot partition for system_dlkm_b
[    6.788708] update_engine_sideload I 01-06 03:09:12   405   405 snapshot.cpp:3447] Successfully created snapshot partition for system_ext_b
[    6.856357] update_engine_sideload I 01-06 03:09:13   405   405 snapshot.cpp:3447] Successfully created snapshot partition for vendor_b
[    6.860247] update_engine_sideload I 01-06 03:09:13   405   405 snapshot.cpp:3447] Successfully created snapshot partition for vendor_dlkm_b
[    6.860324] update_engine_sideload I 01-06 03:09:13   405   405 snapshot.cpp:3459] Successfully created snapshot for odm_b
[    6.860361] update_engine_sideload I 01-06 03:09:13   405   405 snapshot.cpp:3459] Successfully created snapshot for product_b
[    6.860398] update_engine_sideload I 01-06 03:09:13   405   405 snapshot.cpp:3459] Successfully created snapshot for system_b
[    6.860434] update_engine_sideload I 01-06 03:09:13   405   405 snapshot.cpp:3459] Successfully created snapshot for system_dlkm_b
[    6.860471] update_engine_sideload I 01-06 03:09:13   405   405 snapshot.cpp:3459] Successfully created snapshot for system_ext_b
[    6.860565] update_engine_sideload E 01-06 03:09:13   405   405 fiemap_writer.cpp:664] Failed to create file at: /data/gsi/ota/vendor_b-cow-img.img: No such file or directory
[    6.860606] update_engine_sideload E 01-06 03:09:13   405   405 split_fiemap_writer.cpp:68] Could not determine maximum file size for /data/gsi/ota/vendor_b-cow-img.img

可以看到失败的日志少了如下三行,合理推测升级失败原因可能和vendor_b、vendor_dlkm_b这两个分区快照创建失败有关。

js 复制代码
Successfully created snapshot for vendor_b
Successfully created snapshot for vendor_dlkm_b
Successfully created all snapshots for target slot _b

目前安卓的升级机制是ab分区,平时的时候一个分区a是在用的,另一个分区b是空的,升级之前先在b分区准备好,然后再整体切换过去。升级完成之后就在使用b分区,a分区开始变成空的。如果你是在没有准备升级的过程中直接切换成另一个分区,机器会直接卡开机logo

js 复制代码
fastboot getvar current-slot
fastboot set_active a\b

同时重点关注下面这两行日志,这两行日志是出现在理应出现Successfully created snapshot for vendor_b的位置出现的

js 复制代码
update_engine_sideload E 01-06 03:09:13   405   405 fiemap_writer.cpp:664] Failed to create file at: /data/gsi/ota/vendor_b-cow-img.img: No such file or directory
update_engine_sideload E 01-06 03:09:13   405   405 split_fiemap_writer.cpp:68] Could not determine maximum file size for /data/gsi/ota/vendor_b-cow-img.img

通过关键词/data/gsi搜索,在网上搜到了这篇文章对Virtual A/B 分区工作方式的进一步探索 - LibXZR 的小本本,文章中提到升级内容默认会在super分区中创建临时的逻辑分区来进行存储,而在super分区空间不够用时,才会在/data下创建,同时也提到这些内容会创建在/data/gsi/ota路径下。

日志中正好提到Failed to create file at: /data/gsi/ota/vendor_b-cow-img.img: No such file or directory,是不是因为super分区不够才会升级失败的呢?查询发现当前设备设置的super分区是6g,尝试改成8g之后发现确实升级成功率会高很多,具体要设置多少才合适,是不是越大越好呢?在查阅谷歌官方文档和查找资料过程中,发现该项目实际采用的是虚拟ab分区,对super分区的要求如下

那么问题来了,不增加super分区升级会经常失败,但是谷歌又不推荐增加super分区。它的设计机制是使用/data的空间,但是日志中为什么在/data分区中创建文件失败了呢?

也是在查找资料过程中,发现安卓源码bootable/recovery/中有个updater_sample的app。尝试用这个app对设备进行差分升级,发现使用这种方式升级就能成功。那就是说在recovery模式下/data分区无法正常调用,但是在设备进系统使用的情况下是能使用的。

相关推荐
C4rpeDime2 小时前
自建MD5解密平台-续
android
盛派网络小助手2 小时前
微信 SDK 更新 Sample,NCF 文档和模板更新,更多更新日志,欢迎解锁
开发语言·人工智能·后端·架构·c#
鲤籽鲲3 小时前
C# Random 随机数 全面解析
android·java·c#
快乐非自愿7 小时前
分布式系统架构2:服务发现
架构·服务发现
2401_854391087 小时前
SSM 架构中 JAVA 网络直播带货查询系统设计与 JSP 有效实现方法
java·开发语言·架构
264玫瑰资源库7 小时前
从零开始C++棋牌游戏开发之第二篇:初识 C++ 游戏开发的基本架构
开发语言·c++·架构
神一样的老师7 小时前
面向高精度网络的时间同步安全管理架构
网络·安全·架构
2401_857026237 小时前
基于 SSM 架构的 JAVA 网络直播带货查询系统设计与 JSP 实践成果
java·开发语言·架构
9527华安7 小时前
FPGA实现MIPI转FPD-Link车载同轴视频传输方案,基于IMX327+FPD953架构,提供工程源码和技术支持
fpga开发·架构·mipi·imx327·fpd-link·fpd953
DT辰白7 小时前
如何解决基于 Redis 的网关鉴权导致的 RESTful API 拦截问题?
后端·微服务·架构