环境为ECS ubuntu 14.04
1. 配置源
备份sources.list文件:cp /etc/apt/sources.list /etc/apt/sources.list.old
设置sources.list文件:vim /etc/apt/sources.list
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
更新源列表:apt-get update
2. 搭建编译环境
安装JDK:apt-get install openjdk-7-jdk
设置环境变量:vim /etc/profile
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/
export PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
使环境变量生效:source /etc/profile
安装编译支持包: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 ccache \
libgl1-mesa-dev libxml2-utils xsltproc unzip lzop
3. 编译android系统
设置环境变量:source build/envsetup.sh
设置编译目标:lunch
执行编译命令:make -j4
(PS. 编译过程中如果有提示缺少的库,可以使用apt-get install进行安装,执行编译命令时如果有提供编译脚本可以使用编译脚本进行编译,如果没有提供编译脚本,-j参数可以根据机器的实际的cpu核心数进行配置。)
原文链接:https://www.f2er.com/ubuntu/349748.html