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 32# Compile boot.oat as position-independent code if WITH_DEXPREOPT_PIC=true 33ifeq (true,$(WITH_DEXPREOPT_PIC)) 34 PRODUCT_DEX_PREOPT_BOOT_FLAGS += --compile-pic 35endif 36 37# If we have a compiled-classes file, create a parameter. 38COMPILED_CLASSES_FLAGS := 39ifneq ($(COMPILED_CLASSES),) 40 COMPILED_CLASSES_FLAGS := --compiled-classes=$(COMPILED_CLASSES) 41endif 42 43# The rule to install boot.art and boot.oat 44$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE) : $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) | $(ACP) 45 $(call copy-file-to-target) 46 $(hide) $(ACP) -fp $(patsubst %.art,%.oat,$<) $(patsubst %.art,%.oat,$@) 47 48$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME): PRIVATE_2ND_ARCH_VAR_PREFIX := $(my_2nd_arch_prefix) 49# Use dex2oat debug version for better error reporting 50$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) : $(LIBART_TARGET_BOOT_DEX_FILES) $(DEX2OAT_DEPENDENCY) 51 @echo "target dex2oat: $@ ($?)" 52 @mkdir -p $(dir $@) 53 @mkdir -p $(dir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED)) 54 $(hide) $(DEX2OAT) --runtime-arg -Xms$(DEX2OAT_IMAGE_XMS) --runtime-arg -Xmx$(DEX2OAT_IMAGE_XMX) \ 55 --image-classes=$(PRELOADED_CLASSES) \ 56 $(addprefix --dex-file=,$(LIBART_TARGET_BOOT_DEX_FILES)) \ 57 $(addprefix --dex-location=,$(LIBART_TARGET_BOOT_DEX_LOCATIONS)) \ 58 --oat-symbols=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED) \ 59 --oat-file=$(patsubst %.art,%.oat,$@) \ 60 --oat-location=$(patsubst %.art,%.oat,$($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_BOOT_IMAGE_FILENAME)) \ 61 --image=$@ --base=$(LIBART_IMG_TARGET_BASE_ADDRESS) \ 62 --instruction-set=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH) \ 63 --instruction-set-variant=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT) \ 64 --instruction-set-features=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \ 65 --android-root=$(PRODUCT_OUT)/system --include-patch-information --runtime-arg -Xnorelocate --no-generate-debug-info \ 66 $(PRODUCT_DEX_PREOPT_BOOT_FLAGS) $(COMPILED_CLASSES_FLAGS) 67