細說dex2oat(1)
dex2oat的命令行參數(shù)
首先我們先看一下dex2oat都支持一些什么樣的命令行參數(shù):
通用類
- -j<線程數(shù)>:編譯時使用多少個線程副编。缺省值為默認的CPU核數(shù)懂傀。例:-j8
輸入輸出的文件類
- --dex-file=<dex文件>:待編譯的.dex, .jar或者.apk文件
- --dex-location=<dex文件路徑>:dex文件的路徑
- --zip-fd=<zip文件描述符>:包含classes.dex文件的zip的文件描述符
- --zip-location=<zip文件路徑>:zip文件路徑
- --oat-file=<輸出的oat文件名>:輸出的oat文件名
- --oat-fd=<輸出文件描述符>:輸出文件描述符
- --oat-location=<輸出的oat文件的路徑>:輸出的oat文件的路徑
- --oat-symbols=<oat文件名>:指定輸出完整符號的oat路徑
- --image=<art文件名>:指定輸出的image文件名,只有在編譯boot.art時才需要犀呼,編譯普通應用的時候不需要
- --image-classes=<預編譯文件列表>:指定preloaded-classes的路徑幸撕,例:--image=frameworks/base/preloaded-classes
- --base=<hex地址>:指定boot image的基地址,例:--base=0x50000000
- --boot-image=<boot.art>:指定boot class的文件外臂。例:--boot-image=/system/framework/boot.art坐儿,默認值為:$ANDROID_ROOT/system/framework/boot.art
- --android-root=<路徑>:portable linking所用的庫的路徑。例:--android-root=out/host/linux-x86宋光,默認值:$ANDROID_ROOT
指令集類
- --instruction-set=(arm|arm64|mips|mips64|x86|x86_64):指定編譯的指令集貌矿。例:--instruction-set=x86,默認:arm
- --instruction-set-variant=<子架構(gòu)名>:某一大的架構(gòu)下更細致的分類罪佳,例:--instruction-set-variant=cortex-a53
- --instruction-set-features=<指令集參數(shù)>逛漫。例:--instruction-set-features=div,默認:default
編譯器優(yōu)化選項類
- --compile-pic:Force indirect use of code, methods, and classes. 默認:disabled
- --compiler-filter=(verify-none| interpret-only| space |balanced |speed |everything |time):選擇compiler filter赘艳。例:--compiler-filter=everything酌毡。默認值:speed
- --huge-method-max=<方法指令數(shù)>:巨型方法的指令數(shù),用于編譯器調(diào)優(yōu)第练。例:--huge-method-max=10000阔馋,默認值:10000
- --large-method-max=<方法指令數(shù)>:大型方法的指令數(shù)玛荞,用于編譯器調(diào)優(yōu)娇掏。例:--large-method-max=600,默認值:600
- --small-method-max=<方法指令數(shù)>:小型方法的指令數(shù)勋眯,用于編譯器調(diào)優(yōu)婴梧。例:--small-method-max=60下梢,默認值:60
- --tiny-method-max=<方法指令數(shù)>:微型方法的指令數(shù),用于編譯器調(diào)優(yōu)塞蹭。例:--tiny-method-max=20孽江,默認值:20
- --num-dex-methods=<方法數(shù)>:小型dex文件的方法上限,用于編譯器調(diào)優(yōu)番电。如果發(fā)現(xiàn)是個小型的dex文件岗屏,而編譯器的filter不是interpret-only或者verify-none的話,就用speed filter漱办。例:--num-dex-method=900娩井,默認值:900
- --inline-depth-limit=<深度限制>:編譯器調(diào)優(yōu)用,只建議開發(fā)和實驗用洞辣。例:--inline-depth-limit=5定鸟,默認值:5
- --inline-max-code-units=<方法數(shù)>:inline調(diào)優(yōu)用躯泰,實驗用诵竭。例:--inline-max-code-units=100,默認值:100
- --dump-timing: 顯示時間都花到哪兒去了裳朋。
重定位信息類
- --include-patch-information:編譯時包含patch信息暖眼,可以在不重編的情況下重定位栋豫。
- --no-include-patch-information:不包含patch信息骡送。
調(diào)試信息類
- -g:與--generate-debug-info相同
- --generate-debug-info:生成所有可用的調(diào)試信息蛹批≈碛拢可以通過標準的strip命令或者objcopy命令來壓縮掉無用信息。
- --no-generate-debug-info:不生成調(diào)試信息
運行參數(shù)類
- --runtime-arg <參數(shù)>:指定運行時參數(shù)开伏,如:初始堆大小,最大堆大小,詳細輸出等可很。每次只能傳一個參數(shù)诗力。例:--runtime-arg -Xms256m
- --profile-file=<profile文件名>:指定profile信息苇本,供編譯器例用
編譯選項類
- --print-pass-names: 打印pass name信息
- --disable-passes=<pass-name,pass-name>:禁止某些pass項,例:--disable-passes=UseCount,BBOptimizations
- --print-pass-options:打印當前配置的pass信息
- --pass-options=Pass1Name:Pass1OptionName:Pass1Option#,Pass2Name:Pass2OptionName:Pass2Option#:指定pass信息。
臨時文件類
- --swap-file=<交換文件名>:指定交換文件言缤,例:--swap-file=/data/tmp/swap.001
- --swap-fd=<文件描述符>:指定交換文件的描述符
Makefile中指定的編譯參數(shù)
上面我們學習了dex2oat的參數(shù)的簡介嚼蚀,下面我們學以致用,看看在真實的環(huán)境中它們是如何被使用的。
運行時的Xms和Xmx參數(shù)
我們直接看build時导帝,dex2oat的參數(shù)是如何被傳進去的守谓,在build/core/dex_preopt_libart.mk中:
91# For a single jar or APK
92
93# $(1): the input .jar or .apk file
94# $(2): the output .odex file
95define dex2oat-one-file
96$(hide) rm -f $(2)
97$(hide) mkdir -p $(dir $(2))
98$(hide) $(DEX2OAT) \
99 --runtime-arg -Xms$(DEX2OAT_XMS) --runtime-arg -Xmx$(DEX2OAT_XMX) \
首先指定兩個運行時參數(shù),這兩個參數(shù)是在前面定義的:
44DEX2OAT_XMS := $(call get-product-default-property,dalvik.vm.dex2oat-Xms)
45DEX2OAT_XMX := $(call get-product-default-property,dalvik.vm.dex2oat-Xmx)
也就是說您单,這兩個值取自屬性dalvik.vm.dex2oat-Xms和vm.dex2oat-Xmx斋荞。這兩個屬性是哪里來的呢,是在/build/target/product/runtime_libart.mk中虐秦,編譯的時候指定進來的:
48PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
49 dalvik.vm.image-dex2oat-Xms=64m \
50 dalvik.vm.image-dex2oat-Xmx=64m \
51 dalvik.vm.dex2oat-Xms=64m \
52 dalvik.vm.dex2oat-Xmx=512m \
53 ro.dalvik.vm.native.bridge=0 \
這樣平酿,這兩個值分別是64m和512m。
boot-image
我們回到dex_preopt_libart.mk中繼續(xù)看:
100 --boot-image=$(PRIVATE_DEX_PREOPT_IMAGE_LOCATION) \
查這個PRIVATE_DEX_PREOPT_IMAGE_LOCATION悦陋,定義于/build/core/setup_one_odex.mk中:
30$(my_built_odex): PRIVATE_DEX_PREOPT_IMAGE_LOCATION := $(my_dex_preopt_image_location)
然后再向上追my_dex_preopt_image_location
22ifdef LOCAL_DEX_PREOPT_IMAGE_LOCATION
23my_dex_preopt_image_location := $(LOCAL_DEX_PREOPT_IMAGE_LOCATION)
24else
25my_dex_preopt_image_location := $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_LOCATION)
26endif
LOCAL_DEX_PREOPT_IMAGE_LOCATION沒有定義蜈彼,繼續(xù)順藤摸瓜。
23$(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_LOCATION := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/boot.art
再繼續(xù)追DEXPREOPT_BOOT_JAR_DIR_FULL_PATH:
17DEXPREOPT_BOOT_JAR_DIR_FULL_PATH := $(DEXPREOPT_PRODUCT_DIR_FULL_PATH)/$(DEXPREOPT_BOOT_JAR_DIR)
先看后面的DEXPREOPT_BOOT_JAR_DIR俺驶,原來就是system/framework
16DEXPREOPT_BOOT_JAR_DIR := system/framework
再看前面的DEXPREOPT_PRODUCT_DIR_FULL_PATH幸逆,是out下的dex_bootjars
14DEXPREOPT_PRODUCT_DIR_FULL_PATH := $(PRODUCT_OUT)/dex_bootjars
最后--boot-image
的值為out/dex_bootjars/system/framework/boot.art
dex文件和oat文件的路徑
這個就不多說了
101 --dex-file=$(1) \
102 --dex-location=$(PRIVATE_DEX_LOCATION) \
103 --oat-file=$(2) \
104 --android-root=$(PRODUCT_OUT)/system \
指令集相關(guān)
105 --instruction-set=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH) \
追查:
604DEX2OAT_TARGET_ARCH := $(TARGET_ARCH)
這個板級驅(qū)動已經(jīng)配好了。
106 --instruction-set-variant=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT) \
107 --instruction-set-features=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \
在同樣的位置定義:
604DEX2OAT_TARGET_ARCH := $(TARGET_ARCH)
605ifeq ($(TARGET_CPU_VARIANT),)
606ifeq ($(TARGET_ARCH_VARIANT),)
607DEX2OAT_TARGET_CPU_VARIANT := default
608else
609DEX2OAT_TARGET_CPU_VARIANT := $(TARGET_ARCH_VARIANT)
610endif
611else
612DEX2OAT_TARGET_CPU_VARIANT := $(TARGET_CPU_VARIANT)
613endif
614DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := default
615
其他參數(shù)
108 --include-patch-information --runtime-arg -Xnorelocate --no-generate-debug-info \
109 --abort-on-hard-verifier-error \
110 $(PRIVATE_DEX_PREOPT_FLAGS)
111endef
include-patch-information兼runtime-arg -Xnorelocate暮现,生成重定位的信息还绘,因為后面還要走patchoat呢。
no-generate-debug-info送矩,不生成調(diào)試信息
dex2oat的selinux權(quán)限配置
大家留神啊蚕甥,現(xiàn)在已經(jīng)是selinux的時代了,dex2oat也需要配置相關(guān)的權(quán)限:
# dex2oat
type dex2oat, domain;
type dex2oat_exec, exec_type, file_type;
allow dex2oat dalvikcache_data_file:file write;
# Read symlinks in /data/dalvik-cache
allow dex2oat dalvikcache_data_file:lnk_file read;
allow dex2oat installd:fd use;
# Read already open asec_apk_file file descriptors passed by installd.
# Also allow reading unlabeled files, to allow for upgrading forward
# locked APKs.
allow dex2oat asec_apk_file:file read;
allow dex2oat unlabeled:file read;
allow dex2oat oemfs:file read;
allow dex2oat apk_tmp_file:file read;
這還不算栋荸,在installd的權(quán)限配置/external/sepolicy/installd.te中菇怀,明確設(shè)置了
71# Run dex2oat in its own sandbox.
72domain_auto_trans(installd, dex2oat_exec, dex2oat)
細說dex2oat(2)
生成boot.art和boot.oat
前面講的參數(shù)中,有一項是--boot-image晌块。我們先看一下這個boot-image是如何編出來的爱沟,正好是一個完整的dex2oat的例子.
我們看下在MediaTek MT6753平臺下,是如何生成的匆背。
MT6753是64位Cortex-A53的架構(gòu)呼伸,所以boot.art也是64位和32位兩套。
64位的boot.art
先看64位的吧:
out/host/linux-x86/bin/dex2oat
--runtime-arg -Xms64m
--runtime-arg -Xmx64m
初始堆大小和最大堆大小钝尸。
--image-classes=frameworks/base/preloaded-classes
預加載類的路徑
--dex-file=out/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/javalib.jar --dex-file=out/target/common/obj/JAVA_LIBRARIES/conscrypt_intermediates/javalib.jar
--dex-file=out/target/common/obj/JAVA_LIBRARIES/okhttp_intermediates/javalib.jar
--dex-file=out/target/common/obj/JAVA_LIBRARIES/core-junit_intermediates/javalib.jar --dex-file=out/target/common/obj/JAVA_LIBRARIES/bouncycastle_intermediates/javalib.jar
--dex-file=out/target/common/obj/JAVA_LIBRARIES/ext_intermediates/javalib.jar
--dex-file=out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/javalib.jar
--dex-file=out/target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates/javalib.jar
--dex-file=out/target/common/obj/JAVA_LIBRARIES/voip-common_intermediates/javalib.jar --dex-file=out/target/common/obj/JAVA_LIBRARIES/ims-common_intermediates/javalib.jar --dex-file=out/target/common/obj/JAVA_LIBRARIES/apache-xml_intermediates/javalib.jar --dex-file=out/target/common/obj/JAVA_LIBRARIES/org.apache.http.legacy.boot_intermediates/javalib.jar
--dex-file=out/target/common/obj/JAVA_LIBRARIES/mediatek-common_intermediates/javalib.jar
--dex-file=out/target/common/obj/JAVA_LIBRARIES/mediatek-framework_intermediates/javalib.jar
--dex-file=out/target/common/obj/JAVA_LIBRARIES/mediatek-telephony-common_intermediates/javalib.jar
以上是一大堆的dex文件
--dex-location=/system/framework/core-libart.jar
--dex-location=/system/framework/conscrypt.jar
--dex-location=/system/framework/okhttp.jar
--dex-location=/system/framework/core-junit.jar
--dex-location=/system/framework/bouncycastle.jar
--dex-location=/system/framework/ext.jar
--dex-location=/system/framework/framework.jar
--dex-location=/system/framework/telephony-common.jar
--dex-location=/system/framework/voip-common.jar
--dex-location=/system/framework/ims-common.jar
--dex-location=/system/framework/apache-xml.jar
--dex-location=/system/framework/org.apache.http.legacy.boot.jar
--dex-location=/system/framework/mediatek-common.jar
--dex-location=/system/framework/mediatek-framework.jar
--dex-location=/system/framework/mediatek-telephony-common.jar
以上是上面那一大堆dex對應的jar文件路徑
--oat-symbols=out/target/product/6753_65t_m/symbols/system/framework/arm64/boot.oat
符號表的位置
--oat-file=out/target/product/6753_65t_m/dex_bootjars/system/framework/arm64/boot.oat
--oat-location=/system/framework/arm64/boot.oat
--image=out/target/product/6753_65t_m/dex_bootjars/system/framework/arm64/boot.art
輸出文件有兩個:一個是boot.oat括享,一個是boot.art。
--base=0x70000000
基地址0x70000000
--instruction-set=arm64
--instruction-set-variant=cortex-a53
--instruction-set-features=default
對于指令架構(gòu)珍促,除了arm64铃辖,更細的是cortex-a53
--android-root=out/target/product/6753_65t_m/system
--include-patch-information
--runtime-arg -Xnorelocate
--no-generate-debug-info
最后這幾個前面都說過了。
32位的boot.art
out/host/linux-x86/bin/dex2oat
--runtime-arg -Xms64m
--runtime-arg -Xmx64m
--image-classes=frameworks/base/preloaded-classes
--dex-file=out/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/javalib.jar
--dex-file=out/target/common/obj/JAVA_LIBRARIES/conscrypt_intermediates/javalib.jar
--dex-file=out/target/common/obj/JAVA_LIBRARIES/okhttp_intermediates/javalib.jar
--dex-file=out/target/common/obj/JAVA_LIBRARIES/core-junit_intermediates/javalib.jar --dex-file=out/target/common/obj/JAVA_LIBRARIES/bouncycastle_intermediates/javalib.jar
--dex-file=out/target/common/obj/JAVA_LIBRARIES/ext_intermediates/javalib.jar
--dex-file=out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/javalib.jar
--dex-file=out/target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates/javalib.jar
--dex-file=out/target/common/obj/JAVA_LIBRARIES/voip-common_intermediates/javalib.jar --dex-file=out/target/common/obj/JAVA_LIBRARIES/ims-common_intermediates/javalib.jar --dex-file=out/target/common/obj/JAVA_LIBRARIES/apache-xml_intermediates/javalib.jar --dex-file=out/target/common/obj/JAVA_LIBRARIES/org.apache.http.legacy.boot_intermediates/javalib.jar
--dex-file=out/target/common/obj/JAVA_LIBRARIES/mediatek-common_intermediates/javalib.jar
--dex-file=out/target/common/obj/JAVA_LIBRARIES/mediatek-framework_intermediates/javalib.jar
--dex-file=out/target/common/obj/JAVA_LIBRARIES/mediatek-telephony-common_intermediates/javalib.jar
--dex-location=/system/framework/core-libart.jar
--dex-location=/system/framework/conscrypt.jar
--dex-location=/system/framework/okhttp.jar
--dex-location=/system/framework/core-junit.jar
--dex-location=/system/framework/bouncycastle.jar
--dex-location=/system/framework/ext.jar
--dex-location=/system/framework/framework.jar
--dex-location=/system/framework/telephony-common.jar
--dex-location=/system/framework/voip-common.jar
--dex-location=/system/framework/ims-common.jar
--dex-location=/system/framework/apache-xml.jar
--dex-location=/system/framework/org.apache.http.legacy.boot.jar
--dex-location=/system/framework/mediatek-common.jar
--dex-location=/system/framework/mediatek-framework.jar
--dex-location=/system/framework/mediatek-telephony-common.jar
上面都是java和dex猪叙,所以跟64位沒有什么區(qū)別娇斩。
--oat-symbols=out/target/product/6753_65t_m/symbols/system/framework/arm/boot.oat
--oat-file=out/target/product/6753_65t_m/dex_bootjars/system/framework/arm/boot.oat
--oat-location=/system/framework/arm/boot.oat
--image=out/target/product/6753_65t_m/dex_bootjars/system/framework/arm/boot.art
輸出文件從arm64目錄換到了arm目錄
--base=0x70000000
基地址沒變仁卷,反正patchoat的時候也還要改。
--instruction-set=arm
--instruction-set-variant=cortex-a53
--instruction-set-features=default
指令集從arm64變成了arm犬第,其它的參數(shù)都不變
--android-root=out/target/product/6753_65t_m/system
--include-patch-information
--runtime-arg -Xnorelocate
--no-generate-debug-info
dex2oat編譯應用的例子
out/host/linux-x86/bin/dex2oat
--runtime-arg -Xms64m
--runtime-arg -Xmx512m
這兩個值在前面分析Android.oat.mak時已經(jīng)分析過了锦积,這里驗證了我們的分析是正確的。
--boot-image=out/target/product/6753_65t_m/dex_bootjars/system/framework/boot.art
這個boot.art就是上一節(jié)講的命令剛剛生成的歉嗓。
--dex-file=out/target/product/6753_65t_m/obj/APPS/MusicFX_intermediates/oat/arm64/package.odex.input
--dex-location=/system/app/MusicFX/MusicFX.apk
輸入的dex文件
--oat-file=out/target/product/6753_65t_m/obj/APPS/MusicFX_intermediates/oat/arm64/package.odex
輸出到odex文件丰介,雖然名字叫odex,但是實際上是個oat遥椿。普通的應用就不像上節(jié)講的輸出boot.oat和boot.art的時候那樣輸出那么多了基矮,只有一個odex文件淆储,符號表和image都不用冠场。
--android-root=out/target/product/6753_65t_m/system
--instruction-set=arm64
--instruction-set-variant=cortex-a53
--instruction-set-features=default
--include-patch-information
--runtime-arg -Xnorelocate
--no-generate-debug-info
--abort-on-hard-verifier-error
細說dex2oat(3)
dex2oat是如何在makefile中落地的
在Android的mk系統(tǒng)中,調(diào)用dex2oat中有幾處本砰,但是真正被調(diào)用來生成目標系統(tǒng)上的oat的是下面這個碴裙,位于/build/core/dex_preopt_libart.mk中:
# For a single jar or APK
# $(1): the input .jar or .apk file
# $(2): the output .odex file
define dex2oat-one-file
$(hide) rm -f $(2)
$(hide) mkdir -p $(dir $(2))
$(hide) $(DEX2OAT) \
--runtime-arg -Xms$(DEX2OAT_XMS) --runtime-arg -Xmx$(DEX2OAT_XMX) \
--boot-image=$(PRIVATE_DEX_PREOPT_IMAGE_LOCATION) \
--dex-file=$(1) \
--dex-location=$(PRIVATE_DEX_LOCATION) \
--oat-file=$(2) \
--android-root=$(PRODUCT_OUT)/system \
--instruction-set=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH) \
--instruction-set-variant=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT) \
--instruction-set-features=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \
--include-patch-information --runtime-arg -Xnorelocate --no-generate-debug-info \
--abort-on-hard-verifier-error \
$(PRIVATE_DEX_PREOPT_FLAGS)
endef
這個dex2oat-one-file,是被dexpreopt-one-file調(diào)用点额,位于/build/core/dex_preopt.mk中:
include $(BUILD_SYSTEM)/dex_preopt_libart.mk
# Define dexpreopt-one-file based on current default runtime.
# $(1): the input .jar or .apk file
# $(2): the output .odex file
define dexpreopt-one-file
$(call dex2oat-one-file,$(1),$(2))
endef
以下根據(jù)生成的類型不同舔株,包、庫还棱、預先編譯好的應用有不同的路徑载慈。
Build package中的odex生成
/build/core/package_internal.mk
###############################
## Rule to build the odex file
ifdef LOCAL_DEX_PREOPT
$(built_odex): PRIVATE_DEX_FILE := $(built_dex)
# Use pattern rule - we may have multiple built odex files.
$(built_odex) : $(dir $(LOCAL_BUILT_MODULE))% : $(built_dex)
$(hide) mkdir -p $(dir $@) && rm -f $@
$(add-dex-to-package)
$(hide) mv $@ $@.input
$(call dexpreopt-one-file,$@.input,$@)
$(hide) rm $@.input
endif
Build java library中的odex生成
/build/core/java_library.mk
$(built_odex): PRIVATE_MODULE := $(LOCAL_MODULE)
# Use pattern rule - we may have multiple built odex files.
$(built_odex) : $(dir $(LOCAL_BUILT_MODULE))% : $(common_javalib.jar)
@echo "Dexpreopt Jar: $(PRIVATE_MODULE) ($@)"
$(call dexpreopt-one-file,$<,$@)
Prebuild的odex生成
###############################
## Rule to build the odex file
ifdef LOCAL_DEX_PREOPT
$(built_odex) : $(my_prebuilt_src_file)
$(call dexpreopt-one-file,$<,$@)
endif
install odex
我們再來看看,odex是如何被install到system分區(qū)下面的珍手。
# Use pattern rule - we may have multiple installed odex files.
# Ugly syntax - See the definition get-odex-file-path.
$(installed_odex) : $(dir $(LOCAL_INSTALLED_MODULE))%$(notdir $(word 1,$(installed_odex))) \
: $(dir $(LOCAL_BUILT_MODULE))%$(notdir $(word 1,$(built_odex))) \
| $(ACP)
@echo "Install: $@"
$(copy-file-to-target)
endif
我們看一個實際的例子:
Install: out/target/product/6753_64_m/system/app/Note/oat/arm64/Note.odex
mkdir -p out/target/product/6753_64_m/system/app/Note/oat/arm64/
out/host/linux-x86/bin/acp -fp out/target/product/6753_64_m/obj/APPS/Note_intermediates/oat/arm64/package.odex out/target/product/6753_64_m/system/app/Note/oat/arm64/Note.odex
Install: out/target/product/6753_64_m/system/priv-app/Settings/oat/arm64/Settings.odex
mkdir -p out/target/product/6753_64_m/system/priv-app/Settings/oat/arm64/
out/host/linux-x86/bin/acp -fp out/target/product/6753_64_m/obj/APPS/Settings_intermediates/oat/arm64/package.odex out/target/product/6753_64_m/system/priv-app/Settings/oat/arm64/Settings.odex
definitions.mk中預定義的一些函數(shù)
除了編譯之外办铡,我們得先看一些預先定義好的函數(shù)。它們定義于/build/core/definitions.mk中琳要。
add-dex-to-package
將class文件壓縮成classes*.dex
define add-dex-to-package
$(hide) zip -qj $@ $(dir $(PRIVATE_DEX_FILE))classes*.dex
endef
copy-file-to-target
將依賴文件復制到目標文件
define copy-file-to-target
@mkdir -p $(dir $@)
$(hide) $(ACP) -fp $< $@
endef