Brief analysis and use of Android compiling system

Source: Internet
Author: User

Programmers who develop Linux programming know that Makefile is a very important file, and that one important function is to specify the compilation rules. Such a huge Android system source code is certainly no exception.

Android.mk in the Android source code is the role of makefile. Android system is too complex compilation system, no way, those can be Google inside the Daniel wrote, for me and other programmers, the first and foremost is to use AH, the boss does not care about your knowledgeable or not, care you can fix the problem, as to how to fix the boss does not care. So here I just simple introduction of the Android compiler system, the purpose is very simple, if you want to add a new platform, you know what files to see, modify which files on it.

Three big steps to compiling Android system.

SOURCE Build/envsetup. SH

The above command introduces a build/envsetup.sh script. The purpose of the script is to initialize the compilation environment and introduce some auxiliary Shell functions, including the lunch function used to select the target in the second step. In addition to this, some other commonly used functions are defined in this file, as follows:

name Description
Croot Switch to the root directory of the source tree
M Execute make at the root of the source tree
Mm Build module in current directory
Mmm Build the module under the specified directory
Cgrep Perform grep on all C + + files
Jgrep Perform grep on all Java files
Resgrep Perform grep on all res/*.xml files
Godir Go to the directory path that contains a file
Printconfig Displays configuration information for the current Build
Add_lunch_combo Add an entry in the menu of the lunch function
Lunch Full-eng

The second step is to call the lunch function and specify the argument as "Full-eng". The parameters of the lunch function are used to specify the target device for this compilation and the compilation type. Here, the two values are "full" and "Eng", respectively. "Full" is a product that has been defined in the Android source code and is set for the simulator. While the compilation type affects the modules contained in the final system, as shown in the three compilation types, the previous article just slightly mentioned:

name Description
Eng The default type, which is applicable to the development phase.
When this type is selected, the result of the compilation is:
  • Installation of modules containing ENG, debug, User,development tags
  • Install all non-labeled APK modules
  • Install the APK module specified in all product definition files
User This compilation type is suitable for the final release phase.
When this type is selected, the result of the compilation is:
  • Install all modules with the user tag
  • Install all non-labeled APK modules
  • Install the APK module specified in all product definition files and the APK module tag will be ignored
Userdebug This compilation type is suitable for use in the debug phase.
This type is the same as user except:
  • The module containing the debug tag will be installed
  • The compiled system has root access rights

first in the Android source root directory has a makefile file, as shown, it points to the build/core/in the main.mk.  

Brief analysis and use of Android compiling system

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.