1LOCAL_PATH:= $(call my-dir) 2 3##################################################################### 4# list of vndk libraries from the source code. 5INTERNAL_VNDK_LIB_LIST := $(SOONG_VNDK_LIBRARIES_FILE) 6 7##################################################################### 8# This is the up-to-date list of vndk libs. 9# TODO(b/62012285): the lib list should be stored somewhere under 10# /prebuilts/vndk 11ifeq (REL,$(PLATFORM_VERSION_CODENAME)) 12LATEST_VNDK_LIB_LIST := $(LOCAL_PATH)/$(PLATFORM_VNDK_VERSION).txt 13ifeq ($(wildcard $(LATEST_VNDK_LIB_LIST)),) 14$(error $(LATEST_VNDK_LIB_LIST) file not found. Please copy "$(LOCAL_PATH)/current.txt" to "$(LATEST_VNDK_LIB_LIST)" and commit a CL for release branch) 15endif 16else 17LATEST_VNDK_LIB_LIST := $(LOCAL_PATH)/current.txt 18endif 19 20##################################################################### 21# Check the generate list against the latest list stored in the 22# source tree 23.PHONY: check-vndk-list 24 25# Check if vndk list is changed 26droidcore: check-vndk-list 27 28check-vndk-list-timestamp := $(call intermediates-dir-for,PACKAGING,vndk)/check-list-timestamp 29check-vndk-abi-dump-list-timestamp := $(call intermediates-dir-for,PACKAGING,vndk)/check-abi-dump-list-timestamp 30 31ifeq ($(TARGET_IS_64_BIT)|$(TARGET_2ND_ARCH),true|) 32# TODO(b/110429754) remove this condition when we support 64-bit-only device 33check-vndk-list: ; 34else ifeq ($(TARGET_BUILD_PDK),true) 35# b/118634643: don't check VNDK lib list when building PDK. Some libs (libandroid_net.so 36# and some render-script related ones) can't be built in PDK due to missing frameworks/base. 37check-vndk-list: ; 38else ifeq ($(TARGET_SKIP_CURRENT_VNDK),true) 39check-vndk-list: ; 40else ifeq ($(BOARD_VNDK_VERSION),) 41# b/143233626 do not check vndk-list when vndk libs are not built 42check-vndk-list: ; 43else 44check-vndk-list: $(check-vndk-list-timestamp) 45ifneq ($(SKIP_ABI_CHECKS),true) 46check-vndk-list: $(check-vndk-abi-dump-list-timestamp) 47endif 48endif 49 50_vndk_check_failure_message := " error: VNDK library list has been changed.\n" 51ifeq (REL,$(PLATFORM_VERSION_CODENAME)) 52_vndk_check_failure_message += " Changing the VNDK library list is not allowed in API locked branches." 53else 54_vndk_check_failure_message += " Run \`update-vndk-list.sh\` to update $(LATEST_VNDK_LIB_LIST)" 55endif 56 57$(check-vndk-list-timestamp): $(INTERNAL_VNDK_LIB_LIST) $(LATEST_VNDK_LIB_LIST) $(HOST_OUT_EXECUTABLES)/update-vndk-list.sh 58 $(hide) ( diff --old-line-format="Removed %L" \ 59 --new-line-format="Added %L" \ 60 --unchanged-line-format="" \ 61 $(LATEST_VNDK_LIB_LIST) $(INTERNAL_VNDK_LIB_LIST) \ 62 || ( echo -e $(_vndk_check_failure_message); exit 1 )) 63 $(hide) mkdir -p $(dir $@) 64 $(hide) touch $@ 65 66##################################################################### 67# Script to update the latest VNDK lib list 68include $(CLEAR_VARS) 69LOCAL_MODULE := update-vndk-list.sh 70LOCAL_MODULE_CLASS := EXECUTABLES 71LOCAL_MODULE_STEM := $(LOCAL_MODULE) 72LOCAL_IS_HOST_MODULE := true 73include $(BUILD_SYSTEM)/base_rules.mk 74$(LOCAL_BUILT_MODULE): PRIVATE_INTERNAL_VNDK_LIB_LIST := $(INTERNAL_VNDK_LIB_LIST) 75$(LOCAL_BUILT_MODULE): PRIVATE_LATEST_VNDK_LIB_LIST := $(LATEST_VNDK_LIB_LIST) 76$(LOCAL_BUILT_MODULE): 77 @echo "Generate: $@" 78 @mkdir -p $(dir $@) 79 @rm -f $@ 80 $(hide) echo "#!/bin/bash" > $@ 81ifeq (REL,$(PLATFORM_VERSION_CODENAME)) 82 $(hide) echo "echo Updating VNDK library list is NOT allowed in API locked branches." >> $@; \ 83 echo "exit 1" >> $@ 84else 85 $(hide) echo "if [ -z \"\$${ANDROID_BUILD_TOP}\" ]; then" >> $@; \ 86 echo " echo Run lunch or choosecombo first" >> $@; \ 87 echo " exit 1" >> $@; \ 88 echo "fi" >> $@; \ 89 echo "cd \$${ANDROID_BUILD_TOP}" >> $@; \ 90 echo "cp $(PRIVATE_INTERNAL_VNDK_LIB_LIST) $(PRIVATE_LATEST_VNDK_LIB_LIST)" >> $@; \ 91 echo "echo $(PRIVATE_LATEST_VNDK_LIB_LIST) updated." >> $@ 92endif 93 @chmod a+x $@ 94 95##################################################################### 96# Check that all ABI reference dumps have corresponding 97# NDK/VNDK/PLATFORM libraries. 98 99# $(1): The directory containing ABI dumps. 100# Return a list of ABI dump paths ending with .so.lsdump. 101define find-abi-dump-paths 102$(if $(wildcard $(1)), \ 103 $(addprefix $(1)/, \ 104 $(call find-files-in-subdirs,$(1),"*.so.lsdump" -and -type f,.))) 105endef 106 107# $(1): A list of tags. 108# $(2): A list of tag:path. 109# Return the file names of the ABI dumps that match the tags. 110define filter-abi-dump-paths 111$(eval tag_patterns := $(foreach tag,$(1),$(tag):%)) 112$(notdir $(patsubst $(tag_patterns),%,$(filter $(tag_patterns),$(2)))) 113endef 114 115VNDK_ABI_DUMP_DIR := prebuilts/abi-dumps/vndk/$(PLATFORM_VNDK_VERSION) 116NDK_ABI_DUMP_DIR := prebuilts/abi-dumps/ndk/$(PLATFORM_VNDK_VERSION) 117PLATFORM_ABI_DUMP_DIR := prebuilts/abi-dumps/platform/$(PLATFORM_VNDK_VERSION) 118VNDK_ABI_DUMPS := $(call find-abi-dump-paths,$(VNDK_ABI_DUMP_DIR)) 119NDK_ABI_DUMPS := $(call find-abi-dump-paths,$(NDK_ABI_DUMP_DIR)) 120PLATFORM_ABI_DUMPS := $(call find-abi-dump-paths,$(PLATFORM_ABI_DUMP_DIR)) 121 122$(check-vndk-abi-dump-list-timestamp): PRIVATE_LSDUMP_PATHS := $(LSDUMP_PATHS) 123$(check-vndk-abi-dump-list-timestamp): 124 $(eval added_vndk_abi_dumps := $(strip $(sort $(filter-out \ 125 $(call filter-abi-dump-paths,LLNDK VNDK-SP VNDK-core,$(PRIVATE_LSDUMP_PATHS)), \ 126 $(notdir $(VNDK_ABI_DUMPS)))))) 127 $(if $(added_vndk_abi_dumps), \ 128 echo -e "Found unexpected ABI reference dump files under $(VNDK_ABI_DUMP_DIR). It is caused by mismatch between Android.bp and the dump files. Run \`find \$${ANDROID_BUILD_TOP}/$(VNDK_ABI_DUMP_DIR) '(' -name $(subst $(space), -or -name ,$(added_vndk_abi_dumps)) ')' -delete\` to delete the dump files.") 129 130 $(eval added_ndk_abi_dumps := $(strip $(sort $(filter-out \ 131 $(call filter-abi-dump-paths,NDK,$(PRIVATE_LSDUMP_PATHS)), \ 132 $(notdir $(NDK_ABI_DUMPS)))))) 133 $(if $(added_ndk_abi_dumps), \ 134 echo -e "Found unexpected ABI reference dump files under $(NDK_ABI_DUMP_DIR). It is caused by mismatch between Android.bp and the dump files. Run \`find \$${ANDROID_BUILD_TOP}/$(NDK_ABI_DUMP_DIR) '(' -name $(subst $(space), -or -name ,$(added_ndk_abi_dumps)) ')' -delete\` to delete the dump files.") 135 136 $(eval added_platform_abi_dumps := $(strip $(sort $(filter-out \ 137 $(call filter-abi-dump-paths,PLATFORM,$(PRIVATE_LSDUMP_PATHS)), \ 138 $(notdir $(PLATFORM_ABI_DUMPS)))))) 139 $(if $(added_platform_abi_dumps), \ 140 echo -e "Found unexpected ABI reference dump files under $(PLATFORM_ABI_DUMP_DIR). It is caused by mismatch between Android.bp and the dump files. Run \`find \$${ANDROID_BUILD_TOP}/$(PLATFORM_ABI_DUMP_DIR) '(' -name $(subst $(space), -or -name ,$(added_platform_abi_dumps)) ')' -delete\` to delete the dump files.") 141 142 $(if $(added_vndk_abi_dumps)$(added_ndk_abi_dumps)$(added_platform_abi_dumps),exit 1) 143 $(hide) mkdir -p $(dir $@) 144 $(hide) touch $@ 145 146##################################################################### 147# VNDK package and snapshot. 148 149ifneq ($(BOARD_VNDK_VERSION),) 150 151include $(CLEAR_VARS) 152LOCAL_MODULE := vndk_package 153# Filter LLNDK libs moved to APEX to avoid pulling them into /system/LIB 154LOCAL_REQUIRED_MODULES := \ 155 $(filter-out $(LLNDK_MOVED_TO_APEX_LIBRARIES),$(LLNDK_LIBRARIES)) 156 157ifneq ($(TARGET_SKIP_CURRENT_VNDK),true) 158LOCAL_REQUIRED_MODULES += \ 159 vndkcorevariant.libraries.txt \ 160 $(addsuffix .vendor,$(VNDK_CORE_LIBRARIES)) \ 161 $(addsuffix .vendor,$(VNDK_SAMEPROCESS_LIBRARIES)) \ 162 $(VNDK_USING_CORE_VARIANT_LIBRARIES) \ 163 com.android.vndk.current 164endif 165include $(BUILD_PHONY_PACKAGE) 166 167include $(CLEAR_VARS) 168_vndk_versions := $(PRODUCT_EXTRA_VNDK_VERSIONS) 169ifneq ($(BOARD_VNDK_VERSION),current) 170 _vndk_versions += $(BOARD_VNDK_VERSION) 171endif 172LOCAL_MODULE := vndk_apex_snapshot_package 173LOCAL_REQUIRED_MODULES := $(foreach vndk_ver,$(_vndk_versions),com.android.vndk.v$(vndk_ver)) 174include $(BUILD_PHONY_PACKAGE) 175 176_vndk_versions := 177 178endif # BOARD_VNDK_VERSION is set 179 180##################################################################### 181# skip_mount.cfg, read by init to skip mounting some partitions when GSI is used. 182 183include $(CLEAR_VARS) 184LOCAL_MODULE := gsi_skip_mount.cfg 185LOCAL_MODULE_STEM := skip_mount.cfg 186LOCAL_SRC_FILES := $(LOCAL_MODULE) 187LOCAL_MODULE_CLASS := ETC 188LOCAL_SYSTEM_EXT_MODULE := true 189LOCAL_MODULE_RELATIVE_PATH := init/config 190 191# Adds a symlink under /system/etc/init/config pointing to /system/system_ext/etc/init/config 192# because first-stage init in Android 10.0 will read the skip_mount.cfg from /system/etc/* after 193# chroot /system. 194# TODO: remove this symlink when no need to support new GSI on Android 10. 195# The actual file needs to be under /system/system_ext because it's GSI-specific and does not 196# belong to core CSI. 197LOCAL_POST_INSTALL_CMD := \ 198 mkdir -p $(TARGET_OUT)/etc/init; \ 199 ln -sf /system/system_ext/etc/init/config $(TARGET_OUT)/etc/init/config 200 201include $(BUILD_PREBUILT) 202 203##################################################################### 204# init.gsi.rc, GSI-specific init script. 205 206include $(CLEAR_VARS) 207LOCAL_MODULE := init.gsi.rc 208LOCAL_SRC_FILES := $(LOCAL_MODULE) 209LOCAL_MODULE_CLASS := ETC 210LOCAL_SYSTEM_EXT_MODULE := true 211LOCAL_MODULE_RELATIVE_PATH := init 212 213include $(BUILD_PREBUILT) 214