[Getting started with Android] how to compile modules in the android source code separately

Source: Internet
Author: User
After the first download of the android source code project, we usually execute the make command in the android source code project directory. 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 in the android source code project, will we still execute the make command? The answer is no. Google has prepared additional commands for us to compile separate modules and repackage system. IMG commands. Before continuing to learn about the android source code, let's take a look at this command.

I. First, in the build directory under the android source code directory, there is a script file envsetup. Sh. After executing this script file, you can get some useful tools:

User-name @ machine-Name :~ /Android $ ../build/envsetup. Sh

Note: This is a source command. After execution, some additional commands can be used:

-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.
The specific usage of these commands can be viewed by adding-help after the command. Here we only focus on the mmm command, that is, we can use it to compile all modules in the specified directory, generally, this directory contains only one module.
2. Use the mmm command to compile the specified module, such as the email application:
User-name @ machine-Name :~ /Android $ Mmm packages/apps/email/
After compilation, you can view the email.apk file in the out/target/product/generic/system/appdirectory. Android apps are stored in this directory. In addition, some executable files of the Android system, such as the executable files compiled by C, are stored in the out/target/product/generic/system/bin directory, the dynamic link library file is stored in the out/target/product/generic/system/lib directory, the out/target/product/generic/system/lib/HW directory stores the hardware abstraction layer (HAL) interface file, which will be mentioned later.
3. After compiling the module, we need to re-package the system. imgfile so that we can see our program when running system. IMG on the simulator.
User-name @ machine-Name :~ /Android $ make Snod
4. Refer to the methods used to download, compile, and install the latest Android source code on Ubuntu to run the simulator:
User-name @ machine-Name :~ /Android $ emulator
In this way, everything is done.

Original article address

Http://blog.csdn.net/luoshengyang/article/details/6566662

Related Article

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.