1.安装git
sudo apt-get upgrade
sudo apt-get install git
git config –global user.email “xxxxxxx@gmail.com”
git config –global user.name “xxxxx”
2.安装repo
apt-get install openssl libssl-dev curl -y
mkdir ~/bin
PATH=~/bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
## 如果上述 URL 不可访问,可以用下面的:
## curl -sSL ‘https://gerrit-googlesource.proxy.ustclug.org/git-repo/+/master/repo?format=TEXT’ |base64 -d > ~/bin/repo
chmod a+x ~/bin/repo
3.拉取代码
创建工作目录
mkdir -p /root/aosp
cd /root/aosp
repo init -u https://android.googlesource.com/platform/manifest
repo sync
国内源
#repo init -u git://mirrors.ustc.edu.cn/aosp/platform/manifest
某个特定的 Android 版本
repo init -u https://android.googlesource.com/platform/manifest -b android-2.3.6_r1
android-2.3.6_r1 android-4.0.4_r2.1 android-13.0.0_r41 android-12.1.0_r26 android-security-11.0.0_r66 android-security-10.0.0_r75