My DIY Android journey-independently transforming your android Module

Source: Internet
Author: User

Kids shoes who have compiled the android source code must know that it takes a long time to compile the entire android source code, 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.

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

Execute./build/envsetup. Sh according to the introduction in Lao Luo's Android journey, and the mmm command cannot be found!

I found some information online and got it right away!

Execute source build/envsetup. Sh (add source before, otherwise the mmm and other commands cannot be found) (you must run this command in different shell windows before using mmm and other commands)

  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. II. use the mmm command to compile the specified module, such as the MMS application: now we can compile the android module separately. Now it is necessary to modify the android built-in application separately, then I will select the most common text message application in Android, modify some attributes of the text message application, compile the text message module separately, and view the transformation result in the simulator! Because it is just a simple verification, I simply modified the text message application icon and text message background color, and then executed Mmm packages/apps/MMS/ After a short compilation, the compilation was successful! After compilation, you can view the mms.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 Hardware Abstraction Layer (HAL) interface files and so on... III. after compiling the module, You need to repackage the system. imgfile. when IMG runs on the simulator, we can see our program. User-name @ machine-Name :~ /Android $ make Snod User-name @ machine-Name :~ /Android $ emulator-kernel/home/Hu/android2.3/out/target/product/generic/system. img It proves that the independent compilation is successful! We can independently transform most of the app attributes of Android to create an android image file of our own, which is roughly an android ROM of our own. Of course, to create an android ROM of your own, you still need to do a lot. You don't have to consider the adaptation part, because the CM team can make a lot of hardware adaptation, however, you must be very clear about the overall framework and code of Android so that you can make a very different Android system ....

 

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.