pixel3 aosp编译

以下内容主要参考网络内容,按照实际验证的顺序和细节补充而成,使流程更清晰,可以傻瓜式照抄。

  1. 根据自己手机刷机前的版本信息,在 https://source.android.com/docs/setup/about/build-numbers?hl=zh-cn#source-code-tags-and-builds 获取版本SP1A.210812.016.A1
    file
    后面repo init时,我们将要用这个版本号,获取准确的版本。

    repo init -u https://android.googlesource.com/platform/manifest -b android-12.0.0_r3
  2. 获取vendor驱动,从 https://developers.google.com/android/drivers?hl=zh-cn 中找到对应版本 https://link.zhihu.com/?target=https%3A//developers.google.com/android/drivers/%23crosshatchsp1a.210812.016.a1, 这个待会编译时,要解压到vendor下

  3. 安装git, repo:https://mirrors.tuna.tsinghua.edu.cn/help/git-repo/

  4. 运行 repo init,这里考虑到网速的问题,我们使用清华的镜像地址。如果你没有网络困扰,也可以使用上面提到的google android官方地址:

    mkdir ~/work/aosp/
    cd ~/work/aosp/
    repo init -u
    https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b android-12.0.0_r3
  5. repo sync -jxx , xx为你的虚拟软核数

  6. 更新vendor和驱动:

    cd ~/Downloads
    tar xvf qcom-crosshatch-*.tgz
    tar xvf google_devices-crosshatch-*.tgz
    cd ~/work/aosp/
    ~/Downloads/extract-qcom-crosshatch.sh
    ~/Downloads/extract-google_devices-crosshatch.sh
  7. 编译

    source build/envsetup.sh
    lunch 4(aosp_blueline-userdebug)
    m

    m 是构建代码的简单命令

  8. 安装adb kit,安装adb 和fastboot工具集,作者用的是Version 31.0.3-7562133 版本。

  9. 烧录下载

    adb reboot bootloader
    fastboot flashall -w

    flashall 会提示设置ANDROID_PRODUCT_OUT环境变量,设置成实际的out编译目录就好(如果是在windows烧录,就把整个目录下载到windows,然后设置成windows实际的out路径)。
    linux: export ANDROID_PRODUCT_OUT=/xxx/out/target/product/blueline
    windows: set ANDROID_PRODUCT_OUT=/xxx/out/target/product/blueline

  10. 构建内核(可选),可以参考https://zhuanlan.zhihu.com/p/448289040 的后半部分内容。

最后,如果你不想麻烦,也可以取用我们编译好的原生版本:
https://cdn.itranscloud.com/aosp/aosp_blueline-userdebug_12_SP1A.210812.016.A1.7z

ref:https://zhuanlan.zhihu.com/p/448289040

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注