• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
35COMPILED_CLASSES_FLAGS :=
36ifneq ($(COMPILED_CLASSES),)
37  COMPILED_CLASSES_FLAGS := --compiled-classes=$(COMPILED_CLASSES)
38endif
39
40# If we have a dirty-image-objects file, create a parameter.
41DIRTY_IMAGE_OBJECTS_FLAGS :=
42ifneq ($(DIRTY_IMAGE_OBJECTS),)
43  DIRTY_IMAGE_OBJECTS_FLAGS := --dirty-image-objects=$(DIRTY_IMAGE_OBJECTS)
44endif
45
46# The rule to install boot.art
47# Depends on installed boot.oat, boot-*.art, boot-*.oat
48$($(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)
49	@echo "Install: $@"
50	$(copy-file-to-target)
51
52# The rule to install boot.oat, boot-*.art, boot-*.oat
53# Depends on built-but-not-installed boot.art
54$($(my_2nd_arch_prefix)LIBART_TARGET_BOOT_ART_EXTRA_INSTALLED_FILES) : $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME)  | $(ACP)
55	@echo "Install: $@"
56	@mkdir -p $(dir $@)
57	$(hide) $(ACP) -fp $(dir $<)$(notdir $@) $@
58
59ifeq (,$(my_out_boot_image_profile_location))
60my_boot_image_flags := $(COMPILED_CLASSES_FLAGS)
61my_boot_image_flags += --image-classes=$(PRELOADED_CLASSES)
62my_boot_image_flags += $(DIRTY_IMAGE_OBJECTS_FLAGS)
63else
64my_boot_image_flags := --compiler-filter=speed-profile
65my_boot_image_flags += --profile-file=$(my_out_boot_image_profile_location)
66endif
67
68$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME): PRIVATE_BOOT_IMAGE_FLAGS := $(my_boot_image_flags)
69$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME): PRIVATE_2ND_ARCH_VAR_PREFIX := $(my_2nd_arch_prefix)
70# Use dex2oat debug version for better error reporting
71$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) : $(LIBART_TARGET_BOOT_DEX_FILES) $(PRELOADED_CLASSES) $(COMPILED_CLASSES) $(DIRTY_IMAGE_OBJECTS) $(DEX2OAT_DEPENDENCY) $(my_out_boot_image_profile_location)
72	@echo "target dex2oat: $@"
73	@mkdir -p $(dir $@)
74	@mkdir -p $(dir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED))
75	@rm -f $(dir $@)/*.art $(dir $@)/*.oat
76	@rm -f $(dir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED))/*.art
77	@rm -f $(dir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED))/*.oat
78	$(DEX2OAT) --runtime-arg -Xms$(DEX2OAT_IMAGE_XMS) \
79		--runtime-arg -Xmx$(DEX2OAT_IMAGE_XMX) \
80		$(PRIVATE_BOOT_IMAGE_FLAGS) \
81		$(addprefix --dex-file=,$(LIBART_TARGET_BOOT_DEX_FILES)) \
82		$(addprefix --dex-location=,$(LIBART_TARGET_BOOT_DEX_LOCATIONS)) \
83		--oat-symbols=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED) \
84		--oat-file=$(patsubst %.art,%.oat,$@) \
85		--oat-location=$(patsubst %.art,%.oat,$($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_BOOT_IMAGE_FILENAME)) \
86		--image=$@ --base=$(LIBART_IMG_TARGET_BASE_ADDRESS) \
87		--instruction-set=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH) \
88		--instruction-set-variant=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT) \
89		--instruction-set-features=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \
90		--android-root=$(PRODUCT_OUT)/system \
91		--runtime-arg -Xnorelocate --compile-pic \
92		--no-generate-debug-info --generate-build-id \
93		--multi-image --no-inline-from=core-oj.jar \
94		$(PRODUCT_DEX_PREOPT_BOOT_FLAGS) $(GLOBAL_DEXPREOPT_FLAGS) $(ART_BOOT_IMAGE_EXTRA_ARGS)
95