aosp_002.ubuntu18.04搭建编译环境

搭建编译环境:

在python2环境进行操作

1、安装openjdk8

sudo apt-get install openjdk-8-jdk
sudo apt-get install openjdk-8-jre

2、安装依赖包

$ sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev libgl1-mesa-dev libxml2-utils xsltproc unzip

下载源码:

AOSP的代码管理是基于git的管理方式,但是是由几百个git仓库构成的,这几百个git仓库统一管理就必要要有一个统一的工具,google的工程师用python写了个脚本叫repo,使用它来进行管理android的中每个git仓库对应的版本。

安装git和repo并配置

sudo apt-get install git repo
git config --global user.name "your name"
git config --global user.email "[email protected]"

配置repo

vim ~/.bashrc
export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/'

下载源码

mkdir aosp
cd aosp
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest
#或者下载特定分支
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-4.0.1_r1
#分支网址:https://source.android.com/setup/start/build-numbers.html
repo sync #开始下载

推荐使用清华大学镜像:
将 https://android.googlesource.com/ 全部使用 https://aosp.tuna.tsinghua.edu.cn/代替

开始编译:

cd aosp
. build/envsetup.sh #初始化编译环境
lunch #设置编译目标
make #开始编译 可选参数 -j  指定编辑线程数目
emulator #编译成功后,运行模拟器

编译成功后,我们使用vendorsetup.sh脚本里面的pack函数将编译出来的镜像文件打包成rom,红色部分表示生成的路径。

出现错误:

mkfs.fat: warning - lowercase labels might not work properly with DOS or Windows
mkfs.fat 4.1 (2017-01-24)
.....
AssertionError: Can only handle FAT with 1 reserved sector
.....
ninja: build stopped: subcommand failed.
14:59:40 ninja failed with: exit status 1


 

猜你喜欢

转载自blog.csdn.net/zzq1824837536/article/details/88357130