之前每次修改BoardConfig.mk后,都傻傻的先make clean然后重新编译,这样浪费的时间不计其数。后来忍受不了这种效率,Google了一下,果然不出所料是可以模块独立编译的。
1、进入Android源码根目录,执行source build/envsetup.sh;
2、可以执行mm、mmm等模块编译命令了。如要编译audioflinger,则执行mmm frameworks/base/services/audioflinger/ -B即可。
3、make -snod重新生成system.img映像。
将envsetup.sh的一些注释摘下来如下:
Invoke ". build/envsetup.sh" from your shell to add the following functions to your environment:
- croot: Changes directory to the top of the tree.
- m: Makes from the top of the tree.
- mm: Builds all of the modules in the current directory.
- mmm: Builds all of the modules in the supplied directories.
- cgrep: Greps on all local C/C++ files.
- jgrep: Greps on all local Java files.
- resgrep: Greps on all local res/*.xml files.
- godir: Go to the directory containing a file.
编译Android2.3所需要的toolchains:
1、安装jdk1.6:http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html
设置环境变量:
export JAVA_HOME=<JDK_PATH>
export JAVA_BIN=<JDK_PATH>
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_HOME JAVA_BIN PATH CLASSPATH
2、
sudo apt-get install flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev valgrind libreadline5-dev git-core gnupg
sudo apt-get install x11proto-core-dev libx11-dev
3、我的系统是64bits,还需要:
sudo apt-get install libc6-dev lib32ncurses5-dev ia32-libs lib32readline5-dev lib32z-dev g++-multilib