下载官方镜像,下载对应AOSP,编译出的*.img替换到官方镜像对应的文件, 刷入
把证书放到aosp源码的
system/ca-certificates/files
文件夹里,lunch aosp_sailfish-user
编译可以实现无root抓包
mkdir ~/bin
PATH=~/bin:$PATH
curl -sSL 'https://gerrit-googlesource.proxy.ustclug.org/git-repo/+/master/repo?format=TEXT' | base64 -d > ~/bin/repo
mkdir AOSP
cd AOSP
mkdir android-10.0.0_r17
cd android-10.0.0_r17
repo init -u git://mirrors.ustc.edu.cn/aosp/platform/manifest -b android-10.0.0_r17
repo sync
# 下载需数个小时 nohup repo sync > ../log 2>&1 &
查看Android系统版本号、对应BuildID和支持的设备关系
https://source.android.com/docs/setup/about/build-numbers#source-code-tags-and-builds
AOSP官网 https://android.googlesource.com/
清华源:https://mirrors.tuna.tsinghua.edu.cn/git/AOSP
中科大源:https://mirrors.ustc.edu.cn/aosp/
Driver Binaries for Nexus and Pixel
需要添加设备驱动
https://developer.google.com/android/drivers
官方镜像
https://developers.google.com/android/images
也可以查看设备代号,例如Pixel的代号为sailfish
gsi镜像
https://developer.android.com/topic/generic-system-image/releases
ubuntu安装依赖库
sudo apt update
sudo apt install bison tree
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install libc6:i386 libncurses5:i386 libstdc++6:i386 libxml2-utils
需要切换到java1.8
sudo apt install openjdk-8-jdk
sudo update-alternatives --config java
使用bash编译
chsh -s /bin/bash
bash
cd AOSP/android-10.0.0_r17/
source build/envsetup.sh
lunch # 选择Pixel对应的代号sailfish
#(编译user版本的话是 lunch aosp_sailfish-user)
make -j4
# 编译需数个小时 nohup make -j4 > ../log 2>&1 &
# 下载原官方镜像,替换img
unzip image-sailfish-qp1a.190711.020.zip
#
# 讲解压得到的img文件都替换成编译出来的img文件
#
# 重新压缩
zip image-sailfish-qp1a.190711.020.zip android-info.txt boot.img system.img system_other.img vendor.img
rm android-info.txt boot.img system.img system_other.img vendor.img
# 刷入
./flash-all.sh
我第一个编译的系统
官方编译GSI步骤
https://source.android.com/docs/setup/create/gsi#building-gsis
查看手机是否Treblized
支持Treblized才能刷GSI
https://play.google.com/store/apps/details?id=com.kevintresuelo.treble&hl=en&gl=US
将编译的GSI刷入
把编译出来的system.img刷入,详看教程
https://www.thecustomdroid.com/install-generic-system-image-on-project-treble-devices/
OEM解锁、关锁
fastboot oem lock
fastboot oem unlock