-
Notifications
You must be signed in to change notification settings - Fork 0
1.1 Pull source code
安卓源码拉取,最重要的就是要通过repo拉取整体源码,因此该部分主要讲述如何下载repo并拉取相关源码。
The most important thing about the AOSP source code pull is to pull source code through the repo, so this part mainly describes the installation of repo and how to use repo to collect overall source about AOSP.
以下是Google官方提供的repo工具下载方式。
The following is the repo installation procedure provided by Google.
mkdir ~/bin
PATH=~/bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo如果无法访问到该文件,也可以通过下面的代码使用清华提供的git-repo。
If you can not access this file, you can also download the git-repo from Tsinghua from the following code.
curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo -o repo
chmod +x repo效果如下:
The result is as follows:
注:
repo的运行过程中会尝试访问官方的git源更新自己,如果想使用清华的镜像源进行更新,可以将如下内容输入到shell中直接使用或复制到你的~/.bashrc里然后重启终端模拟器。
Note: During the operation of the
repo, it will try to access the officialgitsource to update itself. If you want to use the mirrors of Tsinghua to update, you can enter the following content into the shell and use it directly or copy it to your~/.bashrcand restart the terminal.
export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo'之所以我下载指定分支是因为整个的源码太大了,所以指定分支下载。内存和网速足够的话可以拉取整个镜像[2]。
The reason why I download the specified branch is that the entire source code is too big to download. You can pull the entire code with sufficiant memory and bandwidth[2].
执行命令之前请确保自己安装了 python3 和 git 并设置了 git的 user.email和 user.name,设置命令如下:
Make sure to install python3 and git, and set the user.email and user.name. Code show as below:
git config --global user.email "[email protected]"
git config --global user.name "Your Name"查看安卓版本列表,此处我选择的是 android-10.0.0_r5,支持较多设备。
Browse the Android version list, I choose android-10.0.0_r5 which
support most devices.
接着创建工作目录:
Then make the working directory:
mkdir <WORKING_DIRECTORY>
cd <WORKING_DIRECTORY>进入该目录并运行:
Change to <WORKING_DIRECTORY> and run as below:
repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b android-10.0.0_r5同步源码树:
Sync the source code:
repo sync