Modify Android. mk in Android to make it compile rgb2565 and rgb2888 at the same time (Add a new tool command to out/host/linux-x86/bin)

Source: Internet
Author: User

Modify Android. mk in Android to make it compile rgb2565 and rgb2888 at the same time (Add a new tool command to out/host/linux-x86/bin)


Modify the corresponding android. MK files allow them to compile the source code files rgb2565, rgb2888, and rgb2888 at the same time. In fact, the implementation is very simple, here, I will just list the compilation methods used by the modules with different module labels in different compilation modes in a specific test, because our changes are best combined with the source code seamlessly.

I. Four compilation modes of the android System

The Android system has four compilation modes: User, userdebug, Eng, and test. This value is saved by the compilation environment variable target_build_variant. We need to manually specify this value before source code compilation. If you run the $. Build/envsetup. Sh command and run the lunch command, the system automatically modifies the value of target_build_variant based on our selection. If this value is not specified, the system defaults it to Eng.

Different models determine that different modules are installed in the target system (system. IMG) and apply to different release versions. In this way, the system of the released version is lighter and simpler. Next, let's take a look at the main differences between different compilation modes.

Eng

This is the default flavor. A plain "make" is the same as "make eng". droid is
An alias foreng.

· Installmodules tagged with: ENG, debug, user,
And/or development.

· Installnon-APK modules that have no tags specified.

· Installapks according to the product definition files, in addition to tagged apks.

· Ro. Secure = 0

· Ro. debuggable = 1

· Ro. kernel. Android. checkjni = 1

· ADB is enabled by default.

User

"Make user"

This is the flavor intended to be the final release bits.

· Installmodules tagged with user.

· Installnon-APK modules that have no tags specified.

· Installapks according to the product definition files; tags are ignored for APK modules.

· Ro. Secure = 1

· Ro. debuggable = 0

· ADB is disabled by default.

Userdebug

"Make userdebug"

The same as user, doesn t:

· Also installmodules tagged with debug.

· Ro. debuggable = 1

· ADB is enabled by default.

Tests

Installmodules tagged with user, debug, Eng, tests.

The above table distinguishes the different tasks that the compiling system does in different compiling modes. We can learn from the above table:

① It is not in the corresponding compilation mode that the corresponding compilation module is pre-installed into the target system. For example, Eng. In the Eng compiling mode, modules labeled as Eng, debug, and user are pre-installed. In tests compiling mode, modules labeled as user, debug, Eng, and tests are pre-installed. This is very important for us to modify Android. mk and successfully compile rgb2888.

② In the user compiling mode, only modules labeled as user are pre-installed. In userdebug mode, the pre-installed modules are labeled as user and the modules labeled as debug.

③ If the compilation mode is not specified during compilation, the system automatically defaults the compilation mode to the Eng mode.

④ Other differences do not affect rgb2888 compilation.

Ii. Module labels in the Android. mk File

① The Android. mk file is the compilation configuration file in the android source code. It specifies how the corresponding module is compiled. Compilation in the android source code is carried out in modules. one android. mk file can compile one or more modules at the same time.

② Android. mk starts with include $ (clear_vars) and ends with include $ (File Format. You can specify the tag, Module name, required source file, library, and so on between them.

③ The value range of each module tag is user, Eng, tests, optional, and samples. The system compiles the corresponding modules to the target system based on the target_build_variant value mentioned above. The module label can be intuitively understood as follows:

User: This module is compiled in user mode.

Eng: This module is compiled in Eng mode.

Tests: indicates that this module is compiled in tests mode.

Optional: indicates that this module is compiled in any compilation mode.

Samples: Not sure yet.

④ It is incorrect to understand the module labels officially provided above. Different modules may be pre-installed in different compilation modes. For example, in Eng mode, modules labeled as user, debug, and ENG are pre-installed, therefore, in the Eng mode, the user and debug modules should also be compiled. In short, we can understand that the compilation mode and module tag jointly determine the compilation mode of the corresponding module in actual compilation, and the two are mutually dependent.

⑤ When the module label is not specified, the default value is user.

3. Modify Android. mk to compile rgb2565 and rgb2888 at the same time.

① First, compile the compilation configuration of rgb2888 following the rgb2565 module in the Android. mk file. As shown in:

② Compile Android. mk and select Eng mode for compiling. The following error message is displayed:

③ The above prompts that the user label only supports traditional modules. If you compile this module in any mode, you must specify the module label as optional. We add the corresponding module label optional to rgb2888 module of Android. mk, and re-compile and pass.

④ The module label is modified to optional and then compiled successfully. When searching in the corresponding directory (Out/host/linux-x86/bin/), it is found that the rgb2565 command has been generated, and rgb2888 is not output to the directory. However, our compilation has passed, indicating that the rgb2888 module has been correctly compiled. By viewing the directory out/host/linux-x86/obj/executables/rgb2888_intermediates/, it is found that the intermediate product of compilation has indeed been generated, indicating that our compilation is not wrong. From this point, it can be noted that the module labeled optional will be compiled in any mode but will not be pre-installed into the target system.

⑤ When the default label user is used, the system prompts that the user label only supports traditional modules. Test shows that in Eng mode, if the module with the pre-installed label as user is displayed, the module supported by the specified user label must be displayed. The specified method is to modify the build/CORE/user_tags.mk file in the source code, and add the module name in grandfathered_user_modules + =, that is, our rgb2888. Then compile and test.
Rgb2888 and rgb2565 are successfully output to the out/host/linux-x86/bin directory.

6. After the label Eng is used for re-compilation, it is found that the Code passes through and rgb2888 is successfully output to the corresponding bin directory (the compiling mode is Eng ).

7. comparison shows that when the compiling mode is Eng and the pre-installed module with the label "user" is specified, when the module uses the Eng label, you can pre-install this module without specifying the display. It is unclear whether optional labels can be pre-installed by modifying the corresponding support for the module in Eng mode.

In addition, preinstalled the compiled module to the target system (system. IMG) seems to be not equivalent to the corresponding rgb2888 output in the out/host/linux-x86/bin. There seems to be no bound relationship between the two. However, this does not affect our solution.

Iv. Summary

To sum up, modify the Android. mk file to compile rgb2565 and rgb2888 at the same time. You can use the following three methods (ENG compilation mode ):

① Add the rgb2888 module to the corresponding rgb2565/Android. mk file (use the default module label), and modify build/CORE/user_tags.mk to add support for rgb2888.

② You can create the rgb2888 directory in the location of the rgb2565 directory, copy the corresponding source code file, and compile the rgb2888 module compilation file android. MK (use the default module label), and modify build/CORE/user_tags.mk to add support for rgb2888. This method provides a clearer description of the source code. However, it is critical to modify user_tags.mk.

③ Use the Eng label directly in the rgb2888 module.

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.