After the first time load the android source project, we usually execute make command under the project directory, then android system image system.img will be availible after a long waiting. wether make command should be executed or not after one of the android module source code was modified or added into the project. the answer is not. google have provided another commands to support debugging the module and to repack the system.img commands. let's check this command before we went on learning android source code.|
1.firstly,there is script file envsetup.sh under the directory of Android/build.After execute this script,you will get some useful tools:
please remind ,this is a source command,after execute it,you will get some additional commands to use. Copy the Code
- USER-NAME@MACHINE-NAME:~/Android$ . ./build/envsetup.sh
- 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.
You can use -help to inquire how to use these command,here we just care about the mmm command .we can use this mmm command to compile all the modules under your specified directory ,generally there is only one module under your specified directory.
2.Use mmm command to compile the specified module,such as the Email program:
After compiling,you will get the Email.apk file under the directory of out/target/product/generic/system/app .All of the system apps are under this directory. Copy the Code
- USER-NAME@MACHINE-NAME:~/Android$ mmm packages/apps/Email/
3.After compiling,you should pack the system.img again, therefore we can see our app when this system.img runs in your machine.
Ok,you got it! Copy the Code
- USER-NAME@MACHINE-NAME:~/Android$ make snod