Android11 刷机教程

目录

  • 0x0 背景
  • 0x1 下载刷机包
  • 0x2 安装
    • 0x20 刷机包文件解析
    • 0x21 进入fasterboot模式
    • 0x22 刷机

0x0 背景

需要使用Piexl 3a手机刷Android 11系统。

0x1 下载刷机包

先访问Google的官方刷机包下载地址:https://developer.android.google.cn/preview/download
选择对应机型的刷机包:
Android11 刷机教程_第1张图片

0x2 安装

0x20 刷机包文件解析

解压刷机包,得到如下的文件:
Android11 刷机教程_第2张图片
核心文件:

  1. bootloader-sargo-b4s4-0.3-6622442.img :引导程序
  2. radio-sargo-g670-00067-200702-b-6648702.img:射频相关程序
  3. image-sargo-rpb3.200720.005.zip:刷机包镜像相关程序

脚本:

  1. flash-all.bat
@ECHO OFF
:: Copyright 2012 The Android Open Source Project
::
:: Licensed under the Apache License, Version 2.0 (the "License");
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
::      http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.

PATH=%PATH%;"%SYSTEMROOT%\System32"
fastboot flash bootloader bootloader-sargo-b4s4-0.3-6622442.img
fastboot reboot-bootloader
ping -n 5 127.0.0.1 >nul
fastboot flash radio radio-sargo-g670-00067-200702-b-6648702.img
fastboot reboot-bootloader
ping -n 5 127.0.0.1 >nul
fastboot -w update image-sargo-rpb3.200720.005.zip

echo Press any key to exit...
pause >nul
exit

实际可以看成3个部分:

1. fastboot flash bootloader bootloader-sargo-b4s4-0.3-6622442.img
2. fastboot flash radio radio-sargo-g670-00067-200702-b-6648702.img
3. fastboot -w update image-sargo-rpb3.200720.005.zip

.bat脚本方便windows平台下使用,但是需要安装adb工具。双击这个.bat文件就能运行。

  1. flash-all.sh
    该部分内容和上面的flash-all.bat相识,只不过使用shell脚本写了一遍
    在Linux下使用该脚本的方式:
chmod a+x flash-all.sh #先给shell脚本文件可执行权限
bash flash-all.sh # 触发shell脚本运行

内容如下:

#!/bin/sh

# Copyright 2012 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

if ! [ $($(which fastboot) --version | grep "version" | cut -c18-23 | sed 's/\.//g' ) -ge 2802 ]; then
  echo "fastboot too old; please download the latest version at https://developer.android.com/studio/releases/platform-tools.html"
  exit 1
fi
fastboot flash bootloader bootloader-sargo-b4s4-0.3-6622442.img
fastboot reboot-bootloader
sleep 5
fastboot flash radio radio-sargo-g670-00067-200702-b-6648702.img
fastboot reboot-bootloader
sleep 5
fastboot -w update image-sargo-rpb3.200720.005.zip
  1. flash-base.sh
    该文件比flash-all.sh就少了下面这一句。
fastboot -w update image-sargo-rpb3.200720.005.zip

flash-base.sh内容如下:

#!/bin/sh

# Copyright 2012 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

if ! [ $($(which fastboot) --version | grep "version" | cut -c18-23 | sed 's/\.//g' ) -ge 2802 ]; then
  echo "fastboot too old; please download the latest version at https://developer.android.com/studio/releases/platform-tools.html"
  exit 1
fi
fastboot flash bootloader bootloader-sargo-b4s4-0.3-6622442.img
fastboot reboot-bootloader
sleep 5
fastboot flash radio radio-sargo-g670-00067-200702-b-6648702.img
fastboot reboot-bootloader
sleep 5

0x21 进入fasterboot模式

开机状态下长按“电源键 + 音量下键” 10s左右。
Android11 刷机教程_第3张图片
补充:如果机器是locked状态,需要先解锁
fastboot flashing unlock

0x22 刷机

Windows:
双击flash-all.bat文件即可

Linux:

chmod a+x flash-all.sh #先给shell脚本文件可执行权限
bash flash-all.sh # 触发shell脚本运行

这个过程会有一点慢,不用点击任何手机上任何键,等着就好,下面是安装过程中的命令行的输出:

➜  sargo-rpb3.200720.005 bash flash-all.sh
Sending 'bootloader_a' (8369 KB)                   OKAY [  0.370s]
Writing 'bootloader_a'                             (bootloader) Flashing Pack version b4s4-0.3-6622442
(bootloader) Flashing partition table for Lun = 0
(bootloader) Flashing partition xbl_a
(bootloader) Flashing partition xbl_config_a
(bootloader) Flashing partition tz_a
(bootloader) Flashing partition aop_a
(bootloader) Flashing partition hyp_a
(bootloader) Flashing partition keymaster_a
(bootloader) Flashing partition cmnlib_a
(bootloader) Flashing partition cmnlib64_a
(bootloader) Flashing partition abl_a
(bootloader) Flashing partition devcfg_a
(bootloader) Flashing partition qupfw_a
(bootloader) Flashing partition storsec_a
OKAY [  0.308s]
Finished. Total time: 0.883s
Rebooting into bootloader                          OKAY [  0.051s]
Finished. Total time: 0.151s
Sending 'radio_a' (73340 KB)                       OKAY [  2.470s]
Writing 'radio_a'                                  (bootloader) Flashing Pack version SSD:g670-00067-200702-B-6648702
(bootloader) Flashing partition modem_a
OKAY [  0.578s]
Finished. Total time: 3.248s
Rebooting into bootloader                          OKAY [  0.051s]
Finished. Total time: 0.201s
--------------------------------------------
Bootloader Version...: b4s4-0.3-6622442
Baseband Version.....: g670-00067-200702-B-6648702
Serial Number........: 97GAY10NQN
--------------------------------------------
extracting android-info.txt (0 MB) to RAM...
Checking 'product'                                 OKAY [  0.060s]
Checking 'version-bootloader'                      OKAY [  0.060s]
Checking 'version-baseband'                        OKAY [  0.060s]
Setting current slot to 'a'                        OKAY [  0.066s]
extracting boot.img (64 MB) to disk... took 0.202s
archive does not contain 'boot.sig'
Sending 'boot_a' (65536 KB)                        OKAY [  2.210s]
Writing 'boot_a'                                   OKAY [  0.424s]
extracting dtbo.img (8 MB) to disk... took 0.017s
archive does not contain 'dtbo.sig'
Sending 'dtbo_a' (8192 KB)                         OKAY [  0.360s]
Writing 'dtbo_a'                                   OKAY [  0.125s]
archive does not contain 'dt.img'
archive does not contain 'recovery.img'
extracting vbmeta.img (0 MB) to disk... took 0.000s
archive does not contain 'vbmeta.sig'
Sending 'vbmeta_a' (4 KB)                          OKAY [  0.120s]
Writing 'vbmeta_a'                                 OKAY [  0.068s]
archive does not contain 'vbmeta_system.img'
archive does not contain 'vendor_boot.img'
extracting super_empty.img (0 MB) to disk... took 0.000s
Rebooting into fastboot                            OKAY [  0.060s]
< waiting for any device >
Sending 'system_a' (4 KB)                          OKAY [  0.001s]
Updating super partition                           OKAY [  0.006s]
Resizing 'product_a'                               OKAY [  0.005s]
Resizing 'system_a'                                OKAY [  0.004s]
Resizing 'system_ext_a'                            OKAY [  0.004s]
Resizing 'vendor_a'                                OKAY [  0.004s]
archive does not contain 'boot_other.img'
archive does not contain 'odm.img'
extracting product.img (1697 MB) to disk... took 6.635s
archive does not contain 'product.sig'
Resizing 'product_a'                               OKAY [  0.005s]
Sending sparse 'product_a' 1/7 (262140 KB)         OKAY [  8.542s]
Writing 'product_a'                                OKAY [  2.831s]
Sending sparse 'product_a' 2/7 (262140 KB)         OKAY [  8.556s]
Writing 'product_a'                                OKAY [  1.798s]
Sending sparse 'product_a' 3/7 (262140 KB)         OKAY [  8.543s]
Writing 'product_a'                                OKAY [  1.814s]
Sending sparse 'product_a' 4/7 (262140 KB)         OKAY [  8.527s]
Writing 'product_a'                                OKAY [  1.817s]
Sending sparse 'product_a' 5/7 (262140 KB)         OKAY [  8.557s]
Writing 'product_a'                                OKAY [  1.784s]
Sending sparse 'product_a' 6/7 (262140 KB)         OKAY [  8.546s]
Writing 'product_a'                                OKAY [  1.808s]
Sending sparse 'product_a' 7/7 (165268 KB)         OKAY [  5.393s]
Writing 'product_a'                                OKAY [  1.204s]
extracting system.img (785 MB) to disk... took 3.159s
archive does not contain 'system.sig'
Resizing 'system_a'                                OKAY [  0.005s]
Sending sparse 'system_a' 1/4 (262140 KB)          OKAY [  8.542s]
Writing 'system_a'                                 OKAY [  2.817s]
Sending sparse 'system_a' 2/4 (262140 KB)          OKAY [  8.533s]
Writing 'system_a'                                 OKAY [  1.811s]
Sending sparse 'system_a' 3/4 (262140 KB)          OKAY [  8.507s]
Writing 'system_a'                                 OKAY [  1.817s]
Sending sparse 'system_a' 4/4 (18120 KB)           OKAY [  0.592s]
Writing 'system_a'                                 OKAY [  0.168s]
extracting system_ext.img (181 MB) to disk... took 0.645s
archive does not contain 'system_ext.sig'
Resizing 'system_ext_a'                            OKAY [  0.005s]
Sending 'system_ext_a' (186144 KB)                 OKAY [  6.002s]
Writing 'system_ext_a'                             OKAY [  2.317s]
extracting system_other.img (72 MB) to disk... took 0.242s
archive does not contain 'system.sig'
Sending 'system_b' (74668 KB)                      OKAY [  2.391s]
Writing 'system_b'                                 OKAY [  0.511s]
extracting vendor.img (452 MB) to disk... took 1.819s
archive does not contain 'vendor.sig'
Resizing 'vendor_a'                                OKAY [  0.005s]
Sending sparse 'vendor_a' 1/2 (262140 KB)          OKAY [  8.513s]
Writing 'vendor_a'                                 OKAY [  2.843s]
Sending sparse 'vendor_a' 2/2 (201016 KB)          OKAY [  6.546s]
Writing 'vendor_a'                                 OKAY [  1.415s]
archive does not contain 'vendor_other.img'
Erasing 'userdata'                                 OKAY [  0.093s]
Erase successful, but not automatically formatting.
File system type raw not supported.
Erasing 'metadata'                                 OKAY [  0.006s]
Erase successful, but not automatically formatting.
File system type raw not supported.
Rebooting                                          OKAY [  0.000s]
Finished. Total time: 167.524s

然后就能看到首次启动的设置界面了,恭喜你可以体验Android11 了。

如果对你有帮助点点关注,支持一下作者吧。

你可能感兴趣的:(android,android,linux)