In this tutorial, all is done based on Ubuntu 20.04 Step1: Environment Preparation
- git: It is built-in on Ubuntu by default. We set two global configs for git:
(1)git config --global user.email “YOUR EMAIL ADDRESS” (2)git config --global user.name “USER NAME” - python: I think you should install it by
sudo apt-get install python - repo: Download repo tool through the following steps:
(1)create a bin folder in Home directory:mkdir ~/bin ,which is used to store the repo tool. (2)download repo tool: curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo > ~/bin/repo (3)change file mode bits to make it executable: chmod a+x ~/bin/repo (4)set up environment variable: echo "PATH=~/bin:$PATH" >> ~/.bashrc echo "export REPO_URL=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo" >> ~/.bashrc ,we use source command to update the state of .bashrc:~$source ~/.bashrc . So repo can be used anywhere and Tsinghua university source will be used in our tutorial later.
Step2: initialize repo First,we create a AOSP directory to store source code: ~$mkdir ~/AOSP If you want to get the latest AOSP code , your should download the initialization repo: wget -c https://mirrors.tuna.tsinghua.edu.cn/aosp-mo nthly/aosp-latest.tar then unzip aosp-latest.tar file in which there is only a .repo folder. You can check all AOSP branches then decide to check out which one, the way is that: (1)Get into .repo folder: cd .repo/manifests (2)Check branches:.repo/manifests$ git branch -a Otherwise , you can choose a specific branch to check out like this: repo init -u git://mirrors.ustc.edu.cn/aosp/platform/manifest -b android-8.0.0_r2 Step3: start to sync ~/AOSP$ repo sync -c -j4 2>&1 > sync.log We direct the stdout and stderr information to a log file called sync.log. From now on, we just wait for it to finish.
If it is finished ,the folder looks like this:
|