Pixel 手机升级保留基带和数据

Android Pie On Essential Phone

Andoird Pie (9.0) 早在今年 8 月 6 号就正式发布了,但是一直没有去更新升级自己的 Pixel XL,怕太折腾,刚好中秋在家有空,于是就研究了下如何保留数据与基带通过线刷升级到新系统。

00 为什么要保留基带?

我们知道 Pixel 手机根本就没考虑过国内的电信运营商,因为根本就无法通过正常销售渠道抵达国内的用户,所以呢,显而易见地对国内网络的支持就不是很好。比如中国电信直接就无法使用,需要通过某些手段才能开启电信4G。

Pixel 刚出的时候,你买了 Pixel 之后还需要花一笔钱请人『破解』才能使用,当然,现在有些『破解』手段已经被公布了,比如 『Pixel 破解电信 4G 记录』 以及 『Pixel 开启完美电信4G支持,双清保留』(谨慎尝试,注意先备份数据)。

其实所谓的『破解』只不过是在手机基带的网络通讯模块中加入需要支持的运营商而已。而当我们通过原厂镜像刷机的时候,如果直接刷则会把原来的基带给覆盖掉,导致需要重新『破解』,所以这个时候如果能够在刷机的同时保留基带,那么我们就不需要重新『破解』了。同理,在使用 OTA 更新的时候,如果基带发生了更新,那么我们的『破解』也会失效。

综上,为了避免重新『破解』的麻烦,我们需要在更新时保留基带,当然最好也保留数据。

01 操作步骤

进行如下操作前,请先把手机中的重要数据备份好,否则一切后果自负!

  1. 首先确保你的手机已经解锁,如果没解锁的第一次解锁后数据有可能会丢失!

  2. 把对应你的 Pixel 型号的原厂镜像下载好,下载地址:Factory Images,比如我是 Pixel XL,那么对应的目前最新的系统就是 9.0.0 (PPR2.180905.006, Sep 2018)

  3. 把下载好的 zip 文件解压出来,里面有几个文件,分别是:

  • bootloader*.img: 引导装载程序的镜像,bootloader 主要负责启动安卓内核,同时验证引导程序与还原分区的完整性。
  • radio*.img: 通讯模块的镜像,这就是基带以及其他无线通讯模块的位置。
  • flash-all.sh: 用于一键刷机(Mac/Linux)
  • flash-all.bat: 用于一键刷机(Windows)
  • image*.zip: 系统镜像文件
  1. 在解压后的文件夹中添加 android-info.txt 文件,其中内容为:
1
require board=marlin|sailfish

如果是 Pixel 2 或 Pixel 2 XL,则对应为:

1
require board=walleye|taimen

这一步的目的是替换系统镜像中的 android-info.txt 这样就可以跳过 bootloader 以及 baseband 的版本检测了。

原本的 android-info.txt 是这样的:

1
2
3
4
5
require board=marlin|sailfish

require version-bootloader=8996-012001-1804121206

require version-baseband=8996-130181-1806061856
  1. 修改 flash-all.sh,添加命令,删除系统镜像中的 userdata.img(如果存在的话),以及用我们上一步新建的文件去更新 android-info.txt,这里的 image*.zip 改成你下载的系统镜像名称就好:
1
2
3
# remove userdata.img and update android-info.txt
zip -d image*.zip userdata.img
zip -u image*.zip android-info.txt

注释掉更新基带的命令,同样这里的 radio*.img 是你下载的镜像中的 radio 文件的名称:

1
# fastboot flash radio radio*.img

去掉更新系统时的默认清除数据选项 -w (wipe):

1
fastboot update image*.img

最后,修改后的 flash-all.sh 是这样的(Pixel XL 9.0.0 (PPR2.180905.006, Sep 2018)):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/sh

if ! grep -q dtbo.sig $(which fastboot); then
echo "fastboot too old"
exit 1
fi

# remove userdata.img and update andoir-info.txt
zip -d image-marlin-ppr2.180905.006.zip userdata.img
zip -u image-marlin-ppr2.180905.006.zip android-info.txt

fastboot flash bootloader bootloader-marlin-8996-012001-1804121206.img
fastboot reboot-bootloader
sleep 5
fastboot update image-marlin-ppr2.180905.006.zip
  1. 接下来手机连接电脑,进入 fastboot 模式:
1
adb reboot bootloader
  1. 运行 flash-all.sh:
1
sh flash-all.sh

大致就这么简单了,另外附上脚本输出的日志:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
zip warning: name not matched: userdata.img # 说明我们的系统镜像没有 userdata.img

zip error: Nothing to do! (image-marlin-ppr2.180905.006.zip)
updating: android-info.txt (stored 0%)
Sending 'bootloader_b' (32384 KB) OKAY [ 0.901s]
Writing 'bootloader_b' (bootloader) Valid bootloader version.
(bootloader) Flashing active slot "_b"
(bootloader) Flashing active slot "_b"
OKAY [ 10.058s]
Finished. Total time: 11.069s
rebooting into bootloader OKAY [ 0.009s]
Finished. Total time: 0.010s
extracting android-info.txt (0 MB) to RAM...
--------------------------------------------
Bootloader Version...: 8996-012001-1804121206
Baseband Version.....: 8996-012761-1612201801
Serial Number........: xxxxxxxxxxxx
--------------------------------------------
Checking product OKAY [ 0.050s]
extracting boot.img (30 MB) to disk... took 0.161s
archive does not contain 'boot.sig'
archive does not contain 'boot_other.img'
archive does not contain 'dtbo.img'
archive does not contain 'dt.img'
archive does not contain 'odm.img'
archive does not contain 'product.img'
archive does not contain 'product-services.img'
archive does not contain 'recovery.img'
archive does not contain 'super.img'
extracting system.img (1940 MB) to disk... took 10.183s
archive does not contain 'system.sig'
extracting system_other.img (313 MB) to disk... took 1.830s
archive does not contain 'system.sig'
archive does not contain 'vbmeta.img'
extracting vendor.img (260 MB) to disk... took 1.454s
archive does not contain 'vendor.sig'
archive does not contain 'vendor_other.img'
Sending 'boot_b' (30993 KB) OKAY [ 0.851s]
Writing 'boot_b' OKAY [ 0.661s]
Sending sparse 'system_b' 1/4 (524284 KB) OKAY [ 15.063s]
Writing sparse 'system_b' 1/4 OKAY [ 7.493s]
Sending sparse 'system_b' 2/4 (524284 KB) OKAY [ 14.819s]
Writing sparse 'system_b' 2/4 OKAY [ 6.191s]
Sending sparse 'system_b' 3/4 (524284 KB) OKAY [ 14.819s]
Writing sparse 'system_b' 3/4 OKAY [ 4.490s]
Sending sparse 'system_b' 4/4 (413888 KB) OKAY [ 10.964s]
Writing sparse 'system_b' 4/4 OKAY [ 6.595s]
Sending 'system_a' (321188 KB) OKAY [ 8.458s]
Writing 'system_a' OKAY [ 5.895s]
Sending 'vendor_b' (266504 KB) OKAY [ 7.021s]
Writing 'vendor_b' OKAY [ 4.284s]
Setting current slot to 'b' OKAY [ 0.404s]
Rebooting
Finished. Total time: 125.766s

重启之后,新系统大概需要 4~5 分钟加载,进入系统后等待配置完毕就可以愉快地使用啦!

03 注意事项

刷机之前一点要记得备份数据,重要的话说多少遍都不为过。

按照以上步骤操作,虽然数据和基带可以保留,但是 root 权限还是会丢的(因为系统都被覆盖了嘛!),但是从我个人的使用体验来看,Andoird 9.0 不 root 使用起来体验也非常的棒。看你个人的使用方式了吧,我觉得还是先用一段时间看看再决定要不要 root~ ୧(﹒︠ᴗ﹒︡)୨

祝大家中秋御快,阖家欢落~~蛤蛤\


参考文章:不丢电信破解,线刷最新版谷歌软件的方法