一、准备工作:
1.安装VMware虚拟机;
2.安装ubuntu系统(到ubuntu官网下载最新版的就行,比如我下载的是22版本的,不要按教材上的下14.04的,太老了,bug多到让你抓狂);
二、在ubuntu内下载Adroid系统源码:
1.安装vm-tools:sudo apt-get install open-vm-tools-desktop
2.下载接下来要用到的工具:
sudo ln -s /usr/bin/python3 /usr/bin/python
apt install curl
apt install repo
apt install vim
apt install git
3.创建bin目录并准备下载:
mkdir ~/bin
PATH=~/bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
4.修改bashrc文件
vim ~/.bashrc
增加export REPO_URL=‘https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/’
5.将repo内的google源替换成国内edu的
vim ~/bin/repo
替换
REPO_URL = ‘https://gerrit-google.tuna.tsinghua.edu.cn/git-repo’
6.创建source文件并做拉取初始化:
mkdir source
cd source
export REPO_URL=‘https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/’
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest(这个是默认拉取最新android版本的源码下来,如果你要指定版本,可以-b,然后接版本名;比如:repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-12.0.0_r9)
7.同步源码下来:
repo sync
然后等下完即可,很慢,要几个钟