一.下载Repo
mkdir ~/bin //新建存放repo工具的bin目录
PATH=~/bin:$PATH //设置PATH环境
curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo > ~/bin/repo //下载reop
chmod a+x ~/bin/repo //设置可读写执行权限
二.创建映像空间
在磁盘工具中创建100GB存储空间
三.在新开辟的空间创建存储源码文件夹
localhost:AOSP yuemingxingxing$ mkdir aosp
四.从服务器初始化repo环境
export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/'
// 主仓库
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest
// 指定分支
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-9.0.0_r35
五.下载android9.0源码
repo sync
六.下载单个目录的源代码
比如下载framework下各个目录的源代码,则
git clone https://aosp.tuna.tsinghua.edu.cn/platform/frameworks/base.git //base目录
git clone https://aosp.tuna.tsinghua.edu.cn/platform/frameworks/ex.git //ex目录