环境:Ubuntu14.04 64bit
硬盘:100G
1、安装必备工具合集:(以下工具一个一个安装)
1)cofface@cofface-virtual-machine:~$ sudo apt-get update
2)cofface@cofface-virtual-machine:~$ sudo apt-get install git-core gnupg flex bison gperf build-essential
3)cofface@cofface-virtual-machine:~$ sudo apt-get install zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs
4)cofface@cofface-virtual-machine:~$ sudo apt-get install x11proto-core-dev libx11-dev lib32readline-gplv2-dev lib32z-dev
5) cofface@cofface-virtual-machine:~$ sudo apt-get install libgl1-mesa-dev g++-multilib mingw32 tofrodos
6) cofface@cofface-virtual-machine:~$ sudo apt-get install git libesd0-dev libncurses5-dev libsdl1.2-dev libwxgtk2.8-dev openjdk-6-jdk openjdk-6-jre
7) cofface@cofface-virtual-machine:~$ sudo apt-get install pngcrush schedtool squashfs-tools xsltproc gcc-multilib lib32readline-gplv2-dev lib32z1-dev
8) cofface@cofface-virtual-machine:~$ sudo apt-get install bc imagemagick liblz4-tool libssl-dev libxml2 libxml2-utils lzop rsync
2、创建bin目录
cofface@cofface-virtual-machine:~$ mkdir ~/bin
3、下载和安装repo:
cofface@cofface-virtual-machine:~$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
4、repo赋予权限:
cofface@cofface-virtual-machine:~$ chmod a+x ~/bin/repo
5、配置环境变量:
cofface@cofface-virtual-machine:~$ sudo gedit ~/.bashrc
最后一行增加如下内容:
# set PATH so it includes user’s private bin if it exists
if [ -d “$HOME/bin” ] ; then
PATH=”$HOME/bin:$PATH”
fi
6、生效环境变量:
cofface@cofface-virtual-machine:~$ source ~/.bashrc
7、创建一个目录来存放CM代码(以cm-13.0为例):
cofface@cofface-virtual-machine:~$ mkdir -p ~/android_source/cyanogenmod/cm-13.0
8、配置git email,name:
cofface@cofface-virtual-machine:~$ git config –global user.email “you@example.com”
cofface@cofface-virtual-machine:~$ git config –global user.name “Your Name”
9、进入cm-13.0目录并进行同步源码:
cofface@cofface-virtual-machine:~$ cd ~/android_source/cyanogenmod/cm-13.0
cofface@cofface-virtual-machine:~$ repo init -u git://github.com/LineageOS/android.git -b cm-13.0
10、下载同步脚本:链接:http://pan.baidu.com/s/1i5Dm0vV 密码:3bw6
11、下载完后放到android_source/cyanogenmod/cm-13.0目录下,然后执行如下命令进行同步代码:
cofface@cofface-virtual-machine:~$ chmod 755 ~/android_source/cyanogenmod/cm-13.0/sync.sh
cofface@cofface-virtual-machine:~$ cd ~/android_source/cyanogenmod/cm-13.0
cofface@cofface-virtual-machine:~/android_source/cyanogenMod/cm-13.0$ ./sync.sh
耐心等待源码同步。
源代码同步完后进行如下环境配置:
配置jdk环境:其中cm 11.0~13.0: OpenJDK 1.7 (安装openjdk-7-jdk),cm 14.0~14.1: OpenJDK 1.8 (安装openjdk-8-jdk)
可以同时安装2个版本,可以到 ~/.bashrc 进行配置切换即可。
1、openjdk 1.7安装教程:http://blog.cofface.com/archives/2305.html
2、openjdk 1.8安装教程:http://blog.cofface.com/archives/2346.html
注:参考来源:
1、http://wiki.lineageos.org/devices/mako/build#put-the-bin-directory-in-your-path-of-execution
2、https://github.com/LineageOS/android/tree/cm-13.0