Command: "/sbin/recovery" "--update_package=@/cache/recovery/block.map" "--locale=zh_CN"Supported API: 3update_package = @/cache/recovery/block.mapI:Finding update package...I:Update location: @/cache/recovery/block.mapOpening update package...E:failed to map fileE:install package error, result = 2The update.zip is corruptedInstallation aborted.OTA failed! Please power off the device to keep it in this state and file a bug report!write result : MOTA_RESULT_FILEwrite result : remove_mota_filewrite result : remove_mota_file(DEFAULT_MOTA_FILE)Supported API: 3update_package = NULLI:no boot messages recoveryI:[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分区来升级,一般这种情况,直接按键进入recoverymode,选择apply from sdcard来实现升级,是行不通的,建议在验证升级时,使用adb 命令的方式升级。
[SOLUTION]步骤如下:1、在normal mode先把升级包(update.zip) push 到data分区目,比如/data/update.zip.2、adb shell 下执行:system/bin/uncrypt /data/update.zip/cache/recovery/block.map注意:要等待一段时间,直到命令执行退出…,然后在执行如下命令;3、adb shell echo \"--update_package=@/cache/recovery/block.map\" >/cache/recovery/command4、adb reboot recovery最后手机reboot进入recovery mode开始升级,如果以上各个步骤遇到问题,或者不能升级,欢迎提eservice联系mediatek。
可以看出这里应该和加密版本有关系,加密版本的OTA在线升级的逻辑和SD卡的升级逻辑不通通过log也能看出sd卡升级是没有走这边的解析和update_package赋值的关键逻辑update_package=打出位置位于recovery.cppmain函数下:update_package=mt_main_init_fota(update_package);fprintf(stdout, "update_package = %s\n", update_package ? update_package : "NULL"); Command: "/sbin/recovery" "--update_package=@/cache/recovery/block.map""--locale=zh_CN"打印位置:printf("Command:");for (arg = 0; arg < argc; arg++) {printf(" \"%s\"", argv[arg]);}printf("\n");如下是正常升级成功的is_gpt = 1gpt prefix is /dev/block/platform/mtk-msdc.0/11230000.msdc0/by-nameI:no boot messagesI:Open /cache/recovery/command fail errno = No such file or directorylocale is [zh_CN]stage is []reason is [(null)]cannot find/open a drm device: No such file or directoryfb0 reports (possibly inaccurate):如下是正常升级出问题的is_gpt = 1gpt prefix is /dev/block/platform/mtk-msdc.0/11230000.msdc0/by-nameI:no boot messagesI:Got arguments from /cache/recovery/commandlocale 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 fileif (*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 namechar buf[MAX_ARG_LENGTH];for (*argc = 1; *argc < MAX_ARGS; ++*argc) {if (!fgets(buf, sizeof(buf), fp)) break;token = strtok(buf, "\r\n");if (token != NULL) {(*argv)[*argc] = strdup(token); // Strip newline.} else {--*argc;}}check_and_fclose(fp, COMMAND_FILE);LOGI("Got arguments from %s\n", COMMAND_FILE);}else {LOGI("Open %s fail errno = %s\n", COMMAND_FILE,strerror(errno));}}这里就存在差异了主要还是/cache/recovery/command这个命令文件存在与否决定了后面的逻辑main->mt_main_update_package->install_package->really_install_package->LOGI("Finding update package...\n");->sysMapFile-〉prompt_and_wait -〉mt_prompt_and_wait全局搜索uncrypt发现此对zip的解析位置位于ShutdownThread.javaadb 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 progress...03-21 06:53:07.835 817 3318 D ShutdownThread: uncrypt failed with status: -103-21 06:53:07.840 817 3249 I ShutdownThread: Rebooting, reason: recoveryadb logcat -v time > d:/temp.log打出来了Line 13369: 03-21 07:10:56.655 I/ShutdownThread( 841): Calling uncrypt and monitoring the progress...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 deniedLine 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=499713scontext=u:r:uncrypt:s0 tcontext=u bject_r:media_rw_data_file:s0 tclass=dir permissive=0Line 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=499713scontext=u:r:uncrypt:s0 tcontext=u bject_r:media_rw_data_file:s0 tclass=dir permissive=0Line 13391: 03-21 07:10:56.712 D/ShutdownThread( 841): uncrypt failed with status: -1Line 13531: 03-21 07:10:56.809 I/uncrypt ( 3163): removing old commands from miscLine 13545: 03-21 07:10:56.814 I/uncrypt ( 3163): rebooting to recovery如上可知,增加权限即可。