编译Android AOSP(android-14.0.0_r28)源码

227 阅读1分钟

1、配置环境,国内以清华大学镜像为例,分支以android-14.0.0_r28为例:

git config --global user.email “xxx.com"

git config --global user.name “yyy"

mkdir -p ~/bin

curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo -o ~/bin/repo

chmod +x ~/bin/repo

export PATH=~/bin:$PATH

export REPO_URL=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo

sudo apt-get update

repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b android-14.0.0_r28

repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-14.0.0_r28 //备用

repo sync -c -j4

sudo apt-get install openjdk-11-jdk

2、aosp源码编译流程,以设备redfin为例

make clean//需要时才执行
source build/envsetup.sh

lunch aosp_redfin-userdebug

make -j$(nproc) 

3、烧录

scp -r uuu@xxx.yyy.zzz.nnn:/home/xxx/  /user/xxx
export ANDROID_PRODUCT_OUT=/Users/xxx/
adb reboot bootloader
fastboot flashall -w

注意:

1、下载源码前做好AOSP分支选择与支持的设备,参考如下 source.android.com/docs/setup/…

2、如果使用Google设备,vendor源码需下载到AOSP根目录,解压,编译。