两个多月没写博客了,感觉不会再爱了。Android P 发布已经好久了,今天来尝一尝这块Pie。
编译环境
- Ubuntu18.04, 双系统环境
- PC机,内存32G,CPU 16 核心,I7八代。
源码下载
- 镜像源 : https://aosp.tuna.tsinghua.edu.cn
- 准备环境
下载 git :
sudo apt-get install git
安装curl库:
sudo apt-get install curl
下载repo并设置权限:
curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo > ~/bin/repo
chmod a+x ~/bin/repo
安装python :
sudo apt-get install python
- 下载源码
建立工程目录:
mkdir aosp
cd aosp
使用tanna源
export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/'
设置账户:
git config --global user.email "xxxxxxx@gmail.com"
git config --global user.name "xxxxx"
初始化仓库:
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest
指定Android版本并初始化:
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-9.0.0_r8
同步源码:
repo sync
最终源码下载结果:
源码编译
- 安装openjdk8
- 安装依赖
sudo apt-get install libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dev g++-multilib
sudo apt-get install -y git flex bison gperf build-essential libncurses5-dev:i386
sudo apt-get install tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386
sudo apt-get install dpkg-dev libsdl1.2-dev libesd0-dev
sudo apt-get install git-core gnupg flex bison gperf build-essential
sudo apt-get install zip curl zlib1g-dev gcc-multilib g++-multilib
sudo apt-get install libc6-dev-i386
sudo apt-get install lib32ncurses5-dev x11proto-core-dev libx11-dev
sudo apt-get install libgl1-mesa-dev libxml2-utils xsltproc unzip m4
sudo apt-get install lib32z-dev ccache
sudo apt-get install libssl-dev
- 开始编译, launch后选择要编译的工程版本,输入序列号
source build/envsetup.sh
lunch 6
make -j16
编译结果如下,耗时 01:44:59 ( hh::mm::ss )
编译后整个aosp目录和out目录大小为:119.2GB 和 82.7GB, 占用空间很大。out目录中有分析用的重要的中间文件。