【Source code compilation】android-9.0.0_r46 for Pixel 2 XL on ubuntu20.04-server

[Source code compilation] android-13.0.0_r7 for Pixel 4 on ubuntu20.04-server
[Source code compilation] android-12.1.0_r11 for Pixel 4 on ubuntu20.04-server
[Source code compilation] android-11.0.0_r46 for Pixel 4 on ubuntu20 .04-server
[source code compilation] android 10.0.0_r2 for Pixel 2 XL on ubuntu20.04-server
[source code compilation] android-9.0.0_r46 for Pixel 2 XL on ubuntu20.04-server
[source code compilation] android-8.0.0_r21 for Pixel 2 XL on ubuntu20.04-server

foreword

Thanks to Kanxue, Jianshu, CSDN and other senior compilation tutorials on various platforms, and thanks to Google for making android compilation easier and easier. In the past, there were basically various problems in compiling, but now it is direct to the end in one step, super smooth

Configuration Environment

  • ubuntu20.04-server (Tsinghua mirror has been switched)
  • 4 core
  • 8G RAM
  • 2T disk
  • physical host
  • Necessary proxy, fast enough, recommended above 20Mb/s
  • A Pixel 2 XL phone
  • configure proxychains

choose branch

Here I choose android-9.0.0_r46, because this is the latest version that supports Pixel 2 XL, and it supports more models: pixel --pixel3.

Note: The branch needs to match the device model, not all branches can be flashed for one model, see the specific matching list: Here

download source code

sudo apt-get update

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

mkdir ~/bin
export PATH=~/bin:$PATH

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

mkdir WORKING_DIRECTORY
cd WORKING_DIRECTORY

git config --global user.name Your Name
git config --global user.email [email protected]

# -b 后面代号选择,访问:https://source.android.com/setup/start/build-numbers#source-code-tags-and-builds
proxychains repo init -u https://android.googlesource.com/platform/manifest -b android-9.0.0_r46

# -j 的数字根据机器性能而定
proxychains repo sync -c -j8

android-9.0.0_r46 requires about 60G traffic, takes about 50 minutes, and the average network speed is 20M/s

Import device driver (optional, needed to flash into real device)

  • Download the corresponding version driver file for Pixel 4, address: PQ3A.190801.002
  • Put the two compressed packages into the source code root directory
  • Execute the decompression commandtar -zxvf xxxxx.tgz
  • Execute the decompressed sh file, usually at 8.e.the end of the line, and at the end will let the input I ACCEPT, do not press Enter too fast, otherwise it will be skipped directly
  • After execution, you can find the vector directory in the root directory of the source code

Configure jdk

Before android-8.1.0_r1, you need to install jdk yourself, and then it comes with the source code, path: prebuilts/jdk, so android-9.0.0_r46 does not need to configure jdk

build source code

cd WORKING_DIRECTORY

sudo apt-get install libncurses5

export _JAVA_OPTIONS="-Xmx4g"

source build/envsetup.sh

lunch aosp_taimen-userdebug

m 

Build time: 2 hours and 33 seconds (how could it be faster? It took more than an afternoon to compile android 8.0 with the same configuration before)

Here, m is executed cyclically, and if an error is reported, it will continue to execute. If there is a repair prompt, follow the prompt, otherwise the default will always be m, as long as the error is not the same every time. However, I didn’t encounter any problems compiling here. I just passed it in one step. It seems that the newer the version, the fewer the problems.

Flash into the mirror

cd WORKING_DIRECTORY/out/target/product/taimen/
fastboot flashall -w

Brush into the image (remote server compilation, local Window) (On Xshell 5)

  • under xshell
cd WORKING_DIRECTORY/out/target/product/taimen/
sz *.txt
sz *.img
  • Under the window
    , switch to the directory downloaded by the sz command, open cmd in this directory, and execute the following command
set ANDROID_PRODUCT_OUT=./
fastboot flashall -w

reference

Guess you like

Origin blog.csdn.net/qq_26914291/article/details/127748976