0. 在Debian bookworm 准备编译环境
apt install git gnupg flex bison build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 libncurses5 libx11-dev libxml2-utils unzip fontconfig
1. 安装repo
apt install repo 或者 curl -o ~/bin/repo https://storage.googleapis.com/git-repo-downloads/repo 检查版本, 2.15版本以上 repo version
3. 查看要构建的 Pixel版本
https://source.android.com/docs/setup/about/build-numbers?hl=zh-cn#source-code-tags-and-builds
SP1A.210812.016.C2 android-12.0.0_r34 Android12 Pixel 3、Pixel 3 XL 2021-10-05
选择 SP1A.210812.016.C2 android-12.0.0_r34
https://developers.google.com/android/drivers#bluelinesp1a.210812.016.c2
https://dl.google.com/dl/android/aosp/google_devices-blueline-sp1a.210812.016.c2-47172864.tgz
https://dl.google.com/dl/android/aosp/qcom-blueline-sp1a.210812.016.c2-7c544085.tgz
4. 下载源代码, 选择 r34
mkdir aaos_on_phone cd aaos_on_phone repo init -u https://android.googlesource.com/platform/manifest -b android-12.0.0_r34 --use-superproject --partial-clone --partial-clone-exclude=platform/frameworks/base --clone-filter=blob:limit=10M repo sync -j8 -c -q
新的 –use-superproject –partial-clone 很有用,只下载有用的部分,会加快下载速度
5.下载并解压缩 专有二进制文件和补丁程序 (供应商映像和 Qualcomm 驱动程序)
curl --output - https://dl.google.com/dl/android/aosp/google_devices-blueline-sp1a.210812.016.c2-47172864.tgz | tar -xzvf - tail -n +315 extract-google_devices-blueline.sh | tar -zxvf - curl --output - https://dl.google.com/dl/android/aosp/qcom-blueline-sp1a.210812.016.c2-7c544085.tgz | tar -xzvf - tail -n +315 extract-qcom-blueline.sh | tar -xzvf -
6. 编译
. build/envsetup.sh lunch aosp_blueline-userdebug m
make -j8
7. 刷入手机
adb reboot bootloader fastboot -w flashall
因为 $ANDROID_PRODUCT_OUT 变量设置为 out/target/product/blueline , 所以可以用上面的命令
编译内核
export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo' repo init --depth 1 -u https://aosp.tuna.tsinghua.edu.cn/kernel/manifest -b android-msm-crosshatch-4.9-android11 repo sync -j20
https://hqw700.github.io/2021/01/02/aosp-kernel-build/
https://hqw700.github.io/2021/01/01/aosp-build/