This article has participated in the “Digitalstar Project” and won a creative gift package to challenge the creative incentive money.
preface
Environment construction and other content online information is very much, here no longer repeat.
Pixel 3A and Android 11 are examples of how to compile and burn ROM packages
If you don’t have a real phone, you can make an emulator. At the end of this article, you can download a custom AVD based on Android 11
Compile environment
The official documentation
Download the source code
Tsinghua mirror is recommended here
Download and decompress the monthly update initialization package (you can use tools such as Thunderbolt to download and copy to the server)
Download the driver (optional)
If you want to brush to the real phone, you need to download the driver of the corresponding model, go to the link, and select the Corresponding Android version number and driver of the corresponding model
I chose Android 11.0.0 (RP1A.201105.002)
In Android 8.0.0 (Oreo) and later, each build is identified in the build ID format pvbb.yymmd.bbb [.cn], where:
- P represents the first letter of the platform version code, for example, R represents Android 11.
- V stands for supported industry. By convention, P represents the main platform branch.
- BB is the letter and number code that Google uses to identify the exact branch of code that build belongs to.
- YYMMDD represents the date when the corresponding version was subdivided from or synchronized with the development branch. It is not necessarily the exact build date of a build, as Google often adds subtle changes to existing builds and reuses the same date code in new builds as in existing ones.
- BBB represents different versions with the same date code, starting with 001.
- Cn is an optional alphanumeric that represents a patch built on top of the existing PVbb.yymmdd.bbb build, starting with A1.
Download and unpack the two driver files, and execute
./extract-qcom-sargo.sh
./extract-google_devices-sargo.sh
Copy the code
Press Enter and type I ACCEPT to agree the License
Find the matching branch in the link according to Build, which in this case corresponds to Android-11.0.0_R17
Select branch
After doing this, if we compile directly, we actually compile the master branch, and we need to switch to the branch we want to compile
Repo init -u git://mirrors.ustc.edu.cn/aosp/platform/manifest - b android - 11.0.0 _r17 - the depth = 1 repo sync - j8 repo start Android - 11.0.0 _r17 - allCopy the code
Compile and burn
Execute in the source directory
source build/envsetup.sh
Lunch enters the menu
Select the appropriate version
I chose 19 here
compile
To compile, you can use the make -j command, where j represents the number of compiled jobs
Execute (I specified generating log file here)
make -j32 2>&1 | tee build_20200628_1635.log
After successful compilation, an out directory appears, where the ROM image file is located
For example my path is: ~ / aosp/out/target/product/sargo
burning
The device enters the bootloader and runs the fastboot flashall -w command. -w indicates that data is cleared
Burn successful, boot up!
Create a customized Android Virtual Devices (AVD) system image
Many friends do not have the corresponding real machine, but you can make a customized AVD for use as a simulator.
Lunch selects the appropriate emulator when entering the menu, such as the 24,64 bit universal device shown above
Making AVD system images requires additional SDK and SDK_repo packages
perform
$ make -j32 sdk sdk_repo
Copy the code
Exceptions may occur in this operation, for example
This is caused by not compiling the tools, and the solution is to compile them in turn
Enter the following commands in sequence. The following tools depend on the situation
$ make libaapt2_jni
$ make dmtracedump
$ make etc1tool
$ make deployagent
$ make aapt
$ make split-select
$ make bcc_compat
$ make apksigner
$ make dx
$ make layoutlib-legacy
Copy the code
Make -j32 SDK sdk_repo
Sdk-repo-linux-system-images-eng.[username].zip will be generated in out/host/linux-x86/ SDK/AOSP_x86_64
I didn’t succeed in using mirrors in the official documentation
I’m using a trick here
When creating an AVD in Android Studio, there are generally three different images available. Here we use Android 10 as an example
Google Play, Google APIs, and default
They will be downloaded to SDK/ System-images/Android-29
The directory corresponding to the Google APIs version is Google_apis
We can copy our compiled AVD image to one of these directories
For example, I have placed my custom AVD image here:
We select the custom AVD image when creating the emulator to create our own ROM compiled emulator
Here is the custom AVD compiled by me. If it is not convenient to compile by yourself, you can download it here
Link: pan.baidu.com/s/1LIcuycoU… Extraction code: CAVD
About me
People love to do things that give them positive feedback. If this article is helpful to you, please click 👍. This is very important to me
I am Flywith24. Only through discussion with others can we know whether our own experience is real or not. By communicating with others on wechat, we can make progress together.
- The Denver nuggets
- Small column
- Github
- WeChat: Flywith24
Follow the public account, click on the bottom to contact me -> Knowledge planet to join the free knowledge planet