由于国内无法直接从googlesource里下载代码,国内一些大学给大家提供了镜像服务
清华镜像: https://mirrors.tuna.tsinghua.edu.cn/help/AOSP/
科大镜像: https://lug.ustc.edu.cn/wiki/mirrors/help/aosp/
环境准备
- Linux,如:Ubuntu,Deepin
- 下载 repo 脚本
- 安装 git 软件
下载git软件
sudo apt-get install git
下载repo脚本
mkdir ~/bin
PATH=~/bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
如果无法从googleapis.com网站下载可以从镜像网站下载,如下:
mkdir ~/bin
PATH=~/bin:$PATH
curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo -o repo
chmod a+x ~/bin/repo
除此之外还需要将镜像源地址写入到~/.bashrc
里,以便repo
更新自己,同时将repo写入到PATH里,以便在任何目录下都可以使用该命令。
export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/'
export PATH=~/bin:$PATH
下载代码
初始化仓库
# android-12.0.0_r15
repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b android-12.0.0_r15
# 最新的代码
repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest
同步代码
# checkout所有文件
repo sync -c -j18
# checkout 指定仓库的文件
repo sync -c -j18 <仓库名称>
收藏:下面是常用的仓库:
hardware/interfaces
hardware/ril
frameworks/base
frameworks/opt/telephony
frameworks/opt/net/ims
packages/apps/Settings
packages/apps/CarrierConfig
packages/apps/SecureElement
packages/services/Telecomm
packages/services/Telephony
packages/services/Mms
packages/providers/TelephonyProvider
system/netd
system/libhidl
system/libhwbinder
system/hwservicemanager
– 完毕 –