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 23 $(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_LOCATION := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/boot.art 24 $(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$($(my_2nd_arch_prefix)DEX2OAT_TARGET_ARCH)/boot.art 25 $(my_2nd_arch_prefix)LIBART_BOOT_IMAGE_FILENAME := /$(DEXPREOPT_BOOT_JAR_DIR)/$($(my_2nd_arch_prefix)DEX2OAT_TARGET_ARCH)/boot.art 26 27 # The .oat with symbols 28 $(my_2nd_arch_prefix)LIBART_TARGET_BOOT_OAT_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)$(patsubst %.art,%.oat,$($(my_2nd_arch_prefix)LIBART_BOOT_IMAGE_FILENAME)) 29 30 $(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE := $(PRODUCT_OUT)$($(my_2nd_arch_prefix)LIBART_BOOT_IMAGE_FILENAME) 31 $(my_2nd_arch_prefix)LIBART_TARGET_BOOT_ART_EXTRA_INSTALLED_FILES := $(addprefix $(dir $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE)),\ 32 $(LIBART_TARGET_BOOT_ART_EXTRA_FILES)) 33 34 # If we have a compiled-classes file, create a parameter. 35 COMPILED_CLASSES_FLAGS := 36 ifneq ($(COMPILED_CLASSES),) 37 COMPILED_CLASSES_FLAGS := --compiled-classes=$(COMPILED_CLASSES) 38 endif 39 40 # The rule to install boot.art 41 # Depends on installed boot.oat, boot-*.art, boot-*.oat 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) 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 $@) $@ 52 53 $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME): PRIVATE_2ND_ARCH_VAR_PREFIX := $(my_2nd_arch_prefix) 54 # Use dex2oat debug version for better error reporting 55 $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) : $(LIBART_TARGET_BOOT_DEX_FILES) $(PRELOADED_CLASSES) $(COMPILED_CLASSES) $(DEX2OAT_DEPENDENCY) 56 @echo "target dex2oat: $@" 57 @mkdir -p $(dir $@) 58 @mkdir -p $(dir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED)) 59 @rm -f $(dir $@)/*.art $(dir $@)/*.oat 60 @rm -f $(dir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED))/*.art 61 @rm -f $(dir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED))/*.oat 62 $(hide) ANDROID_LOG_TAGS="*:e" $(DEX2OAT) --runtime-arg -Xms$(DEX2OAT_IMAGE_XMS) \ 63 --runtime-arg -Xmx$(DEX2OAT_IMAGE_XMX) \ 64 --image-classes=$(PRELOADED_CLASSES) \ 65 $(addprefix --dex-file=,$(LIBART_TARGET_BOOT_DEX_FILES)) \ 66 $(addprefix --dex-location=,$(LIBART_TARGET_BOOT_DEX_LOCATIONS)) \ 67 --oat-symbols=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED) \ 68 --oat-file=$(patsubst %.art,%.oat,$@) \ 69 --oat-location=$(patsubst %.art,%.oat,$($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_BOOT_IMAGE_FILENAME)) \ 70 --image=$@ --base=$(LIBART_IMG_TARGET_BASE_ADDRESS) \ 71 --instruction-set=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH) \ 72 --instruction-set-variant=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT) \ 73 --instruction-set-features=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \ 74 --android-root=$(PRODUCT_OUT)/system \ 75 --runtime-arg -Xnorelocate --compile-pic \ 76 --no-generate-debug-info --generate-build-id \ 77 --multi-image --no-inline-from=core-oj.jar \ 78 $(PRODUCT_DEX_PREOPT_BOOT_FLAGS) $(GLOBAL_DEXPREOPT_FLAGS) $(COMPILED_CLASSES_FLAGS) $(ART_BOOT_IMAGE_EXTRA_ARGS) 79