https://blog.csdn.net/zhaohad/article/details/117749815
前提
如果是虛擬機編譯沽一,要保證分配至少2核CPU族沃,內(nèi)存分配16G以上,交換分區(qū)至少4G伶选。
https://blog.csdn.net/weixin_43946245/article/details/104921648
0. 解鎖bootloader
https://source.android.com/setup/build/running#unlocking-the-bootloader
1. 驅(qū)動決定選擇源碼分支
https://developers.google.com/android/drivers
先找對應的最新驅(qū)動:
根據(jù)驅(qū)動找到分支:
https://source.android.com/docs/setup/about/build-numbers?hl=zh-cn#source-code-tags-and-builds
2. 下載代碼
repo init -u https://android.googlesource.com/platform/manifest -b android-12.0.0_r16
repo sync
3. 把驅(qū)動放進源碼內(nèi)開始編譯
extract-google_devices-flame.sh和extract-qcom-flame.sh寡喝,放到AOSP源碼根目錄,然后執(zhí)行這兩個sh文件,
extract-google_devices-flame.sh
extract-qcom-flame.sh
執(zhí)行完畢之后會多出幾個文件,然后開始編譯
source build/envsetup.sh
lunch aosp_flame-userdebug
make -j4
4. 進入out目錄進行刷機
fastboot flashall -w
1:找到最新ROM版本
https://developers.google.com/android/images
最新版本如下:
11.0.0 (RQ3A.210805.001.A1, Aug 2021)
格式如下:
Android版本號(build ID,時間)
2:根據(jù)build ID找到AOSP分支源碼
https://github.com/AOSPAlliance/vendor_google_devices/blob/android11/config.json
https://source.android.com/setup/start/build-numbers#source-code-tags-and-builds
可以看到宠哄,RQ3A.210805.001.A1對應的分支是:android-11.0.0_r40
3:下載對應AOSP代碼
https://source.android.com/setup/build/downloading
repo init -u https://android.googlesource.com/platform/manifest -b android-11.0.0_r40
repo sync
4:下載驅(qū)動,放到AOSP跟目錄
https://developers.google.com/android/drivers
5:開始編譯代碼
https://source.android.com/setup/build/running#selecting-device-build
source build/envsetup.sh
lunch aosp_flame-userdebug
make -j4