Android-Control Factors for compiling and installing modules
In the previous article, Android-compiled system initialization settings had a resolution-compiledTARGET_BUILD_VARIANTConfiguration and basic differences,
Some of the compilation controls are correct, butLOCAL_MODULE_TAGSThe current version of android4.2 is not fully applicable to the control. Here we record the control process of the Module.
First, put the variable in Android. mk, which is in/build/core/base_rules.mk by default:
LOCAL_MODULE_TAGS := $(sort $(LOCAL_MODULE_TAGS))ifeq (,$(LOCAL_MODULE_TAGS)) LOCAL_MODULE_TAGS := optionalendif
And it is not LOCAL_MODULE_TAGS: = optional, it will be installed into system. img!
The values of LOCAL_MODULE_TAGS in android 4.2 include:
# Only the tags mentioned in this test are expected to be set by module# makefiles. Anything else is either a typo or a source of unexpected# behaviors.ifneq ($(filter-out debug eng tests optional samples shell_ash shell_mksh,$(LOCAL_MODULE_TAGS)),)$(warning unusual tags $(LOCAL_MODULE_TAGS) on $(LOCAL_MODULE) at $(LOCAL_PATH))endif
Debug eng tests optional samples shell_ash shell_mkshThese values have no user, which is a difference from the previous one!
WhereTARGET_BUILD_VARIANTOr corresponding:
Eng:
Default type, InstallationLOCAL_MODULE_TAGSType:/build/core/main. mk:
ifeq ($(TARGET_BUILD_VARIANT),eng)tags_to_install := debug eng
InstallPRODUCT_PACKAGESModule defined in
User:
Used for release, as described earlier to disable log, shel, rootl, and compile odex Android-compile odex Protection
LOCAL_MODULE_TAGS cannot be user
Which modules are only dependent on andPRODUCT_PACKAGES
Userdebug:
Used for debugging and InstallationLOCAL_MODULE_TAGSType:/build/core/main. mk:
ifeq ($(user_variant),userdebug) # Pick up some extra useful tools tags_to_install += debug
InstallPRODUCT_PACKAGESModule defined in
Symbols directory:
Here we record a phenomenon, whether the Module is apk or lib, sometimes separatelyMmmDuring compilation,
Can be installed to the corresponding location of the system in/out, and finally can be packaged into the system's system. img
However, if the overallMake-j *Compile the system, then the corresponding apk. lib will be generated under/outSymbols/systemCorresponding location,
Finally, it will not be packaged into system. img!
This is because the ModuleLOCAL_MODULE_TAGSAnd the current compiledTARGET_BUILD_VARIANTThe rules mentioned above are not met,
Module is not considered to require install!
You can modifyLOCAL_MODULE_TAGSOr see the followingPRODUCT_PACKAGESAdd Module in!
Here we only differentiate the installation control of the Module. We can see that the highest level of control over the Module in 4.2 isPRODUCT_PACKAGESThis variable!
II.
PRODUCT_PACKAGES:
This variable has a value in many. mk values, for example, in device. mk of the device, and is similar to this:
# jscese add libusb and compat lib ,usb-modeswitch execute binary for 3G PRODUCT_PACKAGES += rild libusb libusb-compat usb_modeswitch #end
All
+ =Accumulate operation!
This means that these modules will be compiled and installed into the system anyway.
Simple recordPRODUCT_PACKAGESProcess of action:
First, in main. mk
Product_MODULESAnd
Product_FILES:
# The base list of modules to build for this product is specified # by the appropriate product definition file, which was included # by product_config.make. product_MODULES := $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES) # Filter out the overridden packages before doing expansion product_MODULES := $(filter-out $(foreach p, $(product_MODULES), $(PACKAGES.$(p).OVERRIDES)), $(product_MODULES)) $(call expand-required-modules,product_MODULES,$(product_MODULES)) product_FILES := $(call module-installed-files, $(product_MODULES))
Modules_to_install:
modules_to_install := $(sort $(ALL_DEFAULT_INSTALLED_MODULES) $(product_FILES) $(foreach tag,$(tags_to_install),$($(tag)_MODULES)) $(call get-tagged-modules, shell_$(TARGET_SHELL)) $(CUSTOM_MODULES) )
This is a variable to be installed. It is useful to the variables described above.
Tags_to_installAnd
Product_FILES
Modules_to_installSome filters will be processed. For details, see main. mk.
ALL_DEFAULT_INSTALLED_MODULES:
# build/core/Makefile contains extra stuff that we don't want to pollute this# top-level makefile with. It expects that ALL_DEFAULT_INSTALLED_MODULES# contains everything that's built during the current make, but it also further# extends ALL_DEFAULT_INSTALLED_MODULES.ALL_DEFAULT_INSTALLED_MODULES := $(modules_to_install)include $(BUILD_SYSTEM)/Makefilemodules_to_install := $(sort $(ALL_DEFAULT_INSTALLED_MODULES))ALL_DEFAULT_INSTALLED_MODULES :=
Add the Makefile file to Android.
ALL_DEFAULT_INSTALLED_MODULESInstall! I will not go into depth here.
The dependencies of make compilation are as follows:
Droid:
# Building a full system-- the default is to build droidcoredroid: droidcore dist_files....PHONY: droid
Droidcore:
# Build files and then package it into the rom formats.PHONY: droidcoredroidcore: files systemimage $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_RECOVERYIMAGE_TARGET) $(INSTALLED_USERDATAIMAGE_TARGET) $(INSTALLED_CACHEIMAGE_TARGET) $(INSTALLED_FILES_FILE)
Files:
# All the droid stuff, in directories.PHONY: filesfiles: prebuilt $(modules_to_install) $(modules_to_check) $(INSTALLED_ANDROID_INFO_TXT_TARGET)
We can see that the dependency isModules_to_install!