How to compile modules in the Android source code separately

Source: Internet
Author: User

Article reprinted to CSDN community Luo Shenyang's Android tour, original address: http://blog.csdn.net/luoshengyang/article/details/6566662

After downloading the Android source code project for the first time, we usually execute the make command under the Android source code engineering directory, and after a long wait, we can get the Android system image system.img. If we modify a module in the Android source code or add a new module to the Android source code project, do you still have to execute the make command? The answer is no, Google has prepared additional commands for us to support compiling separate modules and repackaging system.img commands. Before you continue learning the Android source code, let's take a look at this command.

First, in the Android source code directory under the build directory, there is a script file envsetup.sh, after the execution of this script file, you can get some useful tools:

[email protected]:~/android$. ./build/envsetup.sh

Note that this is a source command that, after execution, will have some additional commands to use:

-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 + + files. -Jgrep:greps on all local Java files. -Resgrep:greps on all local res/*.xml files. -Godir:go to the directory containing a file.The specific usage of these commands can be viewed at the back of the command, where we only focus on the MMM command, which is the ability to compile all the modules of the specified directory, usually with only one module in the-help directory. Two. Use the MMM command to compile the specified module, such as an email application: [email protected]:~/android$ mmm packages/apps/email/       Once the compilation is complete, you can see the email.apk file in the Out/target/product/generic/system/app directory. The Android system comes with apps that are placed in this directory. In addition, some executable files of the Android system, such as C-compiled executables, are placed in the Out/target/product/generic/system/bin directory, and the dynamic link library files are placed in the out/target/product/      Generic/system/lib directory, the OUT/TARGET/PRODUCT/GENERIC/SYSTEM/LIB/HW directory is the hardware abstraction layer (HAL) interface file, in the following article, we will continue to mention, please pay attention. Three. After compiling the module, we also need to repackage the system.img file so that we can see our program when we run the system.img on the simulator. [email protected]:~/android$ make Snod      Four. Run the emulator as described in the article on Ubuntu downloading, compiling, and installing the latest Android source code: [email protected]:~/android$ emulator       So it's all done. Lao Luo's Sina Weibo: Http://weibo.com/shengyangluo, welcome attention!

How to compile modules in the Android source code separately

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.