| 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)) | 
|  | 8 | #   my_boot_image_root: make variable used to store installed image path | 
| Brian Carlstrom | ced4bff | 2013-11-14 23:44:56 -0800 | [diff] [blame] | 9 | # | 
|  | 10 | #################################### | 
|  | 11 |  | 
| David Srbecky | 6dd11ec | 2020-02-11 13:46:45 +0000 | [diff] [blame] | 12 | # Install $(1) to $(2) so that it is shared between architectures. | 
|  | 13 | define copy-vdex-file | 
|  | 14 | my_vdex_shared := $$(dir $$(patsubst %/,%,$$(dir $(2))))$$(notdir $(2))  # Remove the arch dir. | 
|  | 15 | ifneq ($(my_boot_image_arch),$(filter $(my_boot_image_arch), TARGET_2ND_ARCH HOST_2ND_ARCH)) | 
|  | 16 | $$(my_vdex_shared): $(1)  # Copy $(1) to directory one level up (i.e. with the arch dir removed). | 
|  | 17 | @echo "Install: $$@" | 
|  | 18 | $$(copy-file-to-target) | 
|  | 19 | endif | 
|  | 20 | $(2): $$(my_vdex_shared)  # Create symlink at $(2) which points to the actual physical copy. | 
|  | 21 | @echo "Symlink: $$@" | 
|  | 22 | mkdir -p $$(dir $$@) | 
|  | 23 | ln -sfn ../$$(notdir $$@) $$@ | 
|  | 24 | my_vdex_shared := | 
|  | 25 | endef | 
|  | 26 |  | 
|  | 27 | # Same as 'copy-many-files' but it uses the vdex-specific helper above. | 
|  | 28 | define copy-vdex-files | 
|  | 29 | $(foreach v,$(1),$(eval $(call copy-vdex-file, $(call word-colon,1,$(v)), $(2)$(call word-colon,2,$(v))))) | 
|  | 30 | $(foreach v,$(1),$(2)$(call word-colon,2,$(v))) | 
|  | 31 | endef | 
|  | 32 |  | 
|  | 33 | # Install the boot images compiled by Soong. | 
|  | 34 | # The first file is saved in $(my_boot_image_root) and the rest are added as it's dependencies. | 
|  | 35 | my_suffix := BUILT_INSTALLED_$(my_boot_image_name)_$($(my_boot_image_arch)) | 
|  | 36 | my_installed := $(call copy-many-files,$(DEXPREOPT_IMAGE_$(my_suffix)),$(my_boot_image_out)) | 
|  | 37 | my_installed += $(call copy-many-files,$(DEXPREOPT_IMAGE_UNSTRIPPED_$(my_suffix)),$(my_boot_image_syms)) | 
|  | 38 | my_installed += $(call copy-vdex-files,$(DEXPREOPT_IMAGE_VDEX_$(my_suffix)),$(my_boot_image_out)) | 
|  | 39 | $(my_boot_image_root) += $(firstword $(my_installed)) | 
| Colin Cross | 47e384c | 2019-02-11 14:25:13 -0800 | [diff] [blame] | 40 | $(firstword $(my_installed)): $(wordlist 2,9999,$(my_installed)) | 
| Colin Cross | 47e384c | 2019-02-11 14:25:13 -0800 | [diff] [blame] | 41 | my_installed := | 
| David Srbecky | 6dd11ec | 2020-02-11 13:46:45 +0000 | [diff] [blame] | 42 | my_suffix := |