正文
记录Android源码下载和编译
- 下载源码
repo 工具下载
mkdir ~/bin
PATH=~/bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
设置远程源码地址
export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/'
同步源码树
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-6.0.1_r8
后面的adroid-6.0.1_r8参考 https://source.android.com/source/build-numbers
下载
repo sync -j4
脚本重复repo
#!/bin/bash
repo sync -j4
while [ $? -ne 0 ]
do
repo sync -j4
done
- 编译源码
编译依赖下载
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
https://developers.google.com/android/drivers#bullheadopm7.181005.003
下载vendor脚本,执行脚本。并将vendor.img移动到ANDROID_PRODUCT_OUT目录
source build/envsetup.sh # pre work
lunch # 选择arch
make -j8
adb reboot bootloader
fastboot oem unlock
fastboot flashall -w
ubuntu需要安装openjdk7
参考https://blog.csdn.net/Mitnick5194/article/details/89076587
网友评论