blob: 7d0c87dc4b19b164198470ef16f07db11a6af706 [file] [log] [blame]
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -08001LOCAL_PATH:= $(call my-dir)
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -08002
Ying Wang5748ee92013-07-23 18:03:37 -07003#######################################
4# init.rc
Ying Wang5748ee92013-07-23 18:03:37 -07005include $(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)
Evgenii Stepanov0d2dde52015-08-07 17:04:37 -070013
14#######################################
Mark Salyzyn7864e362016-01-28 09:32:53 -080015# 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#######################################
Evgenii Stepanov0d2dde52015-08-07 17:04:37 -070027# asan.options
Ivan Krasin5039d8c2015-09-18 11:59:46 -070028ifneq ($(filter address,$(SANITIZE_TARGET)),)
Andreas Gampe8ccc1ad2016-06-22 20:05:59 -070029
Evgenii Stepanov0d2dde52015-08-07 17:04:37 -070030include $(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)
Andreas Gampe8ccc1ad2016-06-22 20:05:59 -070038
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),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
Evgenii Stepanov0d2dde52015-08-07 17:04:37 -0700104endif
105
Ying Wang5748ee92013-07-23 18:03:37 -0700106#######################################
107# init.environ.rc
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800108
Ying Wang5748ee92013-07-23 18:03:37 -0700109include $(CLEAR_VARS)
110LOCAL_MODULE_CLASS := ETC
111LOCAL_MODULE := init.environ.rc
112LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
Colin Cross44b65d02010-04-20 14:32:50 -0700113
Evgenii Stepanov0d2dde52015-08-07 17:04:37 -0700114EXPORT_GLOBAL_ASAN_OPTIONS :=
Ivan Krasin5039d8c2015-09-18 11:59:46 -0700115ifneq ($(filter address,$(SANITIZE_TARGET)),)
Evgenii Stepanov0d2dde52015-08-07 17:04:37 -0700116 EXPORT_GLOBAL_ASAN_OPTIONS := export ASAN_OPTIONS include=/system/asan.options
Andreas Gampe8ccc1ad2016-06-22 20:05:59 -0700117 LOCAL_REQUIRED_MODULES := asan.options $(ASAN_OPTIONS_FILES)
Evgenii Stepanov0d2dde52015-08-07 17:04:37 -0700118endif
Ying Wang5748ee92013-07-23 18:03:37 -0700119# Put it here instead of in init.rc module definition,
120# because init.rc is conditionally included.
121#
Daniel Rosenberg595003a2015-07-28 15:14:39 -0700122# create some directories (some are mount points) and symlinks
Daniel Rosenberg52b59152015-10-28 13:13:37 -0700123LOCAL_POST_INSTALL_CMD := mkdir -p $(addprefix $(TARGET_ROOT_OUT)/, \
Patrick Tjinc6535a32016-05-13 14:22:14 -0700124 sbin dev proc sys system data oem acct config storage mnt root $(BOARD_ROOT_EXTRA_FOLDERS)); \
Daniel Rosenberg595003a2015-07-28 15:14:39 -0700125 ln -sf /system/etc $(TARGET_ROOT_OUT)/etc; \
Nick Kralevichc4084c62016-11-19 12:09:33 -0800126 ln -sf /data/user_de/0/com.android.shell/files/bugreports $(TARGET_ROOT_OUT)/bugreports; \
Daniel Rosenberg595003a2015-07-28 15:14:39 -0700127 ln -sf /sys/kernel/debug $(TARGET_ROOT_OUT)/d; \
128 ln -sf /storage/self/primary $(TARGET_ROOT_OUT)/sdcard
Dan Willemsen07904312016-07-08 18:08:51 -0700129ifdef BOARD_USES_VENDORIMAGE
Daniel Rosenberg52b59152015-10-28 13:13:37 -0700130 LOCAL_POST_INSTALL_CMD += ; mkdir -p $(TARGET_ROOT_OUT)/vendor
Junichi Uekawa07b69962015-11-12 07:49:47 +0900131else
132 LOCAL_POST_INSTALL_CMD += ; ln -sf /system/vendor $(TARGET_ROOT_OUT)/vendor
Daniel Rosenberg595003a2015-07-28 15:14:39 -0700133endif
Patrick Tjinc6535a32016-05-13 14:22:14 -0700134ifdef BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE
135 LOCAL_POST_INSTALL_CMD += ; mkdir -p $(TARGET_ROOT_OUT)/cache
136else
137 LOCAL_POST_INSTALL_CMD += ; ln -sf /data/cache $(TARGET_ROOT_OUT)/cache
138endif
Daniel Rosenberg52b59152015-10-28 13:13:37 -0700139ifdef BOARD_ROOT_EXTRA_SYMLINKS
140# BOARD_ROOT_EXTRA_SYMLINKS is a list of <target>:<link_name>.
141 LOCAL_POST_INSTALL_CMD += $(foreach s, $(BOARD_ROOT_EXTRA_SYMLINKS),\
142 $(eval p := $(subst :,$(space),$(s)))\
143 ; mkdir -p $(dir $(TARGET_ROOT_OUT)/$(word 2,$(p))) \
144 ; ln -sf $(word 1,$(p)) $(TARGET_ROOT_OUT)/$(word 2,$(p)))
145endif
Alex Deymoe120b472016-02-29 17:23:36 -0800146# The A/B updater uses a top-level /postinstall directory to mount the new
147# system before reboot.
148ifeq ($(AB_OTA_UPDATER),true)
149 LOCAL_POST_INSTALL_CMD += ; mkdir -p $(TARGET_ROOT_OUT)/postinstall
150endif
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800151
Ying Wang5748ee92013-07-23 18:03:37 -0700152include $(BUILD_SYSTEM)/base_rules.mk
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800153
Ying Wang7011a852014-06-14 09:11:02 -0700154# Regenerate init.environ.rc if PRODUCT_BOOTCLASSPATH has changed.
Narayan Kamath1fabc352014-08-05 15:42:34 +0100155bcp_md5 := $(word 1, $(shell echo $(PRODUCT_BOOTCLASSPATH) $(PRODUCT_SYSTEM_SERVER_CLASSPATH) | $(MD5SUM)))
Ying Wang7011a852014-06-14 09:11:02 -0700156bcp_dep := $(intermediates)/$(bcp_md5).bcp.dep
157$(bcp_dep) :
158 $(hide) mkdir -p $(dir $@) && rm -rf $(dir $@)*.bcp.dep && touch $@
159
160$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/init.environ.rc.in $(bcp_dep)
Ying Wang5748ee92013-07-23 18:03:37 -0700161 @echo "Generate: $< -> $@"
162 @mkdir -p $(dir $@)
163 $(hide) sed -e 's?%BOOTCLASSPATH%?$(PRODUCT_BOOTCLASSPATH)?g' $< >$@
Narayan Kamath1fabc352014-08-05 15:42:34 +0100164 $(hide) sed -i -e 's?%SYSTEMSERVERCLASSPATH%?$(PRODUCT_SYSTEM_SERVER_CLASSPATH)?g' $@
Evgenii Stepanov1cbe3d92015-06-12 15:42:20 -0700165 $(hide) sed -i -e 's?%EXPORT_GLOBAL_ASAN_OPTIONS%?$(EXPORT_GLOBAL_ASAN_OPTIONS)?g' $@
Ying Wang5748ee92013-07-23 18:03:37 -0700166
Ying Wang7011a852014-06-14 09:11:02 -0700167bcp_md5 :=
168bcp_dep :=
Ying Wang5748ee92013-07-23 18:03:37 -0700169#######################################