Ying Wang | b9aa5d4 | 2014-05-13 13:57:28 -0700 | [diff] [blame] | 1 | # Rules to build boot.art |
| 2 | # Input variables: |
| 3 | # my_2nd_arch_prefix: indicates if this is to build for the 2nd arch. |
| 4 | |
| 5 | # The image "location" is a symbolic path that with multiarchitecture |
| 6 | # support doesn't really exist on the device. Typically it is |
| 7 | # /system/framework/boot.art and should be the same for all supported |
| 8 | # architectures on the device. The concrete architecture specific |
| 9 | # content actually ends up in a "filename" that contains an |
| 10 | # architecture specific directory name such as arm, arm64, mips, |
| 11 | # mips64, x86, x86_64. |
| 12 | # |
| 13 | # Here are some example values for an x86_64 / x86 configuration: |
| 14 | # |
| 15 | # DEFAULT_DEX_PREOPT_BUILT_IMAGE_LOCATION=out/target/product/generic_x86_64/dex_bootjars/system/framework/boot.art |
| 16 | # DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME=out/target/product/generic_x86_64/dex_bootjars/system/framework/x86_64/boot.art |
| 17 | # LIBART_BOOT_IMAGE=/system/framework/x86_64/boot.art |
| 18 | # |
| 19 | # 2ND_DEFAULT_DEX_PREOPT_BUILT_IMAGE_LOCATION=out/target/product/generic_x86_64/dex_bootjars/system/framework/boot.art |
| 20 | # 2ND_DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME=out/target/product/generic_x86_64/dex_bootjars/system/framework/x86/boot.art |
| 21 | # 2ND_LIBART_BOOT_IMAGE=/system/framework/x86/boot.art |
| 22 | |
Ying Wang | b9aa5d4 | 2014-05-13 13:57:28 -0700 | [diff] [blame] | 23 | $(my_2nd_arch_prefix)LIBART_BOOT_IMAGE_FILENAME := /$(DEXPREOPT_BOOT_JAR_DIR)/$($(my_2nd_arch_prefix)DEX2OAT_TARGET_ARCH)/boot.art |
| 24 | |
| 25 | # The .oat with symbols |
| 26 | $(my_2nd_arch_prefix)LIBART_TARGET_BOOT_OAT_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)$(patsubst %.art,%.oat,$($(my_2nd_arch_prefix)LIBART_BOOT_IMAGE_FILENAME)) |
| 27 | |
Ying Wang | b9aa5d4 | 2014-05-13 13:57:28 -0700 | [diff] [blame] | 28 | $(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE := $(PRODUCT_OUT)$($(my_2nd_arch_prefix)LIBART_BOOT_IMAGE_FILENAME) |
Colin Cross | 52dcb2f | 2016-03-08 13:21:49 -0800 | [diff] [blame] | 29 | $(my_2nd_arch_prefix)LIBART_TARGET_BOOT_ART_EXTRA_INSTALLED_FILES := $(addprefix $(dir $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE)),\ |
| 30 | $(LIBART_TARGET_BOOT_ART_EXTRA_FILES)) |
bowen_lai | 4570fdb | 2017-08-16 16:28:05 +0800 | [diff] [blame] | 31 | $(my_2nd_arch_prefix)LIBART_TARGET_BOOT_ART_VDEX_INSTALLED_FILES := $(addprefix $(dir $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE)),\ |
| 32 | $(LIBART_TARGET_BOOT_ART_VDEX_FILES)) |
Ying Wang | b9aa5d4 | 2014-05-13 13:57:28 -0700 | [diff] [blame] | 33 | |
Jeff Hao | b454ee1 | 2017-08-02 16:45:49 -0700 | [diff] [blame] | 34 | # If we have a dirty-image-objects file, create a parameter. |
| 35 | DIRTY_IMAGE_OBJECTS_FLAGS := |
| 36 | ifneq ($(DIRTY_IMAGE_OBJECTS),) |
| 37 | DIRTY_IMAGE_OBJECTS_FLAGS := --dirty-image-objects=$(DIRTY_IMAGE_OBJECTS) |
| 38 | endif |
| 39 | |
Colin Cross | 52dcb2f | 2016-03-08 13:21:49 -0800 | [diff] [blame] | 40 | # The rule to install boot.art |
| 41 | # Depends on installed boot.oat, boot-*.art, boot-*.oat |
bowen_lai | 4570fdb | 2017-08-16 16:28:05 +0800 | [diff] [blame] | 42 | $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE) : $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) | $(ACP) $($(my_2nd_arch_prefix)LIBART_TARGET_BOOT_ART_EXTRA_INSTALLED_FILES) $($(my_2nd_arch_prefix)LIBART_TARGET_BOOT_ART_VDEX_INSTALLED_SHARED_FILES) |
Colin Cross | 52dcb2f | 2016-03-08 13:21:49 -0800 | [diff] [blame] | 43 | @echo "Install: $@" |
| 44 | $(copy-file-to-target) |
| 45 | |
| 46 | # The rule to install boot.oat, boot-*.art, boot-*.oat |
| 47 | # Depends on built-but-not-installed boot.art |
| 48 | $($(my_2nd_arch_prefix)LIBART_TARGET_BOOT_ART_EXTRA_INSTALLED_FILES) : $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) | $(ACP) |
| 49 | @echo "Install: $@" |
| 50 | @mkdir -p $(dir $@) |
| 51 | $(hide) $(ACP) -fp $(dir $<)$(notdir $@) $@ |
Ying Wang | b9aa5d4 | 2014-05-13 13:57:28 -0700 | [diff] [blame] | 52 | |
Mathieu Chartier | a61acf6 | 2017-06-28 18:23:37 -0700 | [diff] [blame] | 53 | ifeq (,$(my_out_boot_image_profile_location)) |
Andreas Gampe | 35ab420 | 2018-04-13 11:38:14 -0700 | [diff] [blame] | 54 | my_boot_image_flags := --image-classes=$(PRELOADED_CLASSES) |
Mathieu Chartier | a61acf6 | 2017-06-28 18:23:37 -0700 | [diff] [blame] | 55 | else |
| 56 | my_boot_image_flags := --compiler-filter=speed-profile |
| 57 | my_boot_image_flags += --profile-file=$(my_out_boot_image_profile_location) |
| 58 | endif |
Mathieu Chartier | 399a6d8 | 2018-05-07 11:50:00 -0700 | [diff] [blame] | 59 | my_boot_image_flags += $(DIRTY_IMAGE_OBJECTS_FLAGS) |
Mathieu Chartier | a61acf6 | 2017-06-28 18:23:37 -0700 | [diff] [blame] | 60 | |
Andreas Gampe | 4ed21d1 | 2017-06-16 10:24:54 -0700 | [diff] [blame] | 61 | ifneq (addresstrue,$(SANITIZE_TARGET)$(SANITIZE_LITE)) |
| 62 | # Skip recompiling the boot image for the second sanitization phase. We'll get separate paths |
| 63 | # and invalidate first-stage artifacts which are crucial to SANITIZE_LITE builds. |
| 64 | # Note: this is technically incorrect. Compiled code contains stack checks which may depend |
| 65 | # on ASAN settings. |
| 66 | |
Andreas Gampe | fc2fefc | 2018-02-28 17:54:10 -0800 | [diff] [blame] | 67 | # Use ANDROID_LOG_TAGS to suppress most logging by default... |
| 68 | ifeq (,$(ART_BOOT_IMAGE_EXTRA_ARGS)) |
| 69 | DEX2OAT_BOOT_IMAGE_LOG_TAGS := ANDROID_LOG_TAGS="*:e" |
| 70 | else |
| 71 | # ...unless the boot image is generated specifically for testing, then allow all logging. |
| 72 | DEX2OAT_BOOT_IMAGE_LOG_TAGS := ANDROID_LOG_TAGS="*:v" |
| 73 | endif |
| 74 | |
Andreas Gampe | 5147749 | 2018-02-27 20:17:18 -0800 | [diff] [blame] | 75 | # An additional message to print on dex2oat failure. |
| 76 | DEX2OAT_FAILURE_MESSAGE := ERROR: Dex2oat failed to compile a boot image. |
| 77 | DEX2OAT_FAILURE_MESSAGE += It is likely that the boot classpath is inconsistent. |
| 78 | ifeq ($(ONE_SHOT_MAKEFILE),) |
| 79 | DEX2OAT_FAILURE_MESSAGE += Rebuild with ART_BOOT_IMAGE_EXTRA_ARGS="--runtime-arg -verbose:verifier" to see verification errors. |
| 80 | else |
| 81 | DEX2OAT_FAILURE_MESSAGE += Build with m, mma, or mmma instead of mm or mmm to remedy the situation. |
| 82 | endif |
| 83 | |
Mathieu Chartier | a61acf6 | 2017-06-28 18:23:37 -0700 | [diff] [blame] | 84 | $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME): PRIVATE_BOOT_IMAGE_FLAGS := $(my_boot_image_flags) |
Ying Wang | b9aa5d4 | 2014-05-13 13:57:28 -0700 | [diff] [blame] | 85 | $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME): PRIVATE_2ND_ARCH_VAR_PREFIX := $(my_2nd_arch_prefix) |
| 86 | # Use dex2oat debug version for better error reporting |
Colin Cross | 3ec2c61 | 2018-11-26 13:29:32 -0800 | [diff] [blame] | 87 | # Pass --avoid-storing-invocation to make the output deterministics between |
| 88 | # different products that may have different paths on the command line. |
Vladimir Marko | e47795b | 2018-09-26 12:57:21 +0100 | [diff] [blame] | 89 | $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) : $(LIBART_TARGET_BOOT_DEX_FILES) $(PRELOADED_CLASSES) $(DIRTY_IMAGE_OBJECTS) $(DEX2OAT_DEPENDENCY) $(my_out_boot_image_profile_location) |
Shinichiro Hamaji | 9cb7692 | 2015-12-18 15:50:10 +0900 | [diff] [blame] | 90 | @echo "target dex2oat: $@" |
Ying Wang | b9aa5d4 | 2014-05-13 13:57:28 -0700 | [diff] [blame] | 91 | @mkdir -p $(dir $@) |
| 92 | @mkdir -p $(dir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED)) |
Alex Light | 2c108e0 | 2018-12-18 14:16:45 -0800 | [diff] [blame] | 93 | @rm -f $(dir $@)/*.art $(dir $@)/*.oat $(dir $@)/*.invocation |
Jeff Hao | d1d3fd9 | 2015-12-16 17:20:11 -0800 | [diff] [blame] | 94 | @rm -f $(dir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED))/*.art |
| 95 | @rm -f $(dir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED))/*.oat |
Alex Light | 2c108e0 | 2018-12-18 14:16:45 -0800 | [diff] [blame] | 96 | @rm -f $(dir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED))/*.invocation |
Andreas Gampe | fc2fefc | 2018-02-28 17:54:10 -0800 | [diff] [blame] | 97 | $(hide) $(DEX2OAT_BOOT_IMAGE_LOG_TAGS) $(DEX2OAT) --runtime-arg -Xms$(DEX2OAT_IMAGE_XMS) \ |
Colin Cross | 3ec2c61 | 2018-11-26 13:29:32 -0800 | [diff] [blame] | 98 | --avoid-storing-invocation \ |
Alex Light | 2c108e0 | 2018-12-18 14:16:45 -0800 | [diff] [blame] | 99 | --write-invocation-to=$(patsubst %.art,%.invocation,$@) \ |
Joe Onorato | 632db64 | 2016-03-17 10:12:36 -0700 | [diff] [blame] | 100 | --runtime-arg -Xmx$(DEX2OAT_IMAGE_XMX) \ |
Mathieu Chartier | a61acf6 | 2017-06-28 18:23:37 -0700 | [diff] [blame] | 101 | $(PRIVATE_BOOT_IMAGE_FLAGS) \ |
Ying Wang | b9aa5d4 | 2014-05-13 13:57:28 -0700 | [diff] [blame] | 102 | $(addprefix --dex-file=,$(LIBART_TARGET_BOOT_DEX_FILES)) \ |
| 103 | $(addprefix --dex-location=,$(LIBART_TARGET_BOOT_DEX_LOCATIONS)) \ |
David Srbecky | a21fdb5 | 2018-07-17 12:42:32 +0100 | [diff] [blame] | 104 | --generate-debug-info --generate-build-id \ |
Ying Wang | b9aa5d4 | 2014-05-13 13:57:28 -0700 | [diff] [blame] | 105 | --oat-symbols=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED) \ |
David Srbecky | a21fdb5 | 2018-07-17 12:42:32 +0100 | [diff] [blame] | 106 | --strip \ |
Ying Wang | b9aa5d4 | 2014-05-13 13:57:28 -0700 | [diff] [blame] | 107 | --oat-file=$(patsubst %.art,%.oat,$@) \ |
| 108 | --oat-location=$(patsubst %.art,%.oat,$($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_BOOT_IMAGE_FILENAME)) \ |
| 109 | --image=$@ --base=$(LIBART_IMG_TARGET_BASE_ADDRESS) \ |
| 110 | --instruction-set=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH) \ |
Ian Rogers | a18a283 | 2014-10-17 01:05:50 -0700 | [diff] [blame] | 111 | --instruction-set-variant=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT) \ |
Ying Wang | b9aa5d4 | 2014-05-13 13:57:28 -0700 | [diff] [blame] | 112 | --instruction-set-features=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \ |
Richard Uhler | c30981e | 2016-12-05 11:47:02 +0000 | [diff] [blame] | 113 | --android-root=$(PRODUCT_OUT)/system \ |
Vladimir Marko | 0aea49c | 2018-10-10 16:45:11 +0100 | [diff] [blame] | 114 | --no-inline-from=core-oj.jar \ |
Andreas Gampe | 5ccf090 | 2017-11-22 14:08:22 -0800 | [diff] [blame] | 115 | --abort-on-hard-verifier-error \ |
Colin Cross | 6db5b0e | 2018-11-16 21:26:33 -0800 | [diff] [blame] | 116 | $(PRODUCT_DEX_PREOPT_BOOT_FLAGS) $(ART_BOOT_IMAGE_EXTRA_ARGS) \ |
Vladimir Marko | e47795b | 2018-09-26 12:57:21 +0100 | [diff] [blame] | 117 | || ( echo "$(DEX2OAT_FAILURE_MESSAGE)" ; false ) |
Andreas Gampe | 4ed21d1 | 2017-06-16 10:24:54 -0700 | [diff] [blame] | 118 | |
| 119 | endif |