blob: 06f696e4c2936f37ba3f25af7bd676ce59b22b72 [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",
Bart Van Assche1693f422022-10-19 16:30:15 -070042 "interprocess_fifo.cpp",
Tom Cherry66196492020-02-06 11:56:58 -080043 "keychords.cpp",
44 "parser.cpp",
45 "property_type.cpp",
46 "rlimit_parser.cpp",
47 "service.cpp",
48 "service_list.cpp",
49 "service_parser.cpp",
50 "service_utils.cpp",
51 "subcontext.cpp",
52 "subcontext.proto",
53 "tokenizer.cpp",
54 "util.cpp",
55]
56init_device_sources = [
Deyao Ren238e9092022-07-21 23:05:13 +000057 "apex_init_util.cpp",
David Anderson41175592020-03-20 19:38:28 -070058 "block_dev_initializer.cpp",
Tom Cherry66196492020-02-06 11:56:58 -080059 "bootchart.cpp",
60 "builtins.cpp",
61 "devices.cpp",
62 "firmware_handler.cpp",
Steve Mucklea4bf2ce2019-11-01 13:58:02 -070063 "first_stage_console.cpp",
Tom Cherry66196492020-02-06 11:56:58 -080064 "first_stage_init.cpp",
65 "first_stage_mount.cpp",
66 "fscrypt_init_extensions.cpp",
67 "init.cpp",
68 "lmkd_service.cpp",
69 "modalias_handler.cpp",
70 "mount_handler.cpp",
71 "mount_namespace.cpp",
72 "persistent_properties.cpp",
73 "persistent_properties.proto",
74 "property_service.cpp",
75 "property_service.proto",
76 "reboot.cpp",
77 "reboot_utils.cpp",
78 "security.cpp",
79 "selabel.cpp",
80 "selinux.cpp",
81 "sigchld_handler.cpp",
David Anderson491e4da2020-12-08 00:21:20 -080082 "snapuserd_transition.cpp",
Tom Cherry66196492020-02-06 11:56:58 -080083 "switch_root.cpp",
84 "uevent_listener.cpp",
85 "ueventd.cpp",
86 "ueventd_parser.cpp",
87]
88init_host_sources = [
89 "check_builtins.cpp",
90 "host_import_parser.cpp",
91 "host_init_verifier.cpp",
92]
93
Yi-Yo Chiangbb77c542021-09-23 14:14:16 +000094soong_config_module_type {
95 name: "libinit_cc_defaults",
96 module_type: "cc_defaults",
97 config_namespace: "ANDROID",
98 bool_variables: [
99 "PRODUCT_INSTALL_DEBUG_POLICY_TO_SYSTEM_EXT",
100 ],
101 properties: [
102 "cflags",
103 ],
104}
105
106libinit_cc_defaults {
Tom Cherry14fc0132017-05-09 17:11:57 -0700107 name: "init_defaults",
Tom Cherry14fc0132017-05-09 17:11:57 -0700108 sanitize: {
Tom Cherry2ffd65e2017-07-26 14:17:09 -0700109 misc_undefined: ["signed-integer-overflow"],
Tom Cherry14fc0132017-05-09 17:11:57 -0700110 },
Chih-Hung Hsieh122352d2017-10-02 15:20:07 -0700111 cflags: [
Tom Cherry14fc0132017-05-09 17:11:57 -0700112 "-DLOG_UEVENTS=0",
113 "-Wall",
114 "-Wextra",
115 "-Wno-unused-parameter",
116 "-Werror",
Tom Cherry802864c2020-03-12 14:29:25 -0700117 "-Wthread-safety",
Steve Muckled75f30a2019-05-21 15:50:39 -0700118 "-DALLOW_FIRST_STAGE_CONSOLE=0",
Tom Cherry14fc0132017-05-09 17:11:57 -0700119 "-DALLOW_LOCAL_PROP_OVERRIDE=0",
120 "-DALLOW_PERMISSIVE_SELINUX=0",
121 "-DREBOOT_BOOTLOADER_ON_PANIC=0",
122 "-DWORLD_WRITABLE_KMSG=0",
123 "-DDUMP_ON_UMOUNT_FAILURE=0",
124 "-DSHUTDOWN_ZERO_TIMEOUT=0",
Tom Cherrya2f91362020-02-20 10:50:00 -0800125 "-DINIT_FULL_SOURCES",
Yi-Yo Chiangbb77c542021-09-23 14:14:16 +0000126 "-DINSTALL_DEBUG_POLICY_TO_SYSTEM_EXT=0",
Tom Cherry14fc0132017-05-09 17:11:57 -0700127 ],
128 product_variables: {
129 debuggable: {
130 cppflags: [
Steve Muckled75f30a2019-05-21 15:50:39 -0700131 "-UALLOW_FIRST_STAGE_CONSOLE",
132 "-DALLOW_FIRST_STAGE_CONSOLE=1",
Tom Cherry14fc0132017-05-09 17:11:57 -0700133 "-UALLOW_LOCAL_PROP_OVERRIDE",
134 "-DALLOW_LOCAL_PROP_OVERRIDE=1",
135 "-UALLOW_PERMISSIVE_SELINUX",
136 "-DALLOW_PERMISSIVE_SELINUX=1",
137 "-UREBOOT_BOOTLOADER_ON_PANIC",
138 "-DREBOOT_BOOTLOADER_ON_PANIC=1",
139 "-UWORLD_WRITABLE_KMSG",
140 "-DWORLD_WRITABLE_KMSG=1",
141 "-UDUMP_ON_UMOUNT_FAILURE",
142 "-DDUMP_ON_UMOUNT_FAILURE=1",
143 ],
144 },
145 eng: {
146 cppflags: [
147 "-USHUTDOWN_ZERO_TIMEOUT",
148 "-DSHUTDOWN_ZERO_TIMEOUT=1",
149 ],
150 },
Dmitry Shmidtc3bc5092017-08-23 14:57:07 -0700151 uml: {
152 cppflags: ["-DUSER_MODE_LINUX"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800153 },
Tom Cherry14fc0132017-05-09 17:11:57 -0700154 },
Yi-Yo Chiangbb77c542021-09-23 14:14:16 +0000155 soong_config_variables: {
156 PRODUCT_INSTALL_DEBUG_POLICY_TO_SYSTEM_EXT: {
157 cflags: [
158 "-UINSTALL_DEBUG_POLICY_TO_SYSTEM_EXT",
159 "-DINSTALL_DEBUG_POLICY_TO_SYSTEM_EXT=1",
160 ],
161 },
162 },
Tom Cherry618d3102018-01-19 14:25:48 -0800163 static_libs: [
Tom Cherry618d3102018-01-19 14:25:48 -0800164 "libavb",
David Anderson12e53bc2022-10-03 21:37:12 -0700165 "libbootloader_message",
Bowgo Tsai30afda72019-04-11 23:57:24 +0800166 "libc++fs",
Yifan Hongd8ce1fb2019-03-22 17:21:58 -0700167 "libcgrouprc_format",
Jeffrey Vander Stoepbaeece62022-02-08 12:42:33 +0000168 "libfsverity_init",
Suren Baghdasaryanc29c2ba2019-10-22 17:18:42 -0700169 "liblmkd_utils",
Kelvin Zhang5cb1b022022-04-11 17:29:27 -0700170 "liblz4",
Jeffrey Vander Stoepbaeece62022-02-08 12:42:33 +0000171 "libmini_keyctl_static",
Steve Muckle18b981e2019-04-15 17:43:02 -0700172 "libmodprobe",
David Anderson9fd88622021-03-05 14:10:55 -0800173 "libprocinfo",
Tom Cherry618d3102018-01-19 14:25:48 -0800174 "libprotobuf-cpp-lite",
175 "libpropertyinfoserializer",
176 "libpropertyinfoparser",
Jeffrey Vander Stoepbaeece62022-02-08 12:42:33 +0000177 "libsigningutils",
David Andersonaca0bea2020-09-21 16:34:25 -0700178 "libsnapshot_cow",
David Andersondfe6d072019-10-09 16:24:03 -0700179 "libsnapshot_init",
Jooyung Han1d951b72020-07-05 03:33:36 +0900180 "libxml2",
Jiyong Park648ae3a2019-12-08 00:25:15 +0900181 "lib_apex_manifest_proto_lite",
Yifan Hong66f01152020-04-16 11:05:16 -0700182 "update_metadata-protos",
Jiyong Park787322c2018-06-01 19:26:42 +0900183 ],
184 shared_libs: [
Jiyong Park787322c2018-06-01 19:26:42 +0900185 "libbase",
Jeffrey Vander Stoepbaeece62022-02-08 12:42:33 +0000186 "libcrypto",
Tao Bao66209ca2018-07-25 22:35:45 -0700187 "libcutils",
Jiyong Park787322c2018-06-01 19:26:42 +0900188 "libdl",
Tao Bao66209ca2018-07-25 22:35:45 -0700189 "libext4_utils",
190 "libfs_mgr",
David Anderson0e330f12019-01-03 18:16:56 -0800191 "libgsi",
Tao Bao66209ca2018-07-25 22:35:45 -0700192 "libhidl-gen-utils",
193 "libkeyutils",
194 "liblog",
195 "liblogwrap",
Tom Cherry7bfea3d2018-11-06 14:12:05 -0800196 "liblp",
Suren Baghdasaryan82b72a52018-12-21 11:41:50 -0800197 "libprocessgroup",
Yifan Hong6f9ce2e2019-03-05 15:47:16 -0800198 "libprocessgroup_setup",
Jiyong Park012171d2018-06-19 16:55:05 +0900199 "libselinux",
Christopher Ferrisd2bd6c52022-05-11 14:42:38 -0700200 "libunwindstack",
Martijn Coenen62e985a2018-09-04 06:29:14 +0200201 "libutils",
Jeffrey Vander Stoepbaeece62022-02-08 12:42:33 +0000202 "libziparchive",
Tom Cherry618d3102018-01-19 14:25:48 -0800203 ],
Florian Mayerd705c2d2022-09-12 18:19:47 -0700204 header_libs: ["bionic_libc_platform_headers"],
Jiyong Park93318d42018-12-26 17:34:39 +0900205 bootstrap: true,
Daniel Norman8082ba22019-07-23 10:26:15 -0700206 visibility: [":__subpackages__"],
Tom Cherry14fc0132017-05-09 17:11:57 -0700207}
208
Devendra Singhi1df957b2022-02-15 21:52:55 +0530209cc_library_headers {
210 name: "libinit_headers",
211 export_include_dirs: ["."],
212 visibility: [":__subpackages__"],
213}
214
Tom Cherry14fc0132017-05-09 17:11:57 -0700215cc_library_static {
216 name: "libinit",
Tom Cherry31438482018-07-20 14:57:00 -0700217 recovery_available: true,
Daniel Norman8082ba22019-07-23 10:26:15 -0700218 defaults: [
219 "init_defaults",
220 "selinux_policy_version",
221 ],
Tom Cherry66196492020-02-06 11:56:58 -0800222 srcs: init_common_sources + init_device_sources,
Deyao Ren07595e12022-07-15 22:02:14 +0000223 export_include_dirs: ["."],
Jooyung Han1d951b72020-07-05 03:33:36 +0900224 generated_sources: [
225 "apex-info-list",
226 ],
Daniel Norman8082ba22019-07-23 10:26:15 -0700227 whole_static_libs: [
228 "libcap",
Trevor Radcliffefcfd7252022-06-08 14:19:45 +0000229 "libcom.android.sysprop.apex",
230 "libcom.android.sysprop.init",
Daniel Norman8082ba22019-07-23 10:26:15 -0700231 ],
Jayant Chowdhary478c7c12018-03-28 18:45:35 -0700232 header_libs: ["bootimg_headers"],
Tom Cherrya97faba2017-09-15 15:44:04 -0700233 proto: {
234 type: "lite",
235 export_proto_headers: true,
236 },
Martijn Coenen62e985a2018-09-04 06:29:14 +0200237
238 target: {
239 recovery: {
240 cflags: ["-DRECOVERY"],
Jooyung Han1d951b72020-07-05 03:33:36 +0900241 exclude_static_libs: [
242 "libxml2",
243 ],
244 exclude_generated_sources: [
245 "apex-info-list",
246 ],
Daniel Norman8082ba22019-07-23 10:26:15 -0700247 exclude_shared_libs: [
248 "libbinder",
249 "libutils",
250 ],
Martijn Coenen62e985a2018-09-04 06:29:14 +0200251 },
252 },
Deyao Ren07595e12022-07-15 22:02:14 +0000253 visibility: [
254 "//system/apex/apexd",
255 "//frameworks/native/cmds/installd",
256 ],
Tom Cherry14fc0132017-05-09 17:11:57 -0700257}
258
Steven Morelandceb36d02019-07-15 15:12:56 -0700259phony {
260 name: "init",
261 required: [
262 "init_second_stage",
263 ],
264}
265
Tom Cherry14fc0132017-05-09 17:11:57 -0700266cc_binary {
Tom Cherry31438482018-07-20 14:57:00 -0700267 name: "init_second_stage",
268 recovery_available: true,
269 stem: "init",
Tom Cherry14fc0132017-05-09 17:11:57 -0700270 defaults: ["init_defaults"],
Tom Cherry31438482018-07-20 14:57:00 -0700271 static_libs: ["libinit"],
Tom Cherry618d3102018-01-19 14:25:48 -0800272 srcs: ["main.cpp"],
Tom Cherry31438482018-07-20 14:57:00 -0700273 symlinks: ["ueventd"],
Martijn Coenen62e985a2018-09-04 06:29:14 +0200274 target: {
Yi-Yo Chiang9ba6a5b2021-07-24 22:50:17 +0800275 platform: {
276 required: [
277 "init.rc",
278 "ueventd.rc",
279 "e2fsdroid",
Cole Faust7e279e92022-09-05 18:12:42 -0700280 "extra_free_kbytes",
Yi-Yo Chiang9ba6a5b2021-07-24 22:50:17 +0800281 "make_f2fs",
282 "mke2fs",
283 "sload_f2fs",
284 ],
285 },
Martijn Coenen62e985a2018-09-04 06:29:14 +0200286 recovery: {
287 cflags: ["-DRECOVERY"],
Jooyung Han1d951b72020-07-05 03:33:36 +0900288 exclude_static_libs: [
289 "libxml2",
290 ],
Daniel Norman8082ba22019-07-23 10:26:15 -0700291 exclude_shared_libs: [
292 "libbinder",
293 "libutils",
294 ],
Yi-Yo Chiang9ba6a5b2021-07-24 22:50:17 +0800295 required: [
296 "init_recovery.rc",
297 "ueventd.rc.recovery",
298 "e2fsdroid.recovery",
299 "make_f2fs.recovery",
300 "mke2fs.recovery",
301 "sload_f2fs.recovery",
302 ],
Martijn Coenen62e985a2018-09-04 06:29:14 +0200303 },
304 },
Jiyong Park90353782021-01-25 18:41:40 +0900305 visibility: ["//packages/modules/Virtualization/microdroid"],
Tom Cherry14fc0132017-05-09 17:11:57 -0700306}
Tom Cherry14fc0132017-05-09 17:11:57 -0700307
Inseob Kim74182522021-06-11 12:58:53 +0900308soong_config_module_type {
309 name: "init_first_stage_cc_defaults",
310 module_type: "cc_defaults",
311 config_namespace: "ANDROID",
Yi-Yo Chiangddc97632022-10-07 21:15:03 +0800312 bool_variables: ["BOARD_USES_RECOVERY_AS_BOOT"],
Inseob Kim74182522021-06-11 12:58:53 +0900313 properties: ["installable"],
314}
315
316// Do not install init_first_stage even with mma if we're system-as-root.
317// Otherwise, it will overwrite the symlink.
318init_first_stage_cc_defaults {
319 name: "init_first_stage_defaults",
320 soong_config_variables: {
Bowgo Tsaiab079af2021-07-14 15:39:53 +0800321 BOARD_USES_RECOVERY_AS_BOOT: {
322 installable: false,
323 },
Inseob Kim74182522021-06-11 12:58:53 +0900324 },
325}
326
Jiyong Park13eb0532021-02-15 14:13:51 +0900327cc_binary {
Inseob Kim74182522021-06-11 12:58:53 +0900328 name: "init_first_stage",
329 stem: "init",
330 defaults: ["init_first_stage_defaults"],
Jiyong Park13eb0532021-02-15 14:13:51 +0900331
332 srcs: [
333 "block_dev_initializer.cpp",
334 "devices.cpp",
335 "first_stage_console.cpp",
336 "first_stage_init.cpp",
337 "first_stage_main.cpp",
338 "first_stage_mount.cpp",
339 "reboot_utils.cpp",
340 "selabel.cpp",
Jiyong Park13eb0532021-02-15 14:13:51 +0900341 "service_utils.cpp",
342 "snapuserd_transition.cpp",
343 "switch_root.cpp",
344 "uevent_listener.cpp",
345 "util.cpp",
346 ],
347
348 static_libs: [
349 "libc++fs",
350 "libfs_avb",
351 "libfs_mgr",
352 "libfec",
353 "libfec_rs",
354 "libsquashfs_utils",
Jiyong Park13eb0532021-02-15 14:13:51 +0900355 "libcrypto_utils",
Jiyong Park13eb0532021-02-15 14:13:51 +0900356 "libavb",
Jiyong Park13eb0532021-02-15 14:13:51 +0900357 "liblp",
358 "libcutils",
359 "libbase",
360 "liblog",
361 "libcrypto_static",
Jiyong Park13eb0532021-02-15 14:13:51 +0900362 "libselinux",
363 "libcap",
364 "libgsi",
Jiyong Park13eb0532021-02-15 14:13:51 +0900365 "liblzma",
366 "libunwindstack_no_dex",
Jiyong Park13eb0532021-02-15 14:13:51 +0900367 "libmodprobe",
368 "libext2_uuid",
369 "libprotobuf-cpp-lite",
370 "libsnapshot_cow",
Kelvin Zhang5cb1b022022-04-11 17:29:27 -0700371 "liblz4",
Jiyong Park13eb0532021-02-15 14:13:51 +0900372 "libsnapshot_init",
373 "update_metadata-protos",
David Anderson9fd88622021-03-05 14:10:55 -0800374 "libprocinfo",
Jiyong Park13eb0532021-02-15 14:13:51 +0900375 ],
376
377 static_executable: true,
Inseob Kim74182522021-06-11 12:58:53 +0900378 system_shared_libs: [],
Jiyong Park13eb0532021-02-15 14:13:51 +0900379
380 cflags: [
381 "-Wall",
382 "-Wextra",
383 "-Wno-unused-parameter",
384 "-Werror",
385 "-DALLOW_FIRST_STAGE_CONSOLE=0",
386 "-DALLOW_LOCAL_PROP_OVERRIDE=0",
387 "-DALLOW_PERMISSIVE_SELINUX=0",
388 "-DREBOOT_BOOTLOADER_ON_PANIC=0",
389 "-DWORLD_WRITABLE_KMSG=0",
390 "-DDUMP_ON_UMOUNT_FAILURE=0",
391 "-DSHUTDOWN_ZERO_TIMEOUT=0",
392 "-DLOG_UEVENTS=0",
393 "-DSEPOLICY_VERSION=30", // TODO(jiyong): externalize the version number
394 ],
395
396 product_variables: {
397 debuggable: {
398 cflags: [
399 "-UALLOW_FIRST_STAGE_CONSOLE",
400 "-DALLOW_FIRST_STAGE_CONSOLE=1",
401
402 "-UALLOW_LOCAL_PROP_OVERRIDE",
403 "-DALLOW_LOCAL_PROP_OVERRIDE=1",
404
405 "-UALLOW_PERMISSIVE_SELINUX",
406 "-DALLOW_PERMISSIVE_SELINUX=1",
407
408 "-UREBOOT_BOOTLOADER_ON_PANIC",
409 "-DREBOOT_BOOTLOADER_ON_PANIC=1",
410
411 "-UWORLD_WRITABLE_KMSG",
412 "-DWORLD_WRITABLE_KMSG=1",
413
414 "-UDUMP_ON_UMOUNT_FAILURE",
415 "-DDUMP_ON_UMOUNT_FAILURE=1",
416 ],
417 },
418
419 eng: {
420 cflags: [
421 "-USHUTDOWN_ZERO_TIMEOUT",
422 "-DSHUTDOWN_ZERO_TIMEOUT=1",
423 ],
424 },
425 },
426
427 sanitize: {
428 misc_undefined: ["signed-integer-overflow"],
Inseob Kim74182522021-06-11 12:58:53 +0900429
430 // First stage init is weird: it may start without stdout/stderr, and no /proc.
Jiyong Park13eb0532021-02-15 14:13:51 +0900431 hwaddress: false,
432 },
Inseob Kim74182522021-06-11 12:58:53 +0900433
434 // Install adb_debug.prop into debug ramdisk.
435 // This allows adb root on a user build, when debug ramdisk is used.
436 required: ["adb_debug.prop"],
437
438 ramdisk: true,
439
440 install_in_root: true,
441}
442
443phony {
444 name: "init_system",
445 required: ["init_second_stage"],
Jiyong Park13eb0532021-02-15 14:13:51 +0900446}
447
Tom Cherry14fc0132017-05-09 17:11:57 -0700448// Tests
449// ------------------------------------------------------------------------------
450
451cc_test {
Tom Cherry17b2be02019-08-20 10:43:48 -0700452 name: "CtsInitTestCases",
Tom Cherry14fc0132017-05-09 17:11:57 -0700453 defaults: ["init_defaults"],
Josh Gao6cad1392019-08-27 16:02:38 -0700454 require_root: true,
455
Tom Cherry17b2be02019-08-20 10:43:48 -0700456 compile_multilib: "both",
457 multilib: {
458 lib32: {
459 suffix: "32",
460 },
461 lib64: {
462 suffix: "64",
463 },
464 },
465
Tom Cherry14fc0132017-05-09 17:11:57 -0700466 srcs: [
467 "devices_test.cpp",
David Anderson1de73842021-05-13 20:18:14 -0700468 "epoll_test.cpp",
Tom Cherrydcb3d152019-08-07 16:02:28 -0700469 "firmware_handler_test.cpp",
Tom Cherry14fc0132017-05-09 17:11:57 -0700470 "init_test.cpp",
Bart Van Assche1693f422022-10-19 16:30:15 -0700471 "interprocess_fifo_test.cpp",
Mark Salyzyn75b901d2018-05-15 11:19:43 -0700472 "keychords_test.cpp",
Tom Cherrybdbf5042020-03-04 10:52:08 -0800473 "oneshot_on_test.cpp",
Tom Cherry16fad422017-08-04 15:59:03 -0700474 "persistent_properties_test.cpp",
Tom Cherry14fc0132017-05-09 17:11:57 -0700475 "property_service_test.cpp",
Tom Cherry927c5d52017-12-11 01:40:07 -0800476 "property_type_test.cpp",
Nikita Ioffe660ffde2020-12-10 16:52:35 +0000477 "reboot_test.cpp",
Tom Cherry7ac013d2017-08-25 10:39:25 -0700478 "rlimit_parser_test.cpp",
Tom Cherry14fc0132017-05-09 17:11:57 -0700479 "service_test.cpp",
Tom Cherrycb0f9bb2017-09-12 15:58:47 -0700480 "subcontext_test.cpp",
Tom Cherry2a5a4e72018-06-26 13:56:34 -0700481 "tokenizer_test.cpp",
Tom Cherry5f0198b2018-07-17 15:28:16 -0700482 "ueventd_parser_test.cpp",
Tom Cherryc2e181c2017-07-14 16:29:23 -0700483 "ueventd_test.cpp",
Tom Cherry14fc0132017-05-09 17:11:57 -0700484 "util_test.cpp",
485 ],
Bart Van Assche1693f422022-10-19 16:30:15 -0700486 static_libs: [
487 "libgmock",
488 "libinit",
489 ],
Tom Cherry17b2be02019-08-20 10:43:48 -0700490
491 test_suites: [
492 "cts",
493 "device-tests",
Tom Cherry17b2be02019-08-20 10:43:48 -0700494 ],
Tom Cherry14fc0132017-05-09 17:11:57 -0700495}
496
Tom Cherrycb0f9bb2017-09-12 15:58:47 -0700497cc_benchmark {
498 name: "init_benchmarks",
499 defaults: ["init_defaults"],
500 srcs: [
501 "subcontext_benchmark.cpp",
502 ],
Tom Cherry618d3102018-01-19 14:25:48 -0800503 static_libs: ["libinit"],
Tom Cherrycb0f9bb2017-09-12 15:58:47 -0700504}
505
Tom Cherrya2f91362020-02-20 10:50:00 -0800506cc_defaults {
507 name: "libinit_test_utils_libraries_defaults",
508 shared_libs: [
509 "libbase",
510 "libcutils",
511 "libselinux",
512 "libhidl-gen-utils",
513 "liblog",
514 "libprocessgroup",
515 "libprotobuf-cpp-lite",
516 ],
517}
518
519cc_library_static {
520 name: "libinit_test_utils",
521 defaults: ["libinit_test_utils_libraries_defaults"],
522 cflags: [
523 "-Wall",
524 "-Wextra",
525 "-Wno-unused-parameter",
526 "-Werror",
527 ],
528 srcs: init_common_sources + [
529 "test_utils/service_utils.cpp",
530 ],
531 whole_static_libs: [
532 "libcap",
533 ],
534 export_include_dirs: ["test_utils/include"], // for tests
Florian Mayerd705c2d2022-09-12 18:19:47 -0700535 header_libs: ["bionic_libc_platform_headers"],
Tom Cherrya2f91362020-02-20 10:50:00 -0800536}
537
Tom Cherryde6bd502018-02-13 16:50:08 -0800538// Host Verifier
539// ------------------------------------------------------------------------------
540
541genrule {
542 name: "generated_stub_builtin_function_map",
Tom Cherry4772f1d2019-07-30 09:34:41 -0700543 tool_files: ["host_builtin_map.py"],
Tom Cherryde6bd502018-02-13 16:50:08 -0800544 out: ["generated_stub_builtin_function_map.h"],
Daniel Normand2533c32019-08-02 15:13:50 -0700545 srcs: [
546 "builtins.cpp",
547 "check_builtins.cpp",
548 ],
Tom Cherry4772f1d2019-07-30 09:34:41 -0700549 cmd: "$(location host_builtin_map.py) --builtins $(location builtins.cpp) --check_builtins $(location check_builtins.cpp) > $(out)",
Tom Cherryde6bd502018-02-13 16:50:08 -0800550}
551
Daniel Normanf1200fb2022-03-09 10:49:26 -0800552cc_defaults {
553 name: "init_host_defaults",
Tom Cherryde6bd502018-02-13 16:50:08 -0800554 host_supported: true,
Tom Cherryde6bd502018-02-13 16:50:08 -0800555 cflags: [
556 "-Wall",
557 "-Wextra",
558 "-Wno-unused-parameter",
559 "-Werror",
560 ],
561 static_libs: [
562 "libbase",
563 "libselinux",
Tom Cherryb5f2ec02019-11-08 17:54:27 -0800564 "libpropertyinfoserializer",
565 "libpropertyinfoparser",
Tom Cherryde6bd502018-02-13 16:50:08 -0800566 ],
567 whole_static_libs: ["libcap"],
568 shared_libs: [
Tom Cherryde6bd502018-02-13 16:50:08 -0800569 "libcutils",
Daniel Norman3f42a762019-07-09 11:00:53 -0700570 "libhidl-gen-utils",
Steven Moreland422a7582019-10-15 14:53:19 -0700571 "libhidlmetadata",
Daniel Norman3f42a762019-07-09 11:00:53 -0700572 "liblog",
573 "libprocessgroup",
574 "libprotobuf-cpp-lite",
Tom Cherryde6bd502018-02-13 16:50:08 -0800575 ],
Tom Cherryde6bd502018-02-13 16:50:08 -0800576 proto: {
577 type: "lite",
578 },
Yifan Hong3c4aa112018-06-20 22:49:48 +0000579 generated_headers: [
580 "generated_stub_builtin_function_map",
Daniel Norman8082ba22019-07-23 10:26:15 -0700581 "generated_android_ids",
Yifan Hong3c4aa112018-06-20 22:49:48 +0000582 ],
Tom Cherry96ff0fe2018-02-28 17:20:27 -0800583 target: {
Tom Cherry547f7312018-02-28 21:40:46 -0800584 android: {
585 enabled: false,
586 },
Tom Cherry96ff0fe2018-02-28 17:20:27 -0800587 darwin: {
Yifan Hong3c4aa112018-06-20 22:49:48 +0000588 enabled: false,
Tom Cherry96ff0fe2018-02-28 17:20:27 -0800589 },
590 },
Tom Cherryde6bd502018-02-13 16:50:08 -0800591}
Suren Baghdasaryan642048d2021-06-15 12:28:24 -0700592
Daniel Normanf1200fb2022-03-09 10:49:26 -0800593cc_binary {
594 name: "host_init_verifier",
595 defaults: ["init_host_defaults"],
596 srcs: init_common_sources + init_host_sources,
597}
598
599cc_library_host_static {
600 name: "libinit_host",
601 defaults: ["init_host_defaults"],
602 srcs: init_common_sources,
603 export_include_dirs: ["."],
604 proto: {
605 export_proto_headers: true,
606 },
607 visibility: [
608 // host_apex_verifier performs a subset of init.rc validation
609 "//system/apex/tools",
610 ],
611}
612
Suren Baghdasaryan642048d2021-06-15 12:28:24 -0700613sh_binary {
Cole Faust7e279e92022-09-05 18:12:42 -0700614 name: "extra_free_kbytes",
Suren Baghdasaryan642048d2021-06-15 12:28:24 -0700615 src: "extra_free_kbytes.sh",
Cole Faust7e279e92022-09-05 18:12:42 -0700616 filename_from_src: true,
Suren Baghdasaryan642048d2021-06-15 12:28:24 -0700617}