Module implementation method of separately compiling Android source code

After downloading the Android source code project for the first time, 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. In the future, if we modify a module in the Android source code or add our own module in the Android source code project, do we still execute the make command? The answer is No. Google has prepared additional commands for us to support compiling individual modules and repackaging the system IMG command. Before continuing to learn 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:

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, it can be used to compile all modules in the specified directory. Usually, this directory contains only one module.

II Use the MMM command to compile the specified module, such as email application:

USER- NAME@MACHINE -NAME:~/Android$ mmm packages/apps/Email/

After compiling, you can see the email in the out / target / product / generic / system / APP directory Apk file. The Android system's own apps are placed in this directory. In addition, some executable files of the Android system, such as c compiled executable files, are placed in the out / target / product / generic / system / bin directory, the dynamic link library files are placed in the out / target / product / generic / system / lib directory, and the out / target / product / generic / system / lib / HW directory stores the hardware abstraction layer (HAL) interface files. In the following articles, We will mention it one after another. Please pay attention.

III After compiling the module, you have to repackage the system IMG file, so we put system When img runs on the simulator, we can see our program.

USER- NAME@MACHINE -NAME:~/Android$ make snod

IV Run the simulator according to the methods described in the article downloading, compiling and installing the latest Android source code on Ubuntu:

USER- NAME@MACHINE -NAME:~/Android$ emulator

So it's all done.

I hope it will be helpful for small partners studying Android source code!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>