2024年6月11日发(作者:)
Command: "/sbin/recovery" "--update_package=@/cache/recovery/"
"--locale=zh_CN"
Supported API: 3
update_package = @/cache/recovery/
I:Finding
I:Update location: @/cache/recovery/
Opening
E:failed to map file
E:install package error, result = 2
The is corrupted
Installation aborted.
OTA failed! Please power off the device to keep it in this state and file a bug report!
write result : MOTA_RESULT_FILE
write result : remove_mota_file
write result : remove_mota_file(DEFAULT_MOTA_FILE)
Supported API: 3
update_package = NULL
I:no boot messages recovery
I:[1]check the otaupdate is done!
I:Saving locale "zh_CN"
升级失败和升级成功的log差异再次
update_package 是否为空
MTK搜索
[FAQ17442][Recovery][Common]Android M 版本
data加密后升级包放入/data分区如何升级?
[DESCRIPTION]
Android M 版本,data加密后,开启MTK_SHARED_SDCARD并把升级包放入内卡;或者
有需要把升级包放入/data分区来升级,一般这种情况,直接按键进入recovery
mode,选择apply from sdcard来实现升级,是行不通的,建议在验证升级时,使用
adb 命令的方式升级。
[SOLUTION]
步骤如下:
1、在normal mode先把升级包() push 到data分区目,比如
/data/.
2、adb shell 下执行:system/bin/uncrypt /data/
/cache/recovery/
注意:要等待一段时间,直到命令执行退出…,然后在执行如下命令;
3、adb shell echo "--update_package=@/cache/recovery/" >
/cache/recovery/command
4、adb reboot recovery
最后手机reboot进入recovery mode开始升级,如果以上各个步骤遇到问题,或者不
能升级,欢迎提eservice联系mediatek。
可以看出这里应该和加密版本有关系,加密版本的OTA在线升级的逻辑和SD卡的升级逻辑不
通
通过log也能看出
sd卡升级是没有走这边的解析和update_package赋值的
关键逻辑update_package=打出位置位于
main函数下:
update_package=mt_main_init_fota(update_package);
fprintf(stdout, "update_package = %sn", update_package ? update_package : "NULL");
Command: "/sbin/recovery" "--update_package=@/cache/recovery/"
"--locale=zh_CN"
打印位置:
printf("Command:");
for (arg = 0; arg < argc; arg++) {
printf(" "%s"", argv[arg]);
}
printf("n");
如下是正常升级成功的
is_gpt = 1
gpt prefix is /dev/block/platform/mtk-msdc.0/0/by-name
I:no boot messages
I:Open /cache/recovery/command fail errno = No such file or directory
locale is [zh_CN]
stage is []
reason is [(null)]
cannot find/open a drm device: No such file or directory
fb0 reports (possibly inaccurate):
如下是正常升级出问题的
is_gpt = 1
gpt prefix is /dev/block/platform/mtk-msdc.0/0/by-name
I:no boot messages
I:Got arguments from /cache/recovery/command
locale is [zh_CN]
stage is []
reason is [(null)]
cannot find/open a drm device: No such file or directory
可以看出在代码
// --- if that doesn't work, try the command file
if (*argc <= 1) {
FILE *fp = fopen_path(COMMAND_FILE, "r");
if (fp != NULL) {
char *token;
char *argv0 = (*argv)[0];
*argv = (char **) malloc(sizeof(char *) * MAX_ARGS);
(*argv)[0] = argv0; // use the same program name
char buf[MAX_ARG_LENGTH];
for (*argc = 1; *argc < MAX_ARGS; ++*argc) {
if (!fgets(buf, sizeof(buf), fp)) break;
token = strtok(buf, "rn");
if (token != NULL) {
(*argv)[*argc] = strdup(token); // Strip newline.
} else {
--*argc;
}
}
check_and_fclose(fp, COMMAND_FILE);
LOGI("Got arguments from %sn", COMMAND_FILE);
}
else {
LOGI("Open %s fail errno = %sn", COMMAND_FILE,strerror(errno));
}
}
这里就存在差异了
主要还是/cache/recovery/command这个命令文件存在与否决定了后面的逻辑
main->mt_main_update_package->install_package->really_install_package->LOGI("Finding
");->sysMapFile
-〉prompt_and_wait -〉mt_prompt_and_wait
全局搜索uncrypt发现此对zip的解析位置位于
adb logcat -s ShutdownThread查看log
打印出如下信息,可以判断确实是uncrypt失败导致的
但是看不到其他log,logcat窗口抓到log,但是文件内却没有,方法,多起几个adb logcat
窗口,把关机前的log提取出来看看是为何失败
03-21 06:53:07.769 817 3249 I ShutdownThread: Calling uncrypt and monitoring the
03-21 06:53:07.835 817 3318 D ShutdownThread: uncrypt failed with status: -1
03-21 06:53:07.840 817 3249 I ShutdownThread: Rebooting, reason: recovery
adb logcat -v time > d:/
打出来了
Line 13369: 03-21 07:10:56.655 I/ShutdownThread( 841): Calling uncrypt and
monitoring
Line 13381: 03-21 07:10:56.704 I/uncrypt ( 3157): update package is
"/data/media/0/lenovoota/TB3-730M_S011_160226_PRC_TO_TB3-730M_S012_160311_PRC.
zip"
Line 13383: 03-21 07:10:56.705 E/uncrypt ( 3157): failed to convert
"/data/media/0/lenovoota/TB3-730M_S011_160226_PRC_TO_TB3-730M_S012_160311_PRC.
zip" to absolute path: Permission denied
Line 13385: 03-21 07:10:56.697 W/uncrypt ( 3157): type=1400 audit(0.0:2137):
avc: denied { getattr } for path="/data/media" dev="dm-0" ino=499713
scontext=u:r:uncrypt:s0 tcontext=ubject_r:media_rw_data_file:s0 tclass=dir
permissive=0
Line 13385: 03-21 07:10:56.697 W/uncrypt ( 3157): type=1400 audit(0.0:2137):
avc: denied { getattr } for path="/data/media" dev="dm-0" ino=499713
scontext=u:r:uncrypt:s0 tcontext=ubject_r:media_rw_data_file:s0 tclass=dir
permissive=0
Line 13391: 03-21 07:10:56.712 D/ShutdownThread( 841): uncrypt failed with
status: -1
Line 13531: 03-21 07:10:56.809 I/uncrypt ( 3163): removing old commands from
misc
Line 13545: 03-21 07:10:56.814 I/uncrypt ( 3163): rebooting to recovery
如上可知,增加权限即可


发布评论