AUK CL

Android刷机-错误7解决方案
之前刷机时,总是会冒出错误7的报错,刷了一次后,第二次刷又忘了(/‵Д′)/~ ╧╧,干脆就写篇文章记录一下 (以...
扫描右侧二维码阅读全文
27
2018/08

Android刷机-错误7解决方案

之前刷机时,总是会冒出错误7的报错,刷了一次后,第二次刷又忘了(/‵Д′)/~ ╧╧,干脆就写篇文章记录一下
(以下以乐视MAX2机型作为示例)


原因

首先我们先明确一下问题所在

刷机报错误7的根源就是系统包里的刷机脚本验证机型语句

assert(getprop("ro.product.device") == "le_x2" || getprop("ro.build.product") == "le_x2" || 
   getprop("ro.product.device") == "le_x2_india" || getprop("ro.build.product") == "le_x2_india" || 
   getprop("ro.product.device") == "le_x2_na" || getprop("ro.build.product") == "le_x2_na" || 
   getprop("ro.product.device") == "LeMax2_CN" || getprop("ro.build.product") == "LeMax2_CN" || 
   getprop("ro.product.device") == "LeMax2_NA" || getprop("ro.build.product") == "LeMax2_NA" || 
   getprop("ro.product.device") == "LeMax2_WW" || getprop("ro.build.product") == "LeMax2_WW" || 
   getprop("ro.product.device") == "LeMax2" || getprop("ro.build.product") == "LeMax2" || abort("E3004: This package is for device: le_x2,le_x2_india,le_x2_na,LeMax2_CN,LeMax2_NA,LeMax2_WW,LeMax2; this device is " + getprop("ro.product.device") + "."););

这段代码用于验证system分区下build.prop中的ro.display.series属性的值是不是LeMax2,如果不是就报错。PS:所以记得不要手贱格式化system分区啊

解决方案

这里使用LineageOS 15.1系统包作为示例

一、在电脑上打开系统包,找到META-INF/com/google/android目录下的updater-script文件,单独解压出来.
TIM截图20180827140703.png
二、使用Notepad++来打开updater-script文件,并删除前面所说的验证机型的代码行并保存,如下所示.
原代码:

assert(getprop("ro.product.device") == "le_x2" || getprop("ro.build.product") == "le_x2" || 
   getprop("ro.product.device") == "le_x2_india" || getprop("ro.build.product") == "le_x2_india" || 
   getprop("ro.product.device") == "le_x2_na" || getprop("ro.build.product") == "le_x2_na" || 
   getprop("ro.product.device") == "LeMax2_CN" || getprop("ro.build.product") == "LeMax2_CN" || 
   getprop("ro.product.device") == "LeMax2_NA" || getprop("ro.build.product") == "LeMax2_NA" || 
   getprop("ro.product.device") == "LeMax2_WW" || getprop("ro.build.product") == "LeMax2_WW" || 
   getprop("ro.product.device") == "LeMax2" || getprop("ro.build.product") == "LeMax2" || abort("E3004: This package is for device: le_x2,le_x2_india,le_x2_na,LeMax2_CN,LeMax2_NA,LeMax2_WW,LeMax2; this device is " + getprop("ro.product.device") + "."););
ui_print("Target: LeEco/LeMax2_WW/le_x2:6.0.1/FKXOSOP5801910311S/letv10310125:user/release-keys");
ifelse(is_mounted("/system"), unmount("/system"));
package_extract_dir("install", "/tmp/install");
set_metadata_recursive("/tmp/install", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0644);
set_metadata_recursive("/tmp/install/bin", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0755);
mount("ext4", "EMMC", "/dev/block/bootdevice/by-name/system", "/system", "");
run_program("/tmp/install/bin/backuptool.sh", "backup");
unmount("/system");
show_progress(0.750000, 0);
ui_print("Patching system image unconditionally...");
block_image_update("/dev/block/bootdevice/by-name/system", package_extract_file("system.transfer.list"), "system.new.dat.br", "system.patch.dat") ||
  abort("E1001: Failed to update system image.");
show_progress(0.020000, 10);
mount("ext4", "EMMC", "/dev/block/bootdevice/by-name/system", "/system", "");
run_program("/tmp/install/bin/backuptool.sh", "restore");
unmount("/system");
show_progress(0.050000, 5);
package_extract_file("boot.img", "/dev/block/bootdevice/by-name/boot");
show_progress(0.200000, 10);
set_progress(1.000000);

修改后的代码:

ui_print("Target: LeEco/LeMax2_WW/le_x2:6.0.1/FKXOSOP5801910311S/letv10310125:user/release-keys");
ifelse(is_mounted("/system"), unmount("/system"));
package_extract_dir("install", "/tmp/install");
set_metadata_recursive("/tmp/install", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0644);
set_metadata_recursive("/tmp/install/bin", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0755);
mount("ext4", "EMMC", "/dev/block/bootdevice/by-name/system", "/system", "");
run_program("/tmp/install/bin/backuptool.sh", "backup");
unmount("/system");
show_progress(0.750000, 0);
ui_print("Patching system image unconditionally...");
block_image_update("/dev/block/bootdevice/by-name/system", package_extract_file("system.transfer.list"), "system.new.dat.br", "system.patch.dat") ||
  abort("E1001: Failed to update system image.");
show_progress(0.020000, 10);
mount("ext4", "EMMC", "/dev/block/bootdevice/by-name/system", "/system", "");
run_program("/tmp/install/bin/backuptool.sh", "restore");
unmount("/system");
show_progress(0.050000, 5);
package_extract_file("boot.img", "/dev/block/bootdevice/by-name/boot");
show_progress(0.200000, 10);
set_progress(1.000000);

三、使用WinRAR打开系统包,再找到META-INF/com/google/android/updater-script文件,然后直接把修改后的updater-script拖到里面覆盖即可.(注意覆盖时压缩方式选择存储而不是标准)
TIM截图20180827141122.png
四、完成后再复制到手机进行卡刷即可.(注:整个过程中请不要解压系统包)

End


版权属于:本文为原创文章,版权归 AUK CL 所有。
文章地址: https://aukcl.win/archives/330/
所有原创文章由知识共享署名-非商业性使用 4.0 国际许可协议进行许可。
您可以自由转载或修改,但禁止一切形式的商业使用,同时,务必请注明原文地址及作者信息。

Last modification:September 12th, 2018 at 01:38 am
If you think my article is useful to you, please feel free to appreciate

Leave a Comment

© 2019 Copyright  | 本站已安全运行 | Sitemap