安装repo
curl "http://php.webtutor.pl/en/wp-content/uploads/2011/09/repo" > ~/../bin/repo
chmod a+x ~/../bin/repo
访问 Git and Repo获知怎么使用Git与Repo.
获取源码前,初始化本地库:
repo init -u git://github.com/Victor-android/android.git -b gingerbread
接下来同步源码:
repo sync -j5
添加java6源:
sudo add-apt-repository "deb http://us.archive.ubuntu.com/ubuntu/ hardy multiverse"
sudo apt-get update
安装相关依赖 CM社区建议: For 32-bit & 64-bit systems:
sudo apt-get install git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.6-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev sun-java6-jdk pngcrush schedtool
For 64-bit only systems:
sudo apt-get install g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline5-dev gcc-4.3-multilib g++-4.3-multilib
谷歌官方建议64-bit:
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 ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev
设置默认java版本 sudo update-alternatives --config java 查看当前java版本 java -version
接下来就是编译了:
source build/env*
lunch
由于CM的源码使用了非公开API,所以编译前需要:
make update-api
make -j2
或者错误输出到日志:
make -j2 2>log.txt
或者全部输出到日志:
make -j2 &>log.txt
CM官方提供编译命令:
. build/envsetup.sh && brunch raise -j2