From 269bc741a5507cb4acd36ac1f76aa32b9400900e Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Fri, 22 Feb 2019 15:33:23 +0000 Subject: [PATCH] Support for install multiple boot images. Bug: 119800099 Test: m && /system/framework/arm/apex*.art files exist Change-Id: I78023f1086446c2c44ff6b282993537b053c0588 --- core/dex_preopt.mk | 5 ++++- core/dex_preopt_config.mk | 1 + core/dex_preopt_libart.mk | 6 ++++-- core/dex_preopt_libart_boot.mk | 10 ++++++---- core/dex_preopt_odex_install.mk | 8 ++++---- 5 files changed, 19 insertions(+), 11 deletions(-) diff --git a/core/dex_preopt.mk b/core/dex_preopt.mk index 5a32ee9bb..d43158ef2 100644 --- a/core/dex_preopt.mk +++ b/core/dex_preopt.mk @@ -13,7 +13,10 @@ else install-on-system-other = $(filter-out $(PRODUCT_DEXPREOPT_SPEED_APPS) $(PRODUCT_SYSTEM_SERVER_APPS),$(basename $(notdir $(filter $(foreach f,$(SYSTEM_OTHER_ODEX_FILTER),$(TARGET_OUT)/$(f)),$(1))))) endif -include $(BUILD_SYSTEM)/dex_preopt_libart.mk +# Install boot images. Note that there can be multiple. +DEFAULT_DEX_PREOPT_INSTALLED_IMAGE := +$(TARGET_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE := +$(foreach my_boot_image_name,$(DEXPREOPT_IMAGE_NAMES),$(eval include $(BUILD_SYSTEM)/dex_preopt_libart.mk)) boot_profile_jars_zip := $(PRODUCT_OUT)/boot_profile_jars.zip bootclasspath_jars := $(DEXPREOPT_BOOTCLASSPATH_DEX_FILES) diff --git a/core/dex_preopt_config.mk b/core/dex_preopt_config.mk index 72d3345a8..9bf2be866 100644 --- a/core/dex_preopt_config.mk +++ b/core/dex_preopt_config.mk @@ -91,6 +91,7 @@ ifeq ($(WRITE_SOONG_VARIABLES),true) $(call add_json_bool, DisablePreopt, $(call invert_bool,$(filter true,$(WITH_DEXPREOPT)))) $(call add_json_list, DisablePreoptModules, $(DEXPREOPT_DISABLED_MODULES)) $(call add_json_bool, OnlyPreoptBootImageAndSystemServer, $(filter true,$(WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY))) + $(call add_json_bool, GenerateApexImage, $(filter true,$(DEXPREOPT_GENERATE_APEX_IMAGE))) $(call add_json_bool, DontUncompressPrivAppsDex, $(filter true,$(DONT_UNCOMPRESS_PRIV_APPS_DEXS))) $(call add_json_list, ModulesLoadedByPrivilegedModules, $(PRODUCT_LOADED_BY_PRIVILEGED_MODULES)) $(call add_json_bool, HasSystemOther, $(BOARD_USES_SYSTEM_OTHER_ODEX)) diff --git a/core/dex_preopt_libart.mk b/core/dex_preopt_libart.mk index 2bfe881e8..edd82df58 100644 --- a/core/dex_preopt_libart.mk +++ b/core/dex_preopt_libart.mk @@ -1,5 +1,7 @@ #################################### -# dexpreopt support for ART +# ART boot image installation +# Input variable: +# my_boot_image_name: the boot image to install # #################################### @@ -10,7 +12,7 @@ ALL_DEFAULT_INSTALLED_MODULES += $(my_installed) # Install primary arch vdex files into a shared location, and then symlink them to both the primary # and secondary arch directories. -my_vdex_copy_pairs := $(DEXPREOPT_IMAGE_VDEX_BUILT_INSTALLED_$(TARGET_ARCH)) +my_vdex_copy_pairs := $(DEXPREOPT_IMAGE_VDEX_BUILT_INSTALLED_$(my_boot_image_name)_$(TARGET_ARCH)) my_installed := $(foreach v,$(my_vdex_copy_pairs),$(PRODUCT_OUT)$(call word-colon,2,$(v))) $(firstword $(my_installed)): $(wordlist 2,9999,$(my_installed)) diff --git a/core/dex_preopt_libart_boot.mk b/core/dex_preopt_libart_boot.mk index ec9aad7a5..34b852658 100644 --- a/core/dex_preopt_libart_boot.mk +++ b/core/dex_preopt_libart_boot.mk @@ -1,19 +1,21 @@ -# Rules to install boot.art built by dexpreopt_bootjars.go +# Rules to install a boot image built by dexpreopt_bootjars.go # Input variables: +# my_boot_image_name: the boot image to install # my_2nd_arch_prefix: indicates if this is to build for the 2nd arch. # my_dexpreopt_image_extra_deps: extra dependencies to add on the installed boot.art # Install the boot images compiled by Soong # The first file (generally boot.art) is saved as DEFAULT_DEX_PREOPT_INSTALLED_IMAGE, # and the rest are added as dependencies of the first. -my_installed := $(call copy-many-files,$(DEXPREOPT_IMAGE_BUILT_INSTALLED_$(TARGET_$(my_2nd_arch_prefix)ARCH)),$(PRODUCT_OUT)) + +my_installed := $(call copy-many-files,$(DEXPREOPT_IMAGE_BUILT_INSTALLED_$(my_boot_image_name)_$(TARGET_$(my_2nd_arch_prefix)ARCH)),$(PRODUCT_OUT)) $(firstword $(my_installed)): $(wordlist 2,9999,$(my_installed)) -$(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE := $(firstword $(my_installed)) +$(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE += $(firstword $(my_installed)) # Install the unstripped boot images compiled by Soong into the symbols directory # The first file (generally boot.art) made a dependency of DEFAULT_DEX_PREOPT_INSTALLED_IMAGE, # and the rest are added as dependencies of the first. -my_installed := $(call copy-many-files,$(DEXPREOPT_IMAGE_UNSTRIPPED_BUILT_INSTALLED_$(TARGET_$(my_2nd_arch_prefix)ARCH)),$(TARGET_OUT_UNSTRIPPED)) +my_installed := $(call copy-many-files,$(DEXPREOPT_IMAGE_UNSTRIPPED_BUILT_INSTALLED_$(my_boot_image_name)_$(TARGET_$(my_2nd_arch_prefix)ARCH)),$(TARGET_OUT_UNSTRIPPED)) $(firstword $(my_installed)): $(wordlist 2,9999,$(my_installed)) $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE): $(firstword $(my_installed)) diff --git a/core/dex_preopt_odex_install.mk b/core/dex_preopt_odex_install.mk index bda871c6a..3d02cdc5f 100644 --- a/core/dex_preopt_odex_install.mk +++ b/core/dex_preopt_odex_install.mk @@ -150,13 +150,13 @@ ifdef LOCAL_DEX_PREOPT # ################################################# # Odex for the 1st arch my_dexpreopt_archs += $(TARGET_ARCH) - my_dexpreopt_images += $(DEXPREOPT_IMAGE_$(TARGET_ARCH)) + my_dexpreopt_images += $(DEXPREOPT_IMAGE_boot_$(TARGET_ARCH)) # Odex for the 2nd arch ifdef TARGET_2ND_ARCH ifneq ($(TARGET_TRANSLATE_2ND_ARCH),true) ifneq (first,$(my_module_multilib)) my_dexpreopt_archs += $(TARGET_2ND_ARCH) - my_dexpreopt_images += $(DEXPREOPT_IMAGE_$(TARGET_2ND_ARCH)) + my_dexpreopt_images += $(DEXPREOPT_IMAGE_boot_$(TARGET_2ND_ARCH)) endif # my_module_multilib is not first. endif # TARGET_TRANSLATE_2ND_ARCH not true endif # TARGET_2ND_ARCH @@ -166,13 +166,13 @@ ifdef LOCAL_DEX_PREOPT # Save the module multilib since setup_one_odex modifies it. my_2nd_arch_prefix := $(LOCAL_2ND_ARCH_VAR_PREFIX) my_dexpreopt_archs += $(TARGET_$(my_2nd_arch_prefix)ARCH) - my_dexpreopt_images += $(DEXPREOPT_IMAGE_$(TARGET_$(my_2nd_arch_prefix)ARCH)) + my_dexpreopt_images += $(DEXPREOPT_IMAGE_boot_$(TARGET_$(my_2nd_arch_prefix)ARCH)) ifdef TARGET_2ND_ARCH ifeq ($(my_module_multilib),both) # The non-preferred arch my_2nd_arch_prefix := $(if $(LOCAL_2ND_ARCH_VAR_PREFIX),,$(TARGET_2ND_ARCH_VAR_PREFIX)) my_dexpreopt_archs += $(TARGET_$(my_2nd_arch_prefix)ARCH) - my_dexpreopt_images += $(DEXPREOPT_IMAGE_$(TARGET_$(my_2nd_arch_prefix)ARCH)) + my_dexpreopt_images += $(DEXPREOPT_IMAGE_boot_$(TARGET_$(my_2nd_arch_prefix)ARCH)) endif # LOCAL_MULTILIB is both endif # TARGET_2ND_ARCH endif # LOCAL_MODULE_CLASS