Build AOSP: Pixel 5 (redfin) with Android 13 Environment
PC
CPU: i7-12700 (8 P-core + 4 E-core)
RAM: 32 GB
Disk: 1 TB SSD
OS: Ubuntu LTS 22.04 with required packages
Software
Phone
Download AOSP source code Follow official tutorial and choose a tag .
I choose tag android-13.0.0_r67 for my Pixel 5, and the correspoding build ID is TQ3A.230805.001
Image Not Showing
Possible Reasons
The image was uploaded to a note which you don't have access to The note which the image was originally uploaded to has been deleted
Learn More β
Create a folder for AOSP source code
mkdir ~/aosp && cd ~/aosp
Init with tag android-13.0.0_r67
repo init -u https://android.googlesource.com/platform/manifest -b android-13.0.0_r67
Sync
Download driver binaries
Download driver binaries according to the AOSP source code build ID and tag. I download binaries with build ID TQ3A.230805.001 for my Pixel 5 according to the tag android-13.0.0_r67 .
Image Not Showing
Possible Reasons
The image was uploaded to a note which you don't have access to The note which the image was originally uploaded to has been deleted
Learn More β
wget https://dl.google.com/dl/android/aosp/google_devices-redfin-tq3a.230805.001.a2-59031497.tgz
wget https://dl.google.com/dl/android/aosp/qcom-redfin-tq3a.230805.001.a2-94c5e420.tgz
Unzip to your AOSP source code folder
tar xvfz google_devices-redfin-tq3a.230805.001.a2-59031497.tgz
tar xvfz qcom-redfin-tq3a.230805.001.a2-94c5e420.tgz
Run script
source extract-google_devices-redfin.sh
source extract-qcom-redfin.sh
Build AOSP Follow official tutorial
Setup
Choose a target to lunch. I choose aosp_redfin-userdebug for my Pixel 5.
Image Not Showing
Possible Reasons
The image was uploaded to a note which you don't have access to The note which the image was originally uploaded to has been deleted
Learn More β
lunch aosp_redfin-userdebug
Enable compile_commands.json , which let you efficiently trace C/C++ code with VS code installed with clangd extension
export SOONG_GEN_COMPDB=1
export SOONG_GEN_COMPDB_DEBUG=1
Build all images
m -j8 2>&1 | tee build_aosp_redfin_userdebug.log
Unlock phone Follow official tutorail
Enable OEM unlocking and USB debugging in Developer options
Image Not Showing
Possible Reasons
The image was uploaded to a note which you don't have access to The note which the image was originally uploaded to has been deleted
Learn More β
Reboot to bootloader
Image Not Showing
Possible Reasons
The image was uploaded to a note which you don't have access to The note which the image was originally uploaded to has been deleted
Learn More β
Unlock
Image Not Showing
Possible Reasons
The image was uploaded to a note which you don't have access to The note which the image was originally uploaded to has been deleted
Learn More β
Flash (Note: fastboot will flash img in $ANDROID_PRODUCT_OUT folder to your phone)
Boot to Android homescreen
Image Not Showing
Possible Reasons
The image was uploaded to a note which you don't have access to The note which the image was originally uploaded to has been deleted
Learn More β
Troubleshooting If your Pixel phone is bricked, using physical button to force reboot your phone to bootloader, and flash factory img with official tool .
Reference
https://c55jeremy-tech.blogspot.com/2019/04/aosppixel-2-romrom.html
https://zhuanlan.zhihu.com/p/574856795
https://source.android.com/docs/automotive/start/pixelxl
Bluetooth Repository packages/modules/Bluetooth/
Develope flow
Modify code
Build Bluetooth package and dependency
mmma packages/modules/Bluetooth/ -j8 2>&1 | tee build_bt.log
According to TEST_MAPPING file , use Atest to run instrumentation test , unit test or GTest
atest BluetoothInstrumentationTests -v 2>&1 | tee BluetoothInstrumentationTests.log
atest bluetooth_le_audio_client_test -v 2>&1 | tee bluetooth_le_audio_client_test.log
Manual test: replace Bluetooth apex and manually verify your change
adb root
adb remount
adb install out/target/product/redfin/system/apex/com.android.btservices.apex
adb reboot
Submit patches
Develop & Debug skill
export SOONG_GEN_COMPDB=1
export SOONG_GEN_COMPDB_DEBUG=1
Get read/write permission
adb shell getprop bluetooth.profile.bap.unicast.client.enabled
adb shell setprop bluetooth.profile.bap.unicast.client.enabled true
adb logcat -c
adb logcat > "Phone_log_$(date +"%F_%T").log"