Skip to content

Instantly share code, notes, and snippets.

@h1code2
Last active August 7, 2021 15:49
Show Gist options
  • Save h1code2/67323f57c0b64cfa67d697f84baf7f8c to your computer and use it in GitHub Desktop.
Save h1code2/67323f57c0b64cfa67d697f84baf7f8c to your computer and use it in GitHub Desktop.

Revisions

  1. h1code2 revised this gist Aug 7, 2021. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions note.md
    Original file line number Diff line number Diff line change
    @@ -73,6 +73,8 @@ sudo swapoff /swapfile
    sudo dd if=/dev/zero of=/swapfile bs=1G count=16
    sudo mkswap /swapfile
    sudo swapon /swapfile
    ```


    OPM4.171019.021.P1 android-8.1.0_r38 Oreo Pixel、Pixel XL
    export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4096m"
    export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx9216m"
    ```
  2. h1code2 revised this gist Aug 7, 2021. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion note.md
    Original file line number Diff line number Diff line change
    @@ -74,4 +74,5 @@ sudo dd if=/dev/zero of=/swapfile bs=1G count=16
    sudo mkswap /swapfile
    sudo swapon /swapfile
    ```
    OPM4.171019.021.P1 android-8.1.0_r38 Oreo Pixel、Pixel XL
    OPM4.171019.021.P1 android-8.1.0_r38 Oreo Pixel、Pixel XL
    export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4096m"
  3. h1code2 revised this gist Aug 7, 2021. No changes.
  4. h1code2 revised this gist Aug 4, 2021. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions note.md
    Original file line number Diff line number Diff line change
    @@ -74,5 +74,4 @@ sudo dd if=/dev/zero of=/swapfile bs=1G count=16
    sudo mkswap /swapfile
    sudo swapon /swapfile
    ```

    NZH54D android-7.1.2_r33
    OPM4.171019.021.P1 android-8.1.0_r38 Oreo Pixel、Pixel XL
  5. h1code2 revised this gist Aug 3, 2021. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion note.md
    Original file line number Diff line number Diff line change
    @@ -73,4 +73,6 @@ sudo swapoff /swapfile
    sudo dd if=/dev/zero of=/swapfile bs=1G count=16
    sudo mkswap /swapfile
    sudo swapon /swapfile
    ```
    ```

    NZH54D android-7.1.2_r33
  6. h1code2 revised this gist Aug 2, 2021. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions note.md
    Original file line number Diff line number Diff line change
    @@ -67,3 +67,10 @@ Android 11 上不加硬件库会导致刷机后无限重启,但之前 pixel 1
    ``` shell
    export _JAVA_OPTIONS="-Xmx10g"
    ```
    将 swap 设置为 16G :
    ``` shell
    sudo swapoff /swapfile
    sudo dd if=/dev/zero of=/swapfile bs=1G count=16
    sudo mkswap /swapfile
    sudo swapon /swapfile
    ```
  7. h1code2 revised this gist Aug 2, 2021. 1 changed file with 8 additions and 0 deletions.
    8 changes: 8 additions & 0 deletions note.md
    Original file line number Diff line number Diff line change
    @@ -58,4 +58,12 @@ Android 11 上不加硬件库会导致刷机后无限重启,但之前 pixel 1
    ~/code/android11$ ./extract-google_devices-blueline.sh
    ~/code/android11$ ./extract-qcom-blueline.sh
    ```
    ## 6.开始编译

    编译 Android 系统镜像(Android 10 和 Android 11 ): https://zwc365.com/2020/09/13/ubuntu18-build-android10-11

    使用如下参数设定内存限制:

    ``` shell
    export _JAVA_OPTIONS="-Xmx10g"
    ```
  8. h1code2 revised this gist Aug 2, 2021. No changes.
  9. h1code2 revised this gist Aug 2, 2021. 1 changed file with 58 additions and 1 deletion.
    59 changes: 58 additions & 1 deletion note.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,61 @@
    ## 编译尝试使用 docker 环境
    # Android 11 系统编译采坑

    ## 1.编译尝试使用 docker 环境

    ``` shell
    docker pull ubuntu:18.04
    ```

    ## 2.安装 Repo

    ``` shell
    mkdir ~/bin
    PATH=~/bin:$PATH

    curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
    chmod a+x ~/bin/repo
    ```

    如果想使用旧版 Repo 启动器, 请使用一下命令:

    ``` shell
    curl https://storage.googleapis.com/git-repo-downloads/repo-1 > ~/bin/repo
    chmod a+x ~/bin/repo
    ```

    ## 3.Ubuntu18.04 基本环境配置

    ``` shell
    apt update
    apt install python python3 curl git -y

    sudo apt-get install openjdk-8-jdk
    sudo apt-get install git-core gnupg flex bison build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig
    ```

    ## 4.下载源码:

    将 Google 的地址 https://android.googlesource.com/kernel/manifest 替换清华的地址 https://aosp.tuna.tsinghua.edu.cn/platform/manifest 下载速度更快
    加 --depth 1 控制git深度可以极大节省硬盘空间。最终 .repo 目录 21G 左右

    ``` shell
    git config --global user.email "[email protected]"
    git config --global user.name "h1code2"

    export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo'
    repo init --depth 1 -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-11.0.0_r1
    repo sync -j20
    ```

    ## 5.专有硬件库下载

    Android 11 上不加硬件库会导致刷机后无限重启,但之前 pixel 1 时没有硬件库也能启动,这里踩了一个坑。
    记得匹配好对应的 BUILD_ID 和代码, 查看 build/core/build_id.mk 文件,我的 BUILD_ID=RP1A.200720.009,pixel 3 的代号是 blueline,所以对应的下载地址是:https://developers.google.cn/android/drivers?hl=zh-cn#bluelinerp1a.200720.009, 将两个文件下载到源码根目录,然后执行,会自动生成 vendor 文件

    ``` shell
    ~/code/android11$ tar zxvf google_devices-blueline-rp1a.200720.009-6cd41940.tgz
    ~/code/android11$ tar zxvf qcom-blueline-rp1a.200720.009-f772c38c.tgz
    ~/code/android11$ ./extract-google_devices-blueline.sh
    ~/code/android11$ ./extract-qcom-blueline.sh
    ```

  10. h1code2 created this gist Aug 2, 2021.
    4 changes: 4 additions & 0 deletions note.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    ## 编译尝试使用 docker 环境
    ``` shell
    docker pull ubuntu:18.04
    ```