Brian Carlstrom | ced4bff | 2013-11-14 23:44:56 -0800 | [diff] [blame] | 1 | #################################### |
| 2 | # dexpreopt support for ART |
| 3 | # |
| 4 | #################################### |
| 5 | |
Brian Carlstrom | ced4bff | 2013-11-14 23:44:56 -0800 | [diff] [blame] | 6 | ######################################################################## |
| 7 | # The full system boot classpath |
| 8 | |
Neil Fuller | 9fb7017 | 2018-08-28 13:18:25 +0100 | [diff] [blame] | 9 | LIBART_TARGET_BOOT_JARS := $(DEXPREOPT_BOOT_JARS_MODULES) |
Brian Carlstrom | ced4bff | 2013-11-14 23:44:56 -0800 | [diff] [blame] | 10 | LIBART_TARGET_BOOT_DEX_LOCATIONS := $(foreach jar,$(LIBART_TARGET_BOOT_JARS),/$(DEXPREOPT_BOOT_JAR_DIR)/$(jar).jar) |
| 11 | LIBART_TARGET_BOOT_DEX_FILES := $(foreach jar,$(LIBART_TARGET_BOOT_JARS),$(call intermediates-dir-for,JAVA_LIBRARIES,$(jar),,COMMON)/javalib.jar) |
| 12 | |
Colin Cross | 52dcb2f | 2016-03-08 13:21:49 -0800 | [diff] [blame] | 13 | # dex preopt on the bootclasspath produces multiple files. The first dex file |
| 14 | # is converted into to boot.art (to match the legacy assumption that boot.art |
| 15 | # exists), and the rest are converted to boot-<name>.art. |
| 16 | # In addition, each .art file has an associated .oat file. |
Vladimir Marko | e47795b | 2018-09-26 12:57:21 +0100 | [diff] [blame] | 17 | LIBART_TARGET_BOOT_ART_EXTRA_FILES := $(foreach jar,$(wordlist 2,999,$(LIBART_TARGET_BOOT_JARS)),boot-$(jar).art boot-$(jar).oat) |
| 18 | LIBART_TARGET_BOOT_ART_EXTRA_FILES += boot.oat |
bowen_lai | 4570fdb | 2017-08-16 16:28:05 +0800 | [diff] [blame] | 19 | LIBART_TARGET_BOOT_ART_VDEX_FILES := $(foreach jar,$(wordlist 2,999,$(LIBART_TARGET_BOOT_JARS)),boot-$(jar).vdex) |
| 20 | LIBART_TARGET_BOOT_ART_VDEX_FILES += boot.vdex |
Colin Cross | 52dcb2f | 2016-03-08 13:21:49 -0800 | [diff] [blame] | 21 | |
Mathieu Chartier | a61acf6 | 2017-06-28 18:23:37 -0700 | [diff] [blame] | 22 | # If we use a boot image profile. |
| 23 | my_use_profile_for_boot_image := $(PRODUCT_USE_PROFILE_FOR_BOOT_IMAGE) |
| 24 | ifeq (,$(my_use_profile_for_boot_image)) |
Mathieu Chartier | 8fd29b3 | 2017-10-24 15:22:57 -0700 | [diff] [blame] | 25 | # If not set, set the default to true if we are not a PDK build. PDK builds |
| 26 | # can't build the profile since they don't have frameworks/base. |
| 27 | ifneq (true,$(TARGET_BUILD_PDK)) |
Mathieu Chartier | ce94494 | 2017-08-28 18:42:02 -0700 | [diff] [blame] | 28 | my_use_profile_for_boot_image := true |
Mathieu Chartier | a61acf6 | 2017-06-28 18:23:37 -0700 | [diff] [blame] | 29 | endif |
Mathieu Chartier | 8fd29b3 | 2017-10-24 15:22:57 -0700 | [diff] [blame] | 30 | endif |
Dan Willemsen | 406418d | 2018-06-19 23:03:34 -0700 | [diff] [blame] | 31 | ifeq (,$(strip $(LIBART_TARGET_BOOT_DEX_FILES))) |
| 32 | my_use_profile_for_boot_image := false |
| 33 | endif |
Mathieu Chartier | a61acf6 | 2017-06-28 18:23:37 -0700 | [diff] [blame] | 34 | |
| 35 | ifeq (true,$(my_use_profile_for_boot_image)) |
| 36 | |
Shibin George | 9dd9e68 | 2018-07-02 16:21:49 +0530 | [diff] [blame] | 37 | boot_image_profiles := $(PRODUCT_DEX_PREOPT_BOOT_IMAGE_PROFILE_LOCATION) |
| 38 | |
| 39 | ifeq (,$(boot_image_profiles)) |
Mathieu Chartier | a61acf6 | 2017-06-28 18:23:37 -0700 | [diff] [blame] | 40 | # If not set, use the default. |
Shibin George | 9dd9e68 | 2018-07-02 16:21:49 +0530 | [diff] [blame] | 41 | boot_image_profiles := frameworks/base/config/boot-image-profile.txt |
Mathieu Chartier | a61acf6 | 2017-06-28 18:23:37 -0700 | [diff] [blame] | 42 | endif |
| 43 | |
Shibin George | 9dd9e68 | 2018-07-02 16:21:49 +0530 | [diff] [blame] | 44 | # Location of text based profile for the boot image. |
| 45 | my_boot_image_profile_location := $(PRODUCT_OUT)/dex_bootjars/boot-image-profile.txt |
| 46 | |
| 47 | $(my_boot_image_profile_location): $(boot_image_profiles) |
| 48 | @echo 'Generating $@ for profman' |
| 49 | @rm -rf $@ |
| 50 | $(hide) cat $^ > $@ |
| 51 | |
Mathieu Chartier | a61acf6 | 2017-06-28 18:23:37 -0700 | [diff] [blame] | 52 | # Code to create the boot image profile, not in dex_preopt_libart_boot.mk since the profile is the same for all archs. |
| 53 | my_out_boot_image_profile_location := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/boot.prof |
| 54 | $(my_out_boot_image_profile_location): PRIVATE_PROFILE_INPUT_LOCATION := $(my_boot_image_profile_location) |
| 55 | $(my_out_boot_image_profile_location): $(PROFMAN) $(LIBART_TARGET_BOOT_DEX_FILES) $(my_boot_image_profile_location) |
| 56 | @echo "target profman: $@" |
| 57 | @mkdir -p $(dir $@) |
| 58 | ANDROID_LOG_TAGS="*:e" $(PROFMAN) \ |
| 59 | --create-profile-from=$(PRIVATE_PROFILE_INPUT_LOCATION) \ |
| 60 | $(addprefix --apk=,$(LIBART_TARGET_BOOT_DEX_FILES)) \ |
| 61 | $(addprefix --dex-location=,$(LIBART_TARGET_BOOT_DEX_LOCATIONS)) \ |
| 62 | --reference-profile-file=$@ |
| 63 | |
| 64 | # We want to install the profile even if we are not using preopt since it is required to generate |
| 65 | # the image on the device. |
| 66 | my_installed_profile := $(TARGET_OUT)/etc/boot-image.prof |
| 67 | $(eval $(call copy-one-file,$(my_out_boot_image_profile_location),$(my_installed_profile))) |
| 68 | ALL_DEFAULT_INSTALLED_MODULES += $(my_installed_profile) |
| 69 | |
| 70 | endif |
| 71 | |
bowen_lai | 4570fdb | 2017-08-16 16:28:05 +0800 | [diff] [blame] | 72 | LIBART_TARGET_BOOT_ART_VDEX_INSTALLED_SHARED_FILES := $(addprefix $(PRODUCT_OUT)/$(DEXPREOPT_BOOT_JAR_DIR)/,$(LIBART_TARGET_BOOT_ART_VDEX_FILES)) |
| 73 | |
Ying Wang | b9aa5d4 | 2014-05-13 13:57:28 -0700 | [diff] [blame] | 74 | my_2nd_arch_prefix := |
| 75 | include $(BUILD_SYSTEM)/dex_preopt_libart_boot.mk |
Brian Carlstrom | ced4bff | 2013-11-14 23:44:56 -0800 | [diff] [blame] | 76 | |
Ying Wang | 87538e4 | 2016-03-16 19:53:19 -0700 | [diff] [blame] | 77 | ifneq ($(TARGET_TRANSLATE_2ND_ARCH),true) |
Ying Wang | b9aa5d4 | 2014-05-13 13:57:28 -0700 | [diff] [blame] | 78 | ifdef TARGET_2ND_ARCH |
| 79 | my_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX) |
| 80 | include $(BUILD_SYSTEM)/dex_preopt_libart_boot.mk |
Ying Wang | b9aa5d4 | 2014-05-13 13:57:28 -0700 | [diff] [blame] | 81 | endif |
Ying Wang | 87538e4 | 2016-03-16 19:53:19 -0700 | [diff] [blame] | 82 | endif |
Brian Carlstrom | ced4bff | 2013-11-14 23:44:56 -0800 | [diff] [blame] | 83 | |
bowen_lai | 4570fdb | 2017-08-16 16:28:05 +0800 | [diff] [blame] | 84 | # Copy shared vdex to the directory and create corresponding symlinks in primary and secondary arch. |
| 85 | $(LIBART_TARGET_BOOT_ART_VDEX_INSTALLED_SHARED_FILES) : PRIMARY_ARCH_DIR := $(dir $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE)) |
| 86 | $(LIBART_TARGET_BOOT_ART_VDEX_INSTALLED_SHARED_FILES) : SECOND_ARCH_DIR := $(dir $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE)) |
| 87 | $(LIBART_TARGET_BOOT_ART_VDEX_INSTALLED_SHARED_FILES) : $(DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) |
| 88 | @echo "Install: $@" |
| 89 | @mkdir -p $(dir $@) |
| 90 | @rm -f $@ |
| 91 | $(hide) cp "$(dir $<)$(notdir $@)" "$@" |
| 92 | # Make symlink for both the archs. In the case its single arch the symlink will just get overridden. |
| 93 | @mkdir -p $(PRIMARY_ARCH_DIR) |
| 94 | $(hide) ln -sf /$(DEXPREOPT_BOOT_JAR_DIR)/$(notdir $@) $(PRIMARY_ARCH_DIR)$(notdir $@) |
| 95 | @mkdir -p $(SECOND_ARCH_DIR) |
| 96 | $(hide) ln -sf /$(DEXPREOPT_BOOT_JAR_DIR)/$(notdir $@) $(SECOND_ARCH_DIR)$(notdir $@) |
| 97 | |
| 98 | my_2nd_arch_prefix := |