download aosp source codes

安裝Git

下載repo

mkdir ~/bin
PATH=~/bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo

下載源碼

使用鏡像下載

由于所有代碼都是從隱藏的 .repo 目錄中 checkout 出來的,所以我們只保留了 .repo 目錄,下載后解壓 再 repo sync 一遍即可得到完整的目錄。

使用方法如下:

wget -c https://mirrors.tuna.tsinghua.edu.cn/aosp-monthly/aosp-latest.tar # 下載初始化包
tar xf aosp-latest.tar
cd AOSP   # 解壓得到的 AOSP 工程目錄
# 這時 ls 的話什么也看不到,因為只有一個隱藏的 .repo 目錄
repo sync # 正常同步一遍即可得到完整目錄
# 或 repo sync -l 僅checkout代碼

傳統(tǒng)下載方式

創(chuàng)建源碼目錄

mkdir Android11-r22
cd Android11-r22
repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b android-11.0.0_r22
repo sync -c

如何選擇分支:https://source.android.com/setup/start/build-numbers#source-code-tags-and-builds

因為google網(wǎng)站無法正常訪問,需更改源為清華的
修改:.repo/manifests.git/config

url = https://android.googlesource.com/platform/manifest
改為
url = https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest
或者修改git config
git config --global url.https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/.insteadof https://android.googlesource.com

?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內容

友情鏈接更多精彩內容