Build and Flash AOSP 9 for Pixel XL (marlin)
前言
最近在打安卓隐私相关的工,所以需要编译一个 AOSP. 之前高中的时候觉得新奇而买的 Pixel XL 就派上了用处。
下载 AOSP 源码
因为 AOSP 源码极大,所以使用 USTC 的镜像源来加速
基本上和 初始同步方法 2 一样。要注意的是,其依旧会向 Google 请求数据,所以需要接入互联网。
这里采用的版本是 PQ3A.190801.002 | android-9.0.0_r46 | Pie | Pixel 3 XL, Pixel 3, Pixel 2 XL, Pixel 2, Pixel XL, Pixel | 2019-08-01
$ mkdir -p AOSP
$ cd AOSP
$ repo init -u git://mirrors.ustc.edu.cn/aosp/platform/manifest -b android-9.0.0_r46
$ repo sync --jobs=10
下载 Driver
打开 [Pixel XL binaries for Android 9.0.0 (PQ3A.190801.002)(https://developers.google.cn/android/drivers#marlinpq3a.190801.002) 下载并解压到 AOSP 源码的根目录并运行
~/AOSP$ wget https://dl.google.com/dl/android/aosp/google_devices-marlin-pq3a.190801.002-9ce9ce62.tgz
~/AOSP$ tar -xzvf ./google_devices-marlin-pq3a.190801.002-9ce9ce62.tgz
~/AOSP$ ./extract-google_devices-marlin.sh
# Press q and Enter I ACCEPT to continue
# vendor/
# vendor/google_devices/
# vendor/google_devices/marlin/
# vendor/google_devices/marlin/device-vendor-marlin.mk
# vendor/google_devices/marlin/BoardConfigPartial.mk
# vendor/google_devices/marlin/device-partial.mk
# vendor/google_devices/marlin/proprietary/
# vendor/google_devices/marlin/proprietary/vendor.img
# vendor/google_devices/marlin/android-info.txt
# vendor/google_devices/marlin/BoardConfigVendor.mk
~/AOSP$ wget https://dl.google.com/dl/android/aosp/qcom-marlin-qp1a.190711.019-4394281d.tgz
~/AOSP$ tar -xzvf ./qcom-marlin-qp1a.190711.019-4394281d.tgz
~/AOSP$ ./extract-qcom-marlin.sh
# Type "I ACCEPT" if you agree to the terms of the license: I ACCEPT
# vendor/
# vendor/qcom/
# vendor/qcom/marlin/
# vendor/qcom/marlin/BoardConfigPartial.mk
# vendor/qcom/marlin/device-partial.mk
# vendor/qcom/marlin/proprietary/
# vendor/qcom/marlin/proprietary/lib64/
# vendor/qcom/marlin/proprietary/lib64/vendor.qti.qcril.am@1.0.so
# vendor/qcom/marlin/proprietary/lib64/vendor.qti.atcmdfwd@1.0.so
# vendor/qcom/marlin/proprietary/qcrilhook.jar
# vendor/qcom/marlin/proprietary/VZW_profiles.xml
# vendor/qcom/marlin/proprietary/ROW_profiles.xml
# vendor/qcom/marlin/proprietary/ATT_profiles.xml
# vendor/qcom/marlin/proprietary/pktlogconf
# vendor/google_devices/
# vendor/google_devices/marlin/
# vendor/google_devices/marlin/device-vendor-marlin.mk
# vendor/google_devices/marlin/android-info.txt
# vendor/google_devices/marlin/BoardConfigVendor.mk
开始编译
$ source build/envsetup.sh
$ lunch
45
# 45. aosp_marlin-userdebug
# ============================================
# PLATFORM_VERSION_CODENAME=REL
# PLATFORM_VERSION=9
# TARGET_PRODUCT=aosp_marlin
# TARGET_BUILD_VARIANT=userdebug
# TARGET_BUILD_TYPE=release
# TARGET_ARCH=arm64
# TARGET_ARCH_VARIANT=armv8-a
# TARGET_CPU_VARIANT=kryo
# TARGET_2ND_ARCH=arm
# TARGET_2ND_ARCH_VARIANT=armv8-a
# TARGET_2ND_CPU_VARIANT=kryo
# HOST_ARCH=x86_64
# HOST_2ND_ARCH=x86
# HOST_OS=linux
# HOST_OS_EXTRA=Linux-5.4.148-x86_64-Ubuntu-20.04.4-LTS
# HOST_CROSS_OS=windows
# HOST_CROSS_ARCH=x86
# HOST_CROSS_2ND_ARCH=x86_64
# HOST_BUILD_TYPE=release
# BUILD_ID=PQ3A.190801.002
# OUT_DIR=out
# ============================================
$ make -j $(nproc)
#### build completed successfully (10:07 (mm:ss)) ####
编译成功之后,打包 img 文件
$ cd out/target/product/marlin # 这是输出文件夹
$ tar -zcvf malin-9.tar.gz .
压缩的话不一定需要压缩这么多东西, tar -zcvf malin-9.tar.gz ./*.img
再加一些必要文件可能就可以了。实测下来压缩时间非常长,如果硬要全部打包可以用 pigz
.
在 Windows 下刷机
用 choco install adb
或者其它方式安装 android debug tools
- 重启至
fastboot
- 解压
malin-9.tar.gz
$Env:ANDROID_PRODUCT_OUT = "C:\Users\Nyove\Desktop"
fastboot flashall -w