之前刷机时,总是会冒出错误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分区啊

2020/6/30更新

前几天从LineageOS官网下载了最新的LineageOS 17.1 ROM包,发现老方法不起作用了
后来发现是因为我用的TWRP 3.0.2-0 奇兔第三方中文Recovery 这个版本太老了,不支持Android10,随后到TWRP官网下载最新版刷入后解决
但随之而来的新问题就是LineageOS团队在17.1版本开始放弃了自己的root管理方案,以及不知为何无法刷入GAPPS包,root的替代方案是Magisk,但我还没找到解决GAPPS包的方法,有知道的同学可以留言交流一下

解决方案

这里使用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);
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:June 30th, 2020 at 10:13 pm
If you think my article is useful to you, please feel free to appreciate