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_SKIP_CURRENT_VNDK),true) 35check-vndk-list: ; 36else ifeq ($(BOARD_VNDK_VERSION),) 37# b/143233626 do not check vndk-list when vndk libs are not built 38check-vndk-list: ; 39else 40check-vndk-list: $(check-vndk-list-timestamp) 41ifneq ($(SKIP_ABI_CHECKS),true) 42check-vndk-list: $(check-vndk-abi-dump-list-timestamp) 43endif 44endif 45 46_vndk_check_failure_message := " error: VNDK library list has been changed.\n" 47ifeq (REL,$(PLATFORM_VERSION_CODENAME)) 48_vndk_check_failure_message += " Changing the VNDK library list is not allowed in API locked branches." 49else 50_vndk_check_failure_message += " Run \`update-vndk-list.sh\` to update $(LATEST_VNDK_LIB_LIST)" 51endif 52 53$(check-vndk-list-timestamp): $(INTERNAL_VNDK_LIB_LIST) $(LATEST_VNDK_LIB_LIST) $(HOST_OUT_EXECUTABLES)/update-vndk-list.sh 54 $(hide) ( diff --old-line-format="Removed %L" \ 55 --new-line-format="Added %L" \ 56 --unchanged-line-format="" \ 57 $(LATEST_VNDK_LIB_LIST) $(INTERNAL_VNDK_LIB_LIST) \ 58 || ( echo -e $(_vndk_check_failure_message); exit 1 )) 59 $(hide) mkdir -p $(dir $@) 60 $(hide) touch $@ 61 62##################################################################### 63# Script to update the latest VNDK lib list 64include $(CLEAR_VARS) 65LOCAL_MODULE := update-vndk-list.sh 66LOCAL_LICENSE_KINDS := legacy_restricted 67LOCAL_LICENSE_CONDITIONS := restricted 68LOCAL_MODULE_CLASS := EXECUTABLES 69LOCAL_MODULE_STEM := $(LOCAL_MODULE) 70LOCAL_IS_HOST_MODULE := true 71include $(BUILD_SYSTEM)/base_rules.mk 72$(LOCAL_BUILT_MODULE): PRIVATE_INTERNAL_VNDK_LIB_LIST := $(INTERNAL_VNDK_LIB_LIST) 73$(LOCAL_BUILT_MODULE): PRIVATE_LATEST_VNDK_LIB_LIST := $(LATEST_VNDK_LIB_LIST) 74$(LOCAL_BUILT_MODULE): 75 @echo "Generate: $@" 76 @mkdir -p $(dir $@) 77 @rm -f $@ 78 $(hide) echo "#!/bin/bash" > $@ 79ifeq (REL,$(PLATFORM_VERSION_CODENAME)) 80 $(hide) echo "echo Updating VNDK library list is NOT allowed in API locked branches." >> $@; \ 81 echo "exit 1" >> $@ 82else 83 $(hide) echo "if [ -z \"\$${ANDROID_BUILD_TOP}\" ]; then" >> $@; \ 84 echo " echo Run lunch or choosecombo first" >> $@; \ 85 echo " exit 1" >> $@; \ 86 echo "fi" >> $@; \ 87 echo "cd \$${ANDROID_BUILD_TOP}" >> $@; \ 88 echo "cp $(PRIVATE_INTERNAL_VNDK_LIB_LIST) $(PRIVATE_LATEST_VNDK_LIB_LIST)" >> $@; \ 89 echo "echo $(PRIVATE_LATEST_VNDK_LIB_LIST) updated." >> $@ 90endif 91 @chmod a+x $@ 92 93##################################################################### 94# Check that all ABI reference dumps have corresponding 95# NDK/VNDK/PLATFORM libraries. 96 97# $(1): The directory containing ABI dumps. 98# Return a list of ABI dump paths ending with .so.lsdump. 99define find-abi-dump-paths 100$(if $(wildcard $(1)), \ 101 $(addprefix $(1)/, \ 102 $(call find-files-in-subdirs,$(1),"*.so.lsdump" -and -type f,.))) 103endef 104 105# $(1): A list of tags. 106# $(2): A list of tag:path. 107# Return the file names of the ABI dumps that match the tags. 108define filter-abi-dump-paths 109$(eval tag_patterns := $(foreach tag,$(1),$(tag):%)) 110$(notdir $(patsubst $(tag_patterns),%,$(filter $(tag_patterns),$(2)))) 111endef 112 113VNDK_ABI_DUMP_DIR := prebuilts/abi-dumps/vndk/$(PLATFORM_VNDK_VERSION) 114NDK_ABI_DUMP_DIR := prebuilts/abi-dumps/ndk/$(PLATFORM_VNDK_VERSION) 115PLATFORM_ABI_DUMP_DIR := prebuilts/abi-dumps/platform/$(PLATFORM_VNDK_VERSION) 116VNDK_ABI_DUMPS := $(call find-abi-dump-paths,$(VNDK_ABI_DUMP_DIR)) 117NDK_ABI_DUMPS := $(call find-abi-dump-paths,$(NDK_ABI_DUMP_DIR)) 118PLATFORM_ABI_DUMPS := $(call find-abi-dump-paths,$(PLATFORM_ABI_DUMP_DIR)) 119 120# Check for superfluous lsdump files. Since LSDUMP_PATHS only covers the 121# libraries that can be built from source in the current build, and prebuilts of 122# Mainline modules may be in use, we also allow the libs in STUB_LIBRARIES for 123# NDK and platform ABIs. 124 125$(check-vndk-abi-dump-list-timestamp): PRIVATE_LSDUMP_PATHS := $(LSDUMP_PATHS) 126$(check-vndk-abi-dump-list-timestamp): PRIVATE_STUB_LIBRARIES := $(STUB_LIBRARIES) 127$(check-vndk-abi-dump-list-timestamp): 128 $(eval added_vndk_abi_dumps := $(strip $(sort $(filter-out \ 129 $(call filter-abi-dump-paths,LLNDK VNDK-SP VNDK-core,$(PRIVATE_LSDUMP_PATHS)), \ 130 $(notdir $(VNDK_ABI_DUMPS)))))) 131 $(if $(added_vndk_abi_dumps), \ 132 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.") 133 134 $(eval added_ndk_abi_dumps := $(strip $(sort $(filter-out \ 135 $(call filter-abi-dump-paths,NDK,$(PRIVATE_LSDUMP_PATHS)) \ 136 $(addsuffix .lsdump,$(PRIVATE_STUB_LIBRARIES)), \ 137 $(notdir $(NDK_ABI_DUMPS)))))) 138 $(if $(added_ndk_abi_dumps), \ 139 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.") 140 141 $(eval added_platform_abi_dumps := $(strip $(sort $(filter-out \ 142 $(call filter-abi-dump-paths,PLATFORM,$(PRIVATE_LSDUMP_PATHS)) \ 143 $(addsuffix .lsdump,$(PRIVATE_STUB_LIBRARIES)), \ 144 $(notdir $(PLATFORM_ABI_DUMPS)))))) 145 $(if $(added_platform_abi_dumps), \ 146 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.") 147 148 $(if $(added_vndk_abi_dumps)$(added_ndk_abi_dumps)$(added_platform_abi_dumps),exit 1) 149 $(hide) mkdir -p $(dir $@) 150 $(hide) touch $@ 151 152##################################################################### 153# VNDK package and snapshot. 154 155ifneq ($(BOARD_VNDK_VERSION),) 156 157include $(CLEAR_VARS) 158LOCAL_MODULE := vndk_package 159LOCAL_LICENSE_KINDS := legacy_restricted 160LOCAL_LICENSE_CONDITIONS := restricted 161# Filter LLNDK libs moved to APEX to avoid pulling them into /system/LIB 162LOCAL_REQUIRED_MODULES := \ 163 $(filter-out $(LLNDK_MOVED_TO_APEX_LIBRARIES),$(LLNDK_LIBRARIES)) 164 165ifneq ($(TARGET_SKIP_CURRENT_VNDK),true) 166LOCAL_REQUIRED_MODULES += \ 167 vndkcorevariant.libraries.txt \ 168 $(addsuffix .vendor,$(VNDK_CORE_LIBRARIES)) \ 169 $(addsuffix .vendor,$(VNDK_SAMEPROCESS_LIBRARIES)) \ 170 $(VNDK_USING_CORE_VARIANT_LIBRARIES) \ 171 com.android.vndk.current 172endif 173include $(BUILD_PHONY_PACKAGE) 174 175include $(CLEAR_VARS) 176_vndk_versions := 177ifeq ($(filter com.android.vndk.current.on_vendor, $(PRODUCT_PACKAGES)),) 178 _vndk_versions += $(PRODUCT_EXTRA_VNDK_VERSIONS) 179endif 180ifneq ($(BOARD_VNDK_VERSION),current) 181 _vndk_versions += $(BOARD_VNDK_VERSION) 182endif 183LOCAL_MODULE := vndk_apex_snapshot_package 184LOCAL_LICENSE_KINDS := legacy_restricted 185LOCAL_LICENSE_CONDITIONS := restricted 186LOCAL_REQUIRED_MODULES := $(foreach vndk_ver,$(_vndk_versions),com.android.vndk.v$(vndk_ver)) 187include $(BUILD_PHONY_PACKAGE) 188 189_vndk_versions := 190 191endif # BOARD_VNDK_VERSION is set 192 193##################################################################### 194# skip_mount.cfg, read by init to skip mounting some partitions when GSI is used. 195 196include $(CLEAR_VARS) 197LOCAL_MODULE := gsi_skip_mount.cfg 198LOCAL_LICENSE_KINDS := legacy_restricted 199LOCAL_LICENSE_CONDITIONS := restricted 200LOCAL_MODULE_STEM := skip_mount.cfg 201LOCAL_SRC_FILES := $(LOCAL_MODULE) 202LOCAL_MODULE_CLASS := ETC 203LOCAL_SYSTEM_EXT_MODULE := true 204LOCAL_MODULE_RELATIVE_PATH := init/config 205 206# Adds a symlink under /system/etc/init/config pointing to /system/system_ext/etc/init/config 207# because first-stage init in Android 10.0 will read the skip_mount.cfg from /system/etc/* after 208# chroot /system. 209# TODO: remove this symlink when no need to support new GSI on Android 10. 210# The actual file needs to be under /system/system_ext because it's GSI-specific and does not 211# belong to core CSI. 212LOCAL_POST_INSTALL_CMD := \ 213 mkdir -p $(TARGET_OUT)/etc/init; \ 214 ln -sf /system/system_ext/etc/init/config $(TARGET_OUT)/etc/init/config 215 216include $(BUILD_PREBUILT) 217 218##################################################################### 219# init.gsi.rc, GSI-specific init script. 220 221include $(CLEAR_VARS) 222LOCAL_MODULE := init.gsi.rc 223LOCAL_LICENSE_KINDS := legacy_restricted 224LOCAL_LICENSE_CONDITIONS := restricted 225LOCAL_SRC_FILES := $(LOCAL_MODULE) 226LOCAL_MODULE_CLASS := ETC 227LOCAL_SYSTEM_EXT_MODULE := true 228LOCAL_MODULE_RELATIVE_PATH := init 229 230include $(BUILD_PREBUILT) 231 232 233include $(CLEAR_VARS) 234LOCAL_MODULE := init.vndk-nodef.rc 235LOCAL_LICENSE_KINDS := legacy_restricted 236LOCAL_LICENSE_CONDITIONS := restricted 237LOCAL_SRC_FILES := $(LOCAL_MODULE) 238LOCAL_MODULE_CLASS := ETC 239LOCAL_SYSTEM_EXT_MODULE := true 240LOCAL_MODULE_RELATIVE_PATH := init 241 242include $(BUILD_PREBUILT) 243