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