1LOCAL_PATH:= $(call my-dir) 2 3####################################### 4# init.rc 5include $(CLEAR_VARS) 6 7LOCAL_MODULE := init.rc 8LOCAL_SRC_FILES := $(LOCAL_MODULE) 9LOCAL_MODULE_CLASS := ETC 10LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT) 11 12include $(BUILD_PREBUILT) 13 14####################################### 15# init-debug.rc 16include $(CLEAR_VARS) 17 18LOCAL_MODULE := init-debug.rc 19LOCAL_SRC_FILES := $(LOCAL_MODULE) 20LOCAL_MODULE_CLASS := ETC 21LOCAL_MODULE_TAGS := debug 22LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/init 23 24include $(BUILD_PREBUILT) 25 26####################################### 27# asan.options 28ifneq ($(filter address,$(SANITIZE_TARGET)),) 29 30include $(CLEAR_VARS) 31 32LOCAL_MODULE := asan.options 33LOCAL_MODULE_CLASS := ETC 34LOCAL_SRC_FILES := $(LOCAL_MODULE) 35LOCAL_MODULE_PATH := $(TARGET_OUT) 36 37include $(BUILD_PREBUILT) 38 39# Modules for asan.options.X files. 40 41ASAN_OPTIONS_FILES := 42 43define create-asan-options-module 44include $$(CLEAR_VARS) 45LOCAL_MODULE := asan.options.$(1) 46ASAN_OPTIONS_FILES += asan.options.$(1) 47LOCAL_MODULE_CLASS := ETC 48# The asan.options.off.template tries to turn off as much of ASAN as is possible. 49LOCAL_SRC_FILES := asan.options.off.template 50LOCAL_MODULE_PATH := $(TARGET_OUT) 51include $$(BUILD_PREBUILT) 52endef 53 54# Pretty comprehensive set of native services. This list is helpful if all that's to be checked is an 55# app. 56ifeq ($(SANITIZE_LITE_SERVICES),true) 57SANITIZE_ASAN_OPTIONS_FOR := \ 58 adbd \ 59 ATFWD-daemon \ 60 audioserver \ 61 bridgemgrd \ 62 cameraserver \ 63 cnd \ 64 debuggerd \ 65 debuggerd64 \ 66 dex2oat \ 67 drmserver \ 68 fingerprintd \ 69 gatekeeperd \ 70 installd \ 71 keystore \ 72 lmkd \ 73 logcat \ 74 logd \ 75 lowi-server \ 76 media.codec \ 77 mediadrmserver \ 78 media.extractor \ 79 mediaserver \ 80 mm-qcamera-daemon \ 81 mpdecision \ 82 netmgrd \ 83 perfd \ 84 perfprofd \ 85 qmuxd \ 86 qseecomd \ 87 rild \ 88 sdcard \ 89 servicemanager \ 90 slim_daemon \ 91 surfaceflinger \ 92 thermal-engine \ 93 time_daemon \ 94 update_engine \ 95 vold \ 96 wpa_supplicant \ 97 zip 98endif 99 100ifneq ($(SANITIZE_ASAN_OPTIONS_FOR),) 101 $(foreach binary, $(SANITIZE_ASAN_OPTIONS_FOR), $(eval $(call create-asan-options-module,$(binary)))) 102endif 103 104endif 105 106####################################### 107# init.environ.rc 108 109include $(CLEAR_VARS) 110LOCAL_MODULE_CLASS := ETC 111LOCAL_MODULE := init.environ.rc 112LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT) 113 114EXPORT_GLOBAL_ASAN_OPTIONS := 115ifneq ($(filter address,$(SANITIZE_TARGET)),) 116 EXPORT_GLOBAL_ASAN_OPTIONS := export ASAN_OPTIONS include=/system/asan.options 117 LOCAL_REQUIRED_MODULES := asan.options $(ASAN_OPTIONS_FILES) 118endif 119 120EXPORT_GLOBAL_GCOV_OPTIONS := 121ifeq ($(NATIVE_COVERAGE),true) 122 EXPORT_GLOBAL_GCOV_OPTIONS := export GCOV_PREFIX /data/misc/gcov 123endif 124 125# Put it here instead of in init.rc module definition, 126# because init.rc is conditionally included. 127# 128# create some directories (some are mount points) and symlinks 129LOCAL_POST_INSTALL_CMD := mkdir -p $(addprefix $(TARGET_ROOT_OUT)/, \ 130 sbin dev proc sys system data oem acct config storage mnt root $(BOARD_ROOT_EXTRA_FOLDERS)); \ 131 ln -sf /system/etc $(TARGET_ROOT_OUT)/etc; \ 132 ln -sf /data/user_de/0/com.android.shell/files/bugreports $(TARGET_ROOT_OUT)/bugreports; \ 133 ln -sf /sys/kernel/debug $(TARGET_ROOT_OUT)/d; \ 134 ln -sf /storage/self/primary $(TARGET_ROOT_OUT)/sdcard 135ifdef BOARD_USES_VENDORIMAGE 136 LOCAL_POST_INSTALL_CMD += ; mkdir -p $(TARGET_ROOT_OUT)/vendor 137else 138 LOCAL_POST_INSTALL_CMD += ; ln -sf /system/vendor $(TARGET_ROOT_OUT)/vendor 139endif 140ifdef BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE 141 LOCAL_POST_INSTALL_CMD += ; mkdir -p $(TARGET_ROOT_OUT)/cache 142else 143 LOCAL_POST_INSTALL_CMD += ; ln -sf /data/cache $(TARGET_ROOT_OUT)/cache 144endif 145ifdef BOARD_ROOT_EXTRA_SYMLINKS 146# BOARD_ROOT_EXTRA_SYMLINKS is a list of <target>:<link_name>. 147 LOCAL_POST_INSTALL_CMD += $(foreach s, $(BOARD_ROOT_EXTRA_SYMLINKS),\ 148 $(eval p := $(subst :,$(space),$(s)))\ 149 ; mkdir -p $(dir $(TARGET_ROOT_OUT)/$(word 2,$(p))) \ 150 ; ln -sf $(word 1,$(p)) $(TARGET_ROOT_OUT)/$(word 2,$(p))) 151endif 152# The A/B updater uses a top-level /postinstall directory to mount the new 153# system before reboot. 154ifeq ($(AB_OTA_UPDATER),true) 155 LOCAL_POST_INSTALL_CMD += ; mkdir -p $(TARGET_ROOT_OUT)/postinstall 156endif 157 158include $(BUILD_SYSTEM)/base_rules.mk 159 160# Regenerate init.environ.rc if PRODUCT_BOOTCLASSPATH has changed. 161bcp_md5 := $(word 1, $(shell echo $(PRODUCT_BOOTCLASSPATH) $(PRODUCT_SYSTEM_SERVER_CLASSPATH) | $(MD5SUM))) 162bcp_dep := $(intermediates)/$(bcp_md5).bcp.dep 163$(bcp_dep) : 164 $(hide) mkdir -p $(dir $@) && rm -rf $(dir $@)*.bcp.dep && touch $@ 165 166$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/init.environ.rc.in $(bcp_dep) 167 @echo "Generate: $< -> $@" 168 @mkdir -p $(dir $@) 169 $(hide) sed -e 's?%BOOTCLASSPATH%?$(PRODUCT_BOOTCLASSPATH)?g' $< >$@ 170 $(hide) sed -i -e 's?%SYSTEMSERVERCLASSPATH%?$(PRODUCT_SYSTEM_SERVER_CLASSPATH)?g' $@ 171 $(hide) sed -i -e 's?%EXPORT_GLOBAL_ASAN_OPTIONS%?$(EXPORT_GLOBAL_ASAN_OPTIONS)?g' $@ 172 $(hide) sed -i -e 's?%EXPORT_GLOBAL_GCOV_OPTIONS%?$(EXPORT_GLOBAL_GCOV_OPTIONS)?g' $@ 173 174bcp_md5 := 175bcp_dep := 176 177####################################### 178# ld.config.txt 179include $(CLEAR_VARS) 180 181LOCAL_MODULE := ld.config.txt 182ifeq ($(PRODUCT_FULL_TREBLE),true) 183LOCAL_SRC_FILES := etc/ld.config.txt 184else 185LOCAL_SRC_FILES := etc/ld.config.legacy.txt 186endif 187LOCAL_MODULE_CLASS := ETC 188LOCAL_MODULE_PATH := $(TARGET_OUT_ETC) 189LOCAL_MODULE_STEM := $(LOCAL_MODULE) 190include $(BUILD_PREBUILT) 191