资源 | 版本 |
---|---|
操作系统 | Ubuntu Desktop 18.04 |
官方源码地址 | https://android.googlesource.com/platform/manifest |
国内镜像地址 | https://aosp.tuna.tsinghua.edu.cn/platform/manifest |
Android版本 | android-13.0.0_r18 |
磁盘空间 | 400G |
机器内存 | 16G |
su - root
apt-get update
apt-get upgrade
sudo apt-get install git
sudo apt-get install git-core gnupg flex bison build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 libncurses5 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig vim
su - root
rm -rf /usr/bin/python
ln -s /usr/bin/python3 /usr/bin/python
验证python版本,确认 python 的默认版本是 3.x
python --version
cd /opt
git clone https://gerrit-googlesource.lug.ustc.edu.cn/git-repo
cd git-repo
修改 repo 中 REPO_URL 变量值。将变量值设置为:https://mirrors.tuna.tsinghua.edu.cn/git/git-repo
vim repo
然后将 repo 文件复制到 /usr/bin
目录中
su - root
cp repo /usr/bin
chmod +x /usr/bin/repo
su - root
cd /opt
mkdir android
cd android
git config --global user.email "email"
git config --global user.name "name"
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-13.0.0_r18
repo sync -c -j8
等待下载完成。
源代码下载的时间比较长,一共耗时1小时12分钟。源码下载到本地后会自动进入文件检验阶段,用与校验下载的文件是否有缺失。
源码下载注意事项
源代码下载后约占用 126G 的磁盘空间。
sudo dpkg-reconfigure dash
选择 No,将会切换到 bash 环境
sudo apt-get install openjdk-11-jdk
source build/envsetup.sh
lunch
m -j8
将会进入系统编译构建过程
Android 系统构建的过程非常长,构建完成后,将会在 out 目录中查看到编译好的系统镜像。