[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
content index
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 4 phone
- configure proxychains
choose branch
Here I choose android-11.0.0_r46, because this is the latest version that supports Pixel 4, and it supports more models: pixel3 --pixel5.
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-11.0.0_r46
# -j 的数字根据机器性能而定
proxychains repo sync -c -j8
android-11.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: RQ3A.211001.001
- Put the two compressed packages into the source code root directory
- Execute the decompression command
tar -zxvf xxxxx.tgz
- Execute the decompressed sh file, usually at
8.e.
the end of the line, and at the end will let the inputI 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-11.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_flame-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/flame/
fastboot flashall -w
Brush into the image (remote server compilation, local Window) (On Xshell 5)
- under xshell
cd WORKING_DIRECTORY/out/target/product/flame/
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
- https://source.android.com/setup/develop
- Download and compile Android source code (Google)
- Android10 source code customization (1) Make a complete root version
- Generation and replacement of AOSP system signature
- https://source.android.com/devices/tech/ota/sign_builds
- https://source.android.com/devices/bootloader/locking_unlocking?hl=zh-cn
- Android 7.1 modifies the default sleep time
- aosp change default language, time zone issue
- SELinux policy file
- Build the Pixel2 core
- Print the Android kernel debugging log information in real time through the serial port
- How does adb print the kernel output log
- Chapter 3 Kernel Printing of Kernel Debugging Methods
- http://www.juneleo.cn/47a3736f9762/
- [run_soong_ui] Error 1
- Source Code Compilation (1) - Detailed Explanation of Android6.0 Source Code Compilation