安卓源碼AOSP下載使用的正確姿勢
20191027更新。
按步驟來,一次過。
本文基於清華源AOSP專欄:https://mirrors.tuna.tsinghua.edu.cn/help/AOSP/
0x01 下載repo
sudo apt-get install repo
不支持以上方式的自行發揮,去tuna上下載現成的repo也行。
0x02 獲取AOSP源碼包
看個人意願,要完整包或者單一分支均可
# 獲取完整AOSP包
wget -c https://mirrors.tuna.tsinghua.edu.cn/aosp-monthly/aosp-latest.tar # 下載完整初始化包
tar xvf aosp-latest.tar #解壓
#獲取單一分支
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-4.0.1_r1 --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/
#其中-b分支代碼可以在這裏查
#https://blog.csdn.net/bt_leo/article/details/78706608
0x03 設置git
設置自己的git郵件和用戶名
git config --global user.name "bryan sun"
git config --global user.email "[email protected]"
0x04 使用AOSP緩存包必須:清理repo緩存
cache總是不靠譜,不清一堆錯,一搜百無解。
僅針對AOSP全項目緩存包操作,單獨同步分支或者repo從零開始同步的不需要做。
cd aosp #tuna下載的完整AOSP包默認該目錄,有變動自行調整
rm -rf .repo/manifest*
cd ..
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest #重新初始化repo
repo sync -j4 #同步,舒暢了
0x05 完事
要編譯要開緩存參考其他文章。