安卓原始碼(二)檢視安卓原始碼分支列表
阿新 • • 發佈:2019-01-30
這裡再講一遍環境安裝:
系統deepin 15.4rc
1、安裝軟體
sudo su
apt-get install openjdk-8-jdk
apt-get install curl
apt-get install git
git config --global user.email "你的郵箱(隨便一個郵箱就行了)"
git config --global user.name "你的名字"
2、下載repo與manifests
下載repo
mkdir ~/bin
PATH=~/bin:$PATH
curl https://mirrors.tuna .tsinghua.edu.cn/git/git-repo > ~/bin/repo
chmod a+x ~/bin/repo
nano ~/bin/repo
修改為國內源
將REPO_URL = 'https://gerrit.googlesource.com/git-repo'改為
REPO_URL = 'https://gerrit-google.tuna.tsinghua.edu.cn/git-repo'
新增環境變數
sudo su
echo export PATH="$PATH:/home/你的使用者名稱/bin" >> /etc/profile
source /etc/profile
exit
下載manifests
新建一個資料夾放,下載完使用 ls -al檢視到一個.repo的隱藏資料夾就說明下載完成了
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest
替換已有的 AOSP 原始碼的 remote
如果你之前已經通過某種途徑獲得了 AOSP 的原始碼(或者你只是 init 這一步完成後),
你希望以後通過 TUNA 同步 AOSP 部分的程式碼,只需要將 .repo/manifest.xml 把其中的
https://aosp.tuna.tsinghua.edu.cn/。
<manifest>
<remote name="aosp"
- fetch="https://android.googlesource.com"
+ fetch="https://aosp.tuna.tsinghua.edu.cn"
review="android-review.googlesource.com" />
<remote name="github"
同時,修改 .repo/manifests.git/config,將
url = https://android.googlesource.com/platform/manifest
更改為
url = https://aosp.tuna.tsinghua.edu.cn/platform/manifest
這個方法也可以用來在同步 Cyanogenmod 程式碼的時候從 TUNA 同步部分程式碼
3、檢視最新安卓分支列表
cd .repo/manifests/
git branch -a
列出的就是全部的安卓原始碼分支列表了
4、下載安卓特定分支原始碼
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-cts-7.1_r4
5同步原始碼樹
repo sync