blob: b4bc170eb960148b36ab235400e962067cc09bdf [file] [log] [blame]
Tom Cherry14fc0132017-05-09 17:11:57 -07001//
2// Copyright (C) 2017 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
Bob Badourd69ad692021-02-16 19:02:14 -080017package {
18 default_applicable_licenses: ["system_core_init_license"],
19}
20
21// Added automatically by a large-scale-change
22// See: http://go/android-license-faq
23license {
24 name: "system_core_init_license",
25 visibility: [":__subpackages__"],
26 license_kinds: [
27 "SPDX-license-identifier-Apache-2.0",
28 ],
29 license_text: [
30 "NOTICE",
31 ],
32}
33
Tom Cherry66196492020-02-06 11:56:58 -080034init_common_sources = [
35 "action.cpp",
36 "action_manager.cpp",
37 "action_parser.cpp",
38 "capabilities.cpp",
39 "epoll.cpp",
40 "import_parser.cpp",
41 "interface_utils.cpp",
42 "keychords.cpp",
43 "parser.cpp",
44 "property_type.cpp",
45 "rlimit_parser.cpp",
46 "service.cpp",
47 "service_list.cpp",
48 "service_parser.cpp",
49 "service_utils.cpp",
50 "subcontext.cpp",
51 "subcontext.proto",
52 "tokenizer.cpp",
53 "util.cpp",
54]
55init_device_sources = [
David Anderson41175592020-03-20 19:38:28 -070056 "block_dev_initializer.cpp",
Tom Cherry66196492020-02-06 11:56:58 -080057 "bootchart.cpp",
58 "builtins.cpp",
59 "devices.cpp",
60 "firmware_handler.cpp",
Steve Mucklea4bf2ce2019-11-01 13:58:02 -070061 "first_stage_console.cpp",
Tom Cherry66196492020-02-06 11:56:58 -080062 "first_stage_init.cpp",
63 "first_stage_mount.cpp",
64 "fscrypt_init_extensions.cpp",
65 "init.cpp",
66 "lmkd_service.cpp",
67 "modalias_handler.cpp",
68 "mount_handler.cpp",
69 "mount_namespace.cpp",
70 "persistent_properties.cpp",
71 "persistent_properties.proto",
72 "property_service.cpp",
73 "property_service.proto",
74 "reboot.cpp",
75 "reboot_utils.cpp",
76 "security.cpp",
77 "selabel.cpp",
78 "selinux.cpp",
79 "sigchld_handler.cpp",
David Anderson491e4da2020-12-08 00:21:20 -080080 "snapuserd_transition.cpp",
Tom Cherry66196492020-02-06 11:56:58 -080081 "switch_root.cpp",
82 "uevent_listener.cpp",
83 "ueventd.cpp",
84 "ueventd_parser.cpp",
85]
86init_host_sources = [
87 "check_builtins.cpp",
88 "host_import_parser.cpp",
89 "host_init_verifier.cpp",
90]
91
Yi-Yo Chiangbb77c542021-09-23 14:14:16 +000092soong_config_module_type {
93 name: "libinit_cc_defaults",
94 module_type: "cc_defaults",
95 config_namespace: "ANDROID",
96 bool_variables: [
97 "PRODUCT_INSTALL_DEBUG_POLICY_TO_SYSTEM_EXT",
98 ],
99 properties: [
100 "cflags",
101 ],
102}
103
104libinit_cc_defaults {
Tom Cherry14fc0132017-05-09 17:11:57 -0700105 name: "init_defaults",
Tom Cherry14fc0132017-05-09 17:11:57 -0700106 sanitize: {
Tom Cherry2ffd65e2017-07-26 14:17:09 -0700107 misc_undefined: ["signed-integer-overflow"],
Tom Cherry14fc0132017-05-09 17:11:57 -0700108 },
Chih-Hung Hsieh122352d2017-10-02 15:20:07 -0700109 cflags: [
Tom Cherry14fc0132017-05-09 17:11:57 -0700110 "-DLOG_UEVENTS=0",
111 "-Wall",
112 "-Wextra",
113 "-Wno-unused-parameter",
114 "-Werror",
Tom Cherry802864c2020-03-12 14:29:25 -0700115 "-Wthread-safety",
Steve Muckled75f30a2019-05-21 15:50:39 -0700116 "-DALLOW_FIRST_STAGE_CONSOLE=0",
Tom Cherry14fc0132017-05-09 17:11:57 -0700117 "-DALLOW_LOCAL_PROP_OVERRIDE=0",
118 "-DALLOW_PERMISSIVE_SELINUX=0",
119 "-DREBOOT_BOOTLOADER_ON_PANIC=0",
120 "-DWORLD_WRITABLE_KMSG=0",
121 "-DDUMP_ON_UMOUNT_FAILURE=0",
122 "-DSHUTDOWN_ZERO_TIMEOUT=0",
Tom Cherrya2f91362020-02-20 10:50:00 -0800123 "-DINIT_FULL_SOURCES",
Yi-Yo Chiangbb77c542021-09-23 14:14:16 +0000124 "-DINSTALL_DEBUG_POLICY_TO_SYSTEM_EXT=0",
Tom Cherry14fc0132017-05-09 17:11:57 -0700125 ],
126 product_variables: {
127 debuggable: {
128 cppflags: [
Steve Muckled75f30a2019-05-21 15:50:39 -0700129 "-UALLOW_FIRST_STAGE_CONSOLE",
130 "-DALLOW_FIRST_STAGE_CONSOLE=1",
Tom Cherry14fc0132017-05-09 17:11:57 -0700131 "-UALLOW_LOCAL_PROP_OVERRIDE",
132 "-DALLOW_LOCAL_PROP_OVERRIDE=1",
133 "-UALLOW_PERMISSIVE_SELINUX",
134 "-DALLOW_PERMISSIVE_SELINUX=1",
135 "-UREBOOT_BOOTLOADER_ON_PANIC",
136 "-DREBOOT_BOOTLOADER_ON_PANIC=1",
137 "-UWORLD_WRITABLE_KMSG",
138 "-DWORLD_WRITABLE_KMSG=1",
139 "-UDUMP_ON_UMOUNT_FAILURE",
140 "-DDUMP_ON_UMOUNT_FAILURE=1",
141 ],
142 },
143 eng: {
144 cppflags: [
145 "-USHUTDOWN_ZERO_TIMEOUT",
146 "-DSHUTDOWN_ZERO_TIMEOUT=1",
147 ],
148 },
Dmitry Shmidtc3bc5092017-08-23 14:57:07 -0700149 uml: {
150 cppflags: ["-DUSER_MODE_LINUX"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800151 },
Tom Cherry14fc0132017-05-09 17:11:57 -0700152 },
Yi-Yo Chiangbb77c542021-09-23 14:14:16 +0000153 soong_config_variables: {
154 PRODUCT_INSTALL_DEBUG_POLICY_TO_SYSTEM_EXT: {
155 cflags: [
156 "-UINSTALL_DEBUG_POLICY_TO_SYSTEM_EXT",
157 "-DINSTALL_DEBUG_POLICY_TO_SYSTEM_EXT=1",
158 ],
159 },
160 },
Tom Cherry618d3102018-01-19 14:25:48 -0800161 static_libs: [
Tom Cherry618d3102018-01-19 14:25:48 -0800162 "libavb",
Bowgo Tsai30afda72019-04-11 23:57:24 +0800163 "libc++fs",
Yifan Hongd8ce1fb2019-03-22 17:21:58 -0700164 "libcgrouprc_format",
Jeffrey Vander Stoepbaeece62022-02-08 12:42:33 +0000165 "libfsverity_init",
Suren Baghdasaryanc29c2ba2019-10-22 17:18:42 -0700166 "liblmkd_utils",
Jeffrey Vander Stoepbaeece62022-02-08 12:42:33 +0000167 "libmini_keyctl_static",
Steve Muckle18b981e2019-04-15 17:43:02 -0700168 "libmodprobe",
David Anderson9fd88622021-03-05 14:10:55 -0800169 "libprocinfo",
Tom Cherry618d3102018-01-19 14:25:48 -0800170 "libprotobuf-cpp-lite",
171 "libpropertyinfoserializer",
172 "libpropertyinfoparser",
Jeffrey Vander Stoepbaeece62022-02-08 12:42:33 +0000173 "libsigningutils",
David Andersonaca0bea2020-09-21 16:34:25 -0700174 "libsnapshot_cow",
David Andersondfe6d072019-10-09 16:24:03 -0700175 "libsnapshot_init",
Jooyung Han1d951b72020-07-05 03:33:36 +0900176 "libxml2",
Jiyong Park648ae3a2019-12-08 00:25:15 +0900177 "lib_apex_manifest_proto_lite",
Yifan Hong66f01152020-04-16 11:05:16 -0700178 "update_metadata-protos",
Jiyong Park787322c2018-06-01 19:26:42 +0900179 ],
180 shared_libs: [
Jiyong Park787322c2018-06-01 19:26:42 +0900181 "libbase",
Tao Bao66209ca2018-07-25 22:35:45 -0700182 "libbootloader_message",
Jeffrey Vander Stoepbaeece62022-02-08 12:42:33 +0000183 "libcrypto",
Tao Bao66209ca2018-07-25 22:35:45 -0700184 "libcutils",
Jiyong Park787322c2018-06-01 19:26:42 +0900185 "libdl",
Tao Bao66209ca2018-07-25 22:35:45 -0700186 "libext4_utils",
187 "libfs_mgr",
David Anderson0e330f12019-01-03 18:16:56 -0800188 "libgsi",
Tao Bao66209ca2018-07-25 22:35:45 -0700189 "libhidl-gen-utils",
190 "libkeyutils",
191 "liblog",
192 "liblogwrap",
Tom Cherry7bfea3d2018-11-06 14:12:05 -0800193 "liblp",
Suren Baghdasaryan82b72a52018-12-21 11:41:50 -0800194 "libprocessgroup",
Yifan Hong6f9ce2e2019-03-05 15:47:16 -0800195 "libprocessgroup_setup",
Jiyong Park012171d2018-06-19 16:55:05 +0900196 "libselinux",
Christopher Ferrisd2bd6c52022-05-11 14:42:38 -0700197 "libunwindstack",
Martijn Coenen62e985a2018-09-04 06:29:14 +0200198 "libutils",
Jeffrey Vander Stoepbaeece62022-02-08 12:42:33 +0000199 "libziparchive",
Tom Cherry618d3102018-01-19 14:25:48 -0800200 ],
Jiyong Park93318d42018-12-26 17:34:39 +0900201 bootstrap: true,
Daniel Norman8082ba22019-07-23 10:26:15 -0700202 visibility: [":__subpackages__"],
Tom Cherry14fc0132017-05-09 17:11:57 -0700203}
204
Devendra Singhi1df957b2022-02-15 21:52:55 +0530205cc_library_headers {
206 name: "libinit_headers",
207 export_include_dirs: ["."],
208 visibility: [":__subpackages__"],
209}
210
Tom Cherry14fc0132017-05-09 17:11:57 -0700211cc_library_static {
212 name: "libinit",
Tom Cherry31438482018-07-20 14:57:00 -0700213 recovery_available: true,
Daniel Norman8082ba22019-07-23 10:26:15 -0700214 defaults: [
215 "init_defaults",
216 "selinux_policy_version",
217 ],
Tom Cherry66196492020-02-06 11:56:58 -0800218 srcs: init_common_sources + init_device_sources,
Jooyung Han1d951b72020-07-05 03:33:36 +0900219 generated_sources: [
220 "apex-info-list",
221 ],
Daniel Norman8082ba22019-07-23 10:26:15 -0700222 whole_static_libs: [
223 "libcap",
224 "com.android.sysprop.apex",
Nikita Ioffe23dbd6d2019-11-14 01:21:24 +0000225 "com.android.sysprop.init",
Daniel Norman8082ba22019-07-23 10:26:15 -0700226 ],
Jayant Chowdhary478c7c12018-03-28 18:45:35 -0700227 header_libs: ["bootimg_headers"],
Tom Cherrya97faba2017-09-15 15:44:04 -0700228 proto: {
229 type: "lite",
230 export_proto_headers: true,
231 },
Martijn Coenen62e985a2018-09-04 06:29:14 +0200232
233 target: {
234 recovery: {
235 cflags: ["-DRECOVERY"],
Jooyung Han1d951b72020-07-05 03:33:36 +0900236 exclude_static_libs: [
237 "libxml2",
238 ],
239 exclude_generated_sources: [
240 "apex-info-list",
241 ],
Daniel Norman8082ba22019-07-23 10:26:15 -0700242 exclude_shared_libs: [
243 "libbinder",
244 "libutils",
245 ],
Martijn Coenen62e985a2018-09-04 06:29:14 +0200246 },
247 },
Tom Cherry14fc0132017-05-09 17:11:57 -0700248}
249
Steven Morelandceb36d02019-07-15 15:12:56 -0700250phony {
251 name: "init",
252 required: [
253 "init_second_stage",
254 ],
255}
256
Tom Cherry14fc0132017-05-09 17:11:57 -0700257cc_binary {
Tom Cherry31438482018-07-20 14:57:00 -0700258 name: "init_second_stage",
259 recovery_available: true,
260 stem: "init",
Tom Cherry14fc0132017-05-09 17:11:57 -0700261 defaults: ["init_defaults"],
Tom Cherry31438482018-07-20 14:57:00 -0700262 static_libs: ["libinit"],
Tom Cherry618d3102018-01-19 14:25:48 -0800263 srcs: ["main.cpp"],
Tom Cherry31438482018-07-20 14:57:00 -0700264 symlinks: ["ueventd"],
Martijn Coenen62e985a2018-09-04 06:29:14 +0200265 target: {
Yi-Yo Chiang9ba6a5b2021-07-24 22:50:17 +0800266 platform: {
267 required: [
268 "init.rc",
269 "ueventd.rc",
270 "e2fsdroid",
Suren Baghdasaryan642048d2021-06-15 12:28:24 -0700271 "extra_free_kbytes.sh",
Yi-Yo Chiang9ba6a5b2021-07-24 22:50:17 +0800272 "make_f2fs",
273 "mke2fs",
274 "sload_f2fs",
275 ],
276 },
Martijn Coenen62e985a2018-09-04 06:29:14 +0200277 recovery: {
278 cflags: ["-DRECOVERY"],
Jooyung Han1d951b72020-07-05 03:33:36 +0900279 exclude_static_libs: [
280 "libxml2",
281 ],
Daniel Norman8082ba22019-07-23 10:26:15 -0700282 exclude_shared_libs: [
283 "libbinder",
284 "libutils",
285 ],
Yi-Yo Chiang9ba6a5b2021-07-24 22:50:17 +0800286 required: [
287 "init_recovery.rc",
288 "ueventd.rc.recovery",
289 "e2fsdroid.recovery",
290 "make_f2fs.recovery",
291 "mke2fs.recovery",
292 "sload_f2fs.recovery",
293 ],
Martijn Coenen62e985a2018-09-04 06:29:14 +0200294 },
295 },
Jiyong Park90353782021-01-25 18:41:40 +0900296 visibility: ["//packages/modules/Virtualization/microdroid"],
Tom Cherry14fc0132017-05-09 17:11:57 -0700297}
Tom Cherry14fc0132017-05-09 17:11:57 -0700298
Inseob Kim74182522021-06-11 12:58:53 +0900299soong_config_module_type {
300 name: "init_first_stage_cc_defaults",
301 module_type: "cc_defaults",
302 config_namespace: "ANDROID",
Bowgo Tsaiab079af2021-07-14 15:39:53 +0800303 bool_variables: ["BOARD_BUILD_SYSTEM_ROOT_IMAGE", "BOARD_USES_RECOVERY_AS_BOOT"],
Inseob Kim74182522021-06-11 12:58:53 +0900304 properties: ["installable"],
305}
306
307// Do not install init_first_stage even with mma if we're system-as-root.
308// Otherwise, it will overwrite the symlink.
309init_first_stage_cc_defaults {
310 name: "init_first_stage_defaults",
311 soong_config_variables: {
312 BOARD_BUILD_SYSTEM_ROOT_IMAGE: {
313 installable: false,
314 },
Bowgo Tsaiab079af2021-07-14 15:39:53 +0800315 BOARD_USES_RECOVERY_AS_BOOT: {
316 installable: false,
317 },
Inseob Kim74182522021-06-11 12:58:53 +0900318 },
319}
320
Jiyong Park13eb0532021-02-15 14:13:51 +0900321cc_binary {
Inseob Kim74182522021-06-11 12:58:53 +0900322 name: "init_first_stage",
323 stem: "init",
324 defaults: ["init_first_stage_defaults"],
Jiyong Park13eb0532021-02-15 14:13:51 +0900325
326 srcs: [
327 "block_dev_initializer.cpp",
328 "devices.cpp",
329 "first_stage_console.cpp",
330 "first_stage_init.cpp",
331 "first_stage_main.cpp",
332 "first_stage_mount.cpp",
333 "reboot_utils.cpp",
334 "selabel.cpp",
Jiyong Park13eb0532021-02-15 14:13:51 +0900335 "service_utils.cpp",
336 "snapuserd_transition.cpp",
337 "switch_root.cpp",
338 "uevent_listener.cpp",
339 "util.cpp",
340 ],
341
342 static_libs: [
343 "libc++fs",
344 "libfs_avb",
345 "libfs_mgr",
346 "libfec",
347 "libfec_rs",
348 "libsquashfs_utils",
Jiyong Park13eb0532021-02-15 14:13:51 +0900349 "libcrypto_utils",
Jiyong Park13eb0532021-02-15 14:13:51 +0900350 "libavb",
Jiyong Park13eb0532021-02-15 14:13:51 +0900351 "liblp",
352 "libcutils",
353 "libbase",
354 "liblog",
355 "libcrypto_static",
Jiyong Park13eb0532021-02-15 14:13:51 +0900356 "libselinux",
357 "libcap",
358 "libgsi",
Jiyong Park13eb0532021-02-15 14:13:51 +0900359 "liblzma",
360 "libunwindstack_no_dex",
Jiyong Park13eb0532021-02-15 14:13:51 +0900361 "libmodprobe",
362 "libext2_uuid",
363 "libprotobuf-cpp-lite",
364 "libsnapshot_cow",
365 "libsnapshot_init",
366 "update_metadata-protos",
David Anderson9fd88622021-03-05 14:10:55 -0800367 "libprocinfo",
Jiyong Park13eb0532021-02-15 14:13:51 +0900368 ],
369
370 static_executable: true,
Inseob Kim74182522021-06-11 12:58:53 +0900371 system_shared_libs: [],
Jiyong Park13eb0532021-02-15 14:13:51 +0900372
373 cflags: [
374 "-Wall",
375 "-Wextra",
376 "-Wno-unused-parameter",
377 "-Werror",
378 "-DALLOW_FIRST_STAGE_CONSOLE=0",
379 "-DALLOW_LOCAL_PROP_OVERRIDE=0",
380 "-DALLOW_PERMISSIVE_SELINUX=0",
381 "-DREBOOT_BOOTLOADER_ON_PANIC=0",
382 "-DWORLD_WRITABLE_KMSG=0",
383 "-DDUMP_ON_UMOUNT_FAILURE=0",
384 "-DSHUTDOWN_ZERO_TIMEOUT=0",
385 "-DLOG_UEVENTS=0",
386 "-DSEPOLICY_VERSION=30", // TODO(jiyong): externalize the version number
387 ],
388
389 product_variables: {
390 debuggable: {
391 cflags: [
392 "-UALLOW_FIRST_STAGE_CONSOLE",
393 "-DALLOW_FIRST_STAGE_CONSOLE=1",
394
395 "-UALLOW_LOCAL_PROP_OVERRIDE",
396 "-DALLOW_LOCAL_PROP_OVERRIDE=1",
397
398 "-UALLOW_PERMISSIVE_SELINUX",
399 "-DALLOW_PERMISSIVE_SELINUX=1",
400
401 "-UREBOOT_BOOTLOADER_ON_PANIC",
402 "-DREBOOT_BOOTLOADER_ON_PANIC=1",
403
404 "-UWORLD_WRITABLE_KMSG",
405 "-DWORLD_WRITABLE_KMSG=1",
406
407 "-UDUMP_ON_UMOUNT_FAILURE",
408 "-DDUMP_ON_UMOUNT_FAILURE=1",
409 ],
410 },
411
412 eng: {
413 cflags: [
414 "-USHUTDOWN_ZERO_TIMEOUT",
415 "-DSHUTDOWN_ZERO_TIMEOUT=1",
416 ],
417 },
418 },
419
420 sanitize: {
421 misc_undefined: ["signed-integer-overflow"],
Inseob Kim74182522021-06-11 12:58:53 +0900422
423 // First stage init is weird: it may start without stdout/stderr, and no /proc.
Jiyong Park13eb0532021-02-15 14:13:51 +0900424 hwaddress: false,
425 },
Inseob Kim74182522021-06-11 12:58:53 +0900426
427 // Install adb_debug.prop into debug ramdisk.
428 // This allows adb root on a user build, when debug ramdisk is used.
429 required: ["adb_debug.prop"],
430
431 ramdisk: true,
432
433 install_in_root: true,
434}
435
436phony {
437 name: "init_system",
438 required: ["init_second_stage"],
Jiyong Park13eb0532021-02-15 14:13:51 +0900439}
440
Tom Cherry14fc0132017-05-09 17:11:57 -0700441// Tests
442// ------------------------------------------------------------------------------
443
444cc_test {
Tom Cherry17b2be02019-08-20 10:43:48 -0700445 name: "CtsInitTestCases",
Tom Cherry14fc0132017-05-09 17:11:57 -0700446 defaults: ["init_defaults"],
Josh Gao6cad1392019-08-27 16:02:38 -0700447 require_root: true,
448
Tom Cherry17b2be02019-08-20 10:43:48 -0700449 compile_multilib: "both",
450 multilib: {
451 lib32: {
452 suffix: "32",
453 },
454 lib64: {
455 suffix: "64",
456 },
457 },
458
Tom Cherry14fc0132017-05-09 17:11:57 -0700459 srcs: [
460 "devices_test.cpp",
David Anderson1de73842021-05-13 20:18:14 -0700461 "epoll_test.cpp",
Tom Cherrydcb3d152019-08-07 16:02:28 -0700462 "firmware_handler_test.cpp",
Tom Cherry14fc0132017-05-09 17:11:57 -0700463 "init_test.cpp",
Mark Salyzyn75b901d2018-05-15 11:19:43 -0700464 "keychords_test.cpp",
Tom Cherrybdbf5042020-03-04 10:52:08 -0800465 "oneshot_on_test.cpp",
Tom Cherry16fad422017-08-04 15:59:03 -0700466 "persistent_properties_test.cpp",
Tom Cherry14fc0132017-05-09 17:11:57 -0700467 "property_service_test.cpp",
Tom Cherry927c5d52017-12-11 01:40:07 -0800468 "property_type_test.cpp",
Nikita Ioffe660ffde2020-12-10 16:52:35 +0000469 "reboot_test.cpp",
Tom Cherry7ac013d2017-08-25 10:39:25 -0700470 "rlimit_parser_test.cpp",
Tom Cherry14fc0132017-05-09 17:11:57 -0700471 "service_test.cpp",
Tom Cherrycb0f9bb2017-09-12 15:58:47 -0700472 "subcontext_test.cpp",
Tom Cherry2a5a4e72018-06-26 13:56:34 -0700473 "tokenizer_test.cpp",
Tom Cherry5f0198b2018-07-17 15:28:16 -0700474 "ueventd_parser_test.cpp",
Tom Cherryc2e181c2017-07-14 16:29:23 -0700475 "ueventd_test.cpp",
Tom Cherry14fc0132017-05-09 17:11:57 -0700476 "util_test.cpp",
477 ],
Tom Cherry618d3102018-01-19 14:25:48 -0800478 static_libs: ["libinit"],
Tom Cherry17b2be02019-08-20 10:43:48 -0700479
480 test_suites: [
481 "cts",
482 "device-tests",
Tom Cherry17b2be02019-08-20 10:43:48 -0700483 ],
Tom Cherry14fc0132017-05-09 17:11:57 -0700484}
485
Tom Cherrycb0f9bb2017-09-12 15:58:47 -0700486cc_benchmark {
487 name: "init_benchmarks",
488 defaults: ["init_defaults"],
489 srcs: [
490 "subcontext_benchmark.cpp",
491 ],
Tom Cherry618d3102018-01-19 14:25:48 -0800492 static_libs: ["libinit"],
Tom Cherrycb0f9bb2017-09-12 15:58:47 -0700493}
494
Tom Cherrya2f91362020-02-20 10:50:00 -0800495cc_defaults {
496 name: "libinit_test_utils_libraries_defaults",
497 shared_libs: [
498 "libbase",
499 "libcutils",
500 "libselinux",
501 "libhidl-gen-utils",
502 "liblog",
503 "libprocessgroup",
504 "libprotobuf-cpp-lite",
505 ],
506}
507
508cc_library_static {
509 name: "libinit_test_utils",
510 defaults: ["libinit_test_utils_libraries_defaults"],
511 cflags: [
512 "-Wall",
513 "-Wextra",
514 "-Wno-unused-parameter",
515 "-Werror",
516 ],
517 srcs: init_common_sources + [
518 "test_utils/service_utils.cpp",
519 ],
520 whole_static_libs: [
521 "libcap",
522 ],
523 export_include_dirs: ["test_utils/include"], // for tests
524}
525
Tom Cherryde6bd502018-02-13 16:50:08 -0800526// Host Verifier
527// ------------------------------------------------------------------------------
528
529genrule {
530 name: "generated_stub_builtin_function_map",
Tom Cherry4772f1d2019-07-30 09:34:41 -0700531 tool_files: ["host_builtin_map.py"],
Tom Cherryde6bd502018-02-13 16:50:08 -0800532 out: ["generated_stub_builtin_function_map.h"],
Daniel Normand2533c32019-08-02 15:13:50 -0700533 srcs: [
534 "builtins.cpp",
535 "check_builtins.cpp",
536 ],
Tom Cherry4772f1d2019-07-30 09:34:41 -0700537 cmd: "$(location host_builtin_map.py) --builtins $(location builtins.cpp) --check_builtins $(location check_builtins.cpp) > $(out)",
Tom Cherryde6bd502018-02-13 16:50:08 -0800538}
539
Daniel Normanf1200fb2022-03-09 10:49:26 -0800540cc_defaults {
541 name: "init_host_defaults",
Tom Cherryde6bd502018-02-13 16:50:08 -0800542 host_supported: true,
Tom Cherryde6bd502018-02-13 16:50:08 -0800543 cflags: [
544 "-Wall",
545 "-Wextra",
546 "-Wno-unused-parameter",
547 "-Werror",
548 ],
549 static_libs: [
550 "libbase",
551 "libselinux",
Tom Cherryb5f2ec02019-11-08 17:54:27 -0800552 "libpropertyinfoserializer",
553 "libpropertyinfoparser",
Tom Cherryde6bd502018-02-13 16:50:08 -0800554 ],
555 whole_static_libs: ["libcap"],
556 shared_libs: [
Tom Cherryde6bd502018-02-13 16:50:08 -0800557 "libcutils",
Daniel Norman3f42a762019-07-09 11:00:53 -0700558 "libhidl-gen-utils",
Steven Moreland422a7582019-10-15 14:53:19 -0700559 "libhidlmetadata",
Daniel Norman3f42a762019-07-09 11:00:53 -0700560 "liblog",
561 "libprocessgroup",
562 "libprotobuf-cpp-lite",
Tom Cherryde6bd502018-02-13 16:50:08 -0800563 ],
Tom Cherryde6bd502018-02-13 16:50:08 -0800564 proto: {
565 type: "lite",
566 },
Yifan Hong3c4aa112018-06-20 22:49:48 +0000567 generated_headers: [
568 "generated_stub_builtin_function_map",
Daniel Norman8082ba22019-07-23 10:26:15 -0700569 "generated_android_ids",
Yifan Hong3c4aa112018-06-20 22:49:48 +0000570 ],
Tom Cherry96ff0fe2018-02-28 17:20:27 -0800571 target: {
Tom Cherry547f7312018-02-28 21:40:46 -0800572 android: {
573 enabled: false,
574 },
Tom Cherry96ff0fe2018-02-28 17:20:27 -0800575 darwin: {
Yifan Hong3c4aa112018-06-20 22:49:48 +0000576 enabled: false,
Tom Cherry96ff0fe2018-02-28 17:20:27 -0800577 },
578 },
Tom Cherryde6bd502018-02-13 16:50:08 -0800579}
Suren Baghdasaryan642048d2021-06-15 12:28:24 -0700580
Daniel Normanf1200fb2022-03-09 10:49:26 -0800581cc_binary {
582 name: "host_init_verifier",
583 defaults: ["init_host_defaults"],
584 srcs: init_common_sources + init_host_sources,
585}
586
587cc_library_host_static {
588 name: "libinit_host",
589 defaults: ["init_host_defaults"],
590 srcs: init_common_sources,
591 export_include_dirs: ["."],
592 proto: {
593 export_proto_headers: true,
594 },
595 visibility: [
596 // host_apex_verifier performs a subset of init.rc validation
597 "//system/apex/tools",
598 ],
599}
600
Suren Baghdasaryan642048d2021-06-15 12:28:24 -0700601sh_binary {
602 name: "extra_free_kbytes.sh",
603 src: "extra_free_kbytes.sh",
604}