一、Git安裝
這個就不多說了!!!
二、repo
1、repo
repo是google結合git管理aosp項目的工具,aosp(Android Open Source Project),Android開源項目
2、安裝
a、用戶目錄下創建bin文件夾:mkdir ~/bin
b、將bin目錄配置到.bash_profile: export PATH = ~/bin:$PATH
c、下載repo并配置權限
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
三、源碼下載
1、方式一
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代碼
此后,每次只需運行 repo sync 即可保持同步。
2、方式二
mkdir WORKING_DIRECTORY #建立工作目錄
cd WORKING_DIRECTORY
repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest #初始化倉庫
#或指定版本 repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b android-6.0.1_r1
repo sync #同步源碼樹(以后只需執行這條命令來同步)