Brian Carlstrom | ced4bff | 2013-11-14 23:44:56 -0800 | [diff] [blame] | 1 | #################################### |
Nicolas Geoffray | 269bc74 | 2019-02-22 15:33:23 +0000 | [diff] [blame] | 2 | # ART boot image installation |
David Srbecky | 6dd11ec | 2020-02-11 13:46:45 +0000 | [diff] [blame] | 3 | # Input variables: |
Nicolas Geoffray | 269bc74 | 2019-02-22 15:33:23 +0000 | [diff] [blame] | 4 | # my_boot_image_name: the boot image to install |
David Srbecky | 6dd11ec | 2020-02-11 13:46:45 +0000 | [diff] [blame] | 5 | # my_boot_image_arch: the architecture to install (e.g. TARGET_ARCH, not expanded) |
| 6 | # my_boot_image_out: the install directory (e.g. $(PRODUCT_OUT)) |
| 7 | # my_boot_image_syms: the symbols director (e.g. $(TARGET_OUT_UNSTRIPPED)) |
Yo Chiang | 3ca4980 | 2020-07-01 20:16:07 +0800 | [diff] [blame^] | 8 | # |
| 9 | # Output variables: |
| 10 | # my_boot_image_module: the created module name. Empty if no module is created. |
| 11 | # |
| 12 | # Install the boot images compiled by Soong. |
| 13 | # Create a module named dexpreopt_bootjar.$(my_boot_image_name)_$($(my_boot_image_arch)) |
| 14 | # that installs all of boot image files. |
| 15 | # If there is no file to install for $(my_boot_image_name), for example when |
| 16 | # building an unbundled build, then no module is created. |
Brian Carlstrom | ced4bff | 2013-11-14 23:44:56 -0800 | [diff] [blame] | 17 | # |
| 18 | #################################### |
| 19 | |
David Srbecky | 6dd11ec | 2020-02-11 13:46:45 +0000 | [diff] [blame] | 20 | # Install $(1) to $(2) so that it is shared between architectures. |
Yo Chiang | 3ca4980 | 2020-07-01 20:16:07 +0800 | [diff] [blame^] | 21 | # Returns the target path of the shared vdex file and installed symlink. |
David Srbecky | 6dd11ec | 2020-02-11 13:46:45 +0000 | [diff] [blame] | 22 | define copy-vdex-file |
Yo Chiang | 3ca4980 | 2020-07-01 20:16:07 +0800 | [diff] [blame^] | 23 | $(strip \ |
| 24 | $(eval # Remove the arch dir) \ |
| 25 | $(eval my_vdex_shared := $(dir $(patsubst %/,%,$(dir $(2))))$(notdir $(2))) \ |
| 26 | $(if $(filter-out %_2ND_ARCH,$(my_boot_image_arch)), \ |
| 27 | $(eval # Copy $(1) to directory one level up (i.e. with the arch dir removed).) \ |
| 28 | $(eval $(call copy-one-file,$(1),$(my_vdex_shared))) \ |
| 29 | ) \ |
| 30 | $(eval # Create symlink at $(2) which points to the actual physical copy.) \ |
| 31 | $(call symlink-file,$(my_vdex_shared),../$(notdir $(2)),$(2)) \ |
| 32 | $(my_vdex_shared) $(2) \ |
| 33 | ) |
David Srbecky | 6dd11ec | 2020-02-11 13:46:45 +0000 | [diff] [blame] | 34 | endef |
| 35 | |
| 36 | # Same as 'copy-many-files' but it uses the vdex-specific helper above. |
| 37 | define copy-vdex-files |
Yo Chiang | 3ca4980 | 2020-07-01 20:16:07 +0800 | [diff] [blame^] | 38 | $(foreach v,$(1),$(call copy-vdex-file,$(call word-colon,1,$(v)),$(2)$(call word-colon,2,$(v)))) |
David Srbecky | 6dd11ec | 2020-02-11 13:46:45 +0000 | [diff] [blame] | 39 | endef |
| 40 | |
Yo Chiang | 3ca4980 | 2020-07-01 20:16:07 +0800 | [diff] [blame^] | 41 | my_boot_image_module := |
| 42 | |
| 43 | my_suffix := $(my_boot_image_name)_$($(my_boot_image_arch)) |
| 44 | my_copy_pairs := $(strip $(DEXPREOPT_IMAGE_BUILT_INSTALLED_$(my_suffix))) |
| 45 | |
| 46 | # Generate the boot image module only if there is any file to install. |
| 47 | ifneq (,$(my_copy_pairs)) |
| 48 | my_first_pair := $(firstword $(my_copy_pairs)) |
| 49 | my_rest_pairs := $(wordlist 2,$(words $(my_copy_pairs)),$(my_copy_pairs)) |
| 50 | |
| 51 | my_first_src := $(call word-colon,1,$(my_first_pair)) |
| 52 | my_first_dest := $(my_boot_image_out)$(call word-colon,2,$(my_first_pair)) |
| 53 | |
| 54 | my_installed := $(call copy-many-files,$(my_rest_pairs),$(my_boot_image_out)) |
| 55 | my_installed += $(call copy-vdex-files,$(DEXPREOPT_IMAGE_VDEX_BUILT_INSTALLED_$(my_suffix)),$(my_boot_image_out)) |
| 56 | my_unstripped_installed := $(call copy-many-files,$(DEXPREOPT_IMAGE_UNSTRIPPED_BUILT_INSTALLED_$(my_suffix)),$(my_boot_image_syms)) |
| 57 | |
| 58 | # We don't have a LOCAL_PATH for the auto-generated modules, so let it be the $(BUILD_SYSTEM). |
| 59 | LOCAL_PATH := $(BUILD_SYSTEM) |
| 60 | |
| 61 | include $(CLEAR_VARS) |
| 62 | LOCAL_MODULE := dexpreopt_bootjar.$(my_suffix) |
| 63 | LOCAL_PREBUILT_MODULE_FILE := $(my_first_src) |
| 64 | LOCAL_MODULE_PATH := $(dir $(my_first_dest)) |
| 65 | LOCAL_MODULE_STEM := $(notdir $(my_first_dest)) |
| 66 | ifneq (,$(strip $(filter HOST_%,$(my_boot_image_arch)))) |
| 67 | LOCAL_IS_HOST_MODULE := true |
| 68 | endif |
| 69 | LOCAL_MODULE_CLASS := ETC |
| 70 | include $(BUILD_PREBUILT) |
| 71 | $(LOCAL_BUILT_MODULE): $(my_unstripped_installed) |
| 72 | # Installing boot.art causes all boot image bits to be installed. |
| 73 | # Keep this old behavior in case anyone still needs it. |
| 74 | $(LOCAL_INSTALLED_MODULE): $(my_installed) |
| 75 | ALL_MODULES.$(my_register_name).INSTALLED += $(my_installed) |
| 76 | $(my_all_targets): $(my_installed) |
| 77 | |
| 78 | my_boot_image_module := $(LOCAL_MODULE) |
| 79 | endif # my_copy_pairs != empty |