android P OTA差分升级时报错记录
在android P版本中制作出了差分升级包和差分降级包,在执行差分升级时报错,日志如下:
[ 7.974280] Verifying current system...
[ 7.974298] failed to open emmc partition "/dev/block/platform/0.soc/fa507000.sdhci/by-name/boot": **No such file or directory**
[ 8.356131] file "EMMC:/dev/block/platform/0.soc/fa507000.sdhci/by-name/boot:11044864:59b6b0595c184367de46d97fa567e620ad20b3c1:11044864:de5a6f5bbac9abd332a21416144f75537223b5e7" doesn't have any of expected sha1 sums; checking cache
[ 8.356168] failed to stat "/cache/saved.file": No such file or directory
[ 8.356209] failed to load cache file
[ 8.356230] script aborted: E3005: "EMMC:/dev/block/platform/0.soc/fa507000.sdhci/by-name/boot:11044864:59b6b0595c184367de46d97fa567e620ad20b3c1:11044864:de5a6f5bbac9abd332a21416144f75537223b5e7" has unexpected contents.
[ 8.356254] E:Error in /data/upgrade.zip (Status 7)
对应的updater-script脚本内容
ui_print("Verifying current system...");
apply_patch_check("EMMC:/dev/block/platform/0.soc/fa507000.sdhci/by-name/boot:11044864:59b6b0595c184367de46d97fa567e620ad20b3c1:11044864:de5a6f5bbac9abd332a21416144f75537223b5e7")
|| abort("E3005: \"EMMC:/dev/block/platform/0.soc/fa507000.sdhci/by-name/boot:11044864:59b6b0595c184367de46d97fa567e620ad20b3c1:11044864:de5a6f5bbac9abd332a21416144f75537223b5e7\" has unexpected contents.");
代码打印异常的地方在android/boot/recovery/中的applypatch.cpp
static int LoadPartitionContents(const std::string& filename, FileContents* file) {std::vector<std::string> pieces = android::base::Split(filename, ":");if (pieces.size() < 4 || pieces.size() % 2 != 0 || pieces[0] != "EMMC") {printf("LoadPartitionContents called with bad filename \"%s\"\n", filename.c_str());return -1;}size_t pair_count = (pieces.size() - 2) / 2; // # of (size, sha1) pairs in filenamestd::vector<std::pair<size_t, std::string>> pairs;for (size_t i = 0; i < pair_count; ++i) {size_t size;if (!android::base::ParseUint(pieces[i * 2 + 2], &size) || size == 0) {printf("LoadPartitionContents called with bad size \"%s\"\n", pieces[i * 2 + 2].c_str());return -1;}pairs.push_back({ size, pieces[i * 2 + 3] });}// Sort the pairs array so that they are in order of increasing size.std::sort(pairs.begin(), pairs.end());const char* partition = pieces[1].c_str();unique_file dev(ota_fopen(partition, "rb")); ###fopen分区节点失败if (!dev) {printf("failed to open emmc partition \"%s\": %s\n", partition, strerror(errno));return -1;}SHA_CTX sha_ctx;SHA1_Init(&sha_ctx);
查看了一下,正在运行的设备中果然没有by-name/boot分区节点,只有by-name/boot_a,问题可能出在这里。
想着既然跟分区相关,那应该和fstab中的配置有关吧,修改一下fstab后,问题得到解决。
--------------------------- 分割线 --------------------------------
接着执行差分升级,又遇到另外一个system校验不通过问题
[ 20.585518] failed to read blocks for diff
[ 20.585536] failed to execute command [bsdiff 0 308806 83fd740b9f442ead28c97c11170edee811ecfc8b 57b5c6785db138b2c149b9fa38b7d24018c4f4a2 2,209853,211277 1425 2,209853,211278]
[ 20.974211] deleting stash 67d0d452af7be9d984c6c3cf2bd69fe4141e9b91
[ 20.974240] /dev/block/platform/0.soc/fa507000.sdhci/by-name/system image corrupted, attempting to recover...
[ 20.974262] script aborted: unable to use metadata to correct errors
[ 20.974282] E1004: system partition fails to recover
[ 20.974300] E:Error in /data/0428_upgrade.zip (Status 7)
本地system分区基础上没修改什么代码,所以基础上排除代码本身的问题。
看了下网上的资料,说是out中的system.img和obj/target中的system.img不同,手动fastboot flash target zip包中的system.img和vendor.img后,再执行差分升级,就成功了。
且看到有人整理了在编译时替换img的脚本,本地调试了一下,确实可以用,贴出来给需要的人。
#!/usr/bin/env python
#
# Copyright (C) 2014 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License."""
Given a target-files zipfile that does contain images (ie, does
have an IMAGES/ top-level subdirectory), replace the images to
the output dir.
Usage: replace_img_from_target_files target_files output
"""import sysif sys.hexversion < 0x02070000:print >> sys.stderr, "Python 2.7 or newer is required."sys.exit(1)import errno
import os
import re
import shutil
import subprocess
import tempfile
import zipfileimage_replace_list = ["boot.img","system.img","vendor.img"]if not hasattr(os, "SEEK_SET"):os.SEEK_SET = 0def main(argv):print "replace target images to output directory"if len(argv) != 2:print "must need two parameter, please check!"sys.exit(1)if not os.path.exists(argv[0]):print "Target file:%s is invalid" % argv[0]sys.exit(1)if not os.path.exists(argv[1]):print "Output dir:%s is invalid" % argv[1]sys.exit(1)zf = zipfile.ZipFile(argv[0], 'r')for img in zf.namelist():if img.find("IMAGES/") != -1:if img.find(".img") != -1:data = zf.read(img)name = img.replace("IMAGES/", '')if name in image_replace_list:print "Replace %s" % namename = '/'.join((argv[1], name))file = open(name, "w")file.write(data)file.close()if __name__ == '__main__':main(sys.argv[1:])
对应的编译打包日志
replace target images to output directory
Replace boot.img
Replace system.img
Replace vendor.img
[100% 1006/1006] Package OTA: out/target/product/xxx/xxx.zip
到这里后,整个差分升级就成功了,没有再报错。
android P OTA差分升级时报错记录相关推荐
- 艾拉比与睿赛德科技强强联手,推出基于RT-Thread操作系统的OTA差分升级
上海艾拉比智能科技有限公司(简称 艾拉比 ABUP)与国内领先的物联网操作系统厂商睿赛德科技(简称RT-Thread)签订战略合作,双方优势互补,生态共赢,推出基于国产自主可控操作系统RT-Threa ...
- Android P OTA增量升级
1.在Android根目录下添加OTA增量包编译脚本: build_release_incremental_ota.sh #!/bin/bash # # Copyright (c) 2012, The ...
- android R编译Super镜像时报错问题分析和定位
在android R版本全编译时,遇到编译打包super.img时报错,这里介绍一下这种问题如何定位原因和解决,主要是描述一下分析的思路. 错误日志如下: out/target/product/tt/ ...
- RK3288 RK3368 瑞芯微RK系列Android生成OTA差分升级包
一.OTA完整包生成方法 OTA完整包可用于T卡本地升级和OTA在线升级.OTA完整包包含完整的system.recovery. 和boot.img. 发布一个版本固件正确顺序: make -j4 m ...
- 【Android开发】app升级报错,解析包时出现错误(华为手机8.0系统)
问题描述: 今天发布app版本升级,碰到华为手机8.0系统,安装升级的时候提示,解析包时出现问题.而其他手机都是正常的.而且当我的包没有经过360加固的时候,也是可以去升级新版本,加固过后就不行了. ...
- 关于卡巴斯基6.0自动升级时报错后自动退出的情况
11月22日左右,很多装了卡巴斯基的朋友都出现了卡巴斯基报错以后自动关闭的问题. 其实这次出错是卡巴自己的升级问题,卡巴的安全专家放出更新中断的解释(已解决更新中断的问题),是由于卡巴服务器更新文件错 ...
- Android Studio3.2.1升级刨坑记录
Android Studio出了3.2.1,我用的是2.3,所有决定升级一下,看看如何 为了保险一点,下载了官方的解压版本,也就是说不含sdk,下载android-studio-ide-181.501 ...
- Android Studio中虚拟机运行时报错的解决方法
Android Studio中启动虚拟机时,在主界面的"Event Log"中可能会有报错信息,此时虚拟机仍然是可以运行的. 1 Failed to open /qemu.conf ...
- weblogic10.3.6补丁升级时报错遇到无法识别的补丁程序ID
环境配置: 服务器:win2008 R2 weblogic版本:10.3.6 问题描述: 尝试升级补丁程序时遇见以下报错 遇到无法识别的补丁ID:xxxx 通常原因: 通常会发生这种情况,因为特定的补 ...
最新文章
- sar 找出系统瓶颈的利器 目前Linux上最为全面的系统性能分析工具之一 直接 sar -dur 1 30 即可看内存 CPU和IO占用...
- java中oriqinal_Java集合10 (NavigableMap)
- 分发器上的会话代理进程控制脚本使用说明
- 前端使用linux命令更新项目生产包与测试包命令
- map、set和unordered_map、unordered_set对比
- 基于DEAP库的python进化算法-2.进化算法各元素的DEAP实现
- ie调试html代码,IE下的调试工具IE WebDeveloper
- 浏览器分辨率使用排名以及不同分辨率下的网页测试
- 真题解析 | 2022数模美赛C题:股票投资策略
- java论文word_java毕设论文参考文献.doc
- 【web前端特效源码】使用HTML5+CSS3制作一个3D视频旋转立方体动画效果~~适合初学者~超简单~ |前端开发|IT软件
- echart柱状图横向_echarts 横向柱状图TOP10
- android 获取以太网的动态IP地址,子网掩码,DNS地址,网关地址
- 在线二维码生成工具html源码
- 怎么在视频上叠加字幕和Logo--技术实现2
- 如何去除 录像开始和结束时 的噔噔噔噔声音
- Kindle资源-史上最全60GB的Kindle电子书资源网盘打包下载
- 人工智能,落地为王!深圳人工智能企业百强榜超七成为应用层
- STM32驱动12bit AD TLC2543(I/O模拟方式)
- P7721 [Ynoi2007] rcn