blob: c7e7de8501699bc87e0cecfeb10770bcaa4e5699 [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: [
Steve Muckled75f30a2019-05-21 15:50:39 -0700112 "-DALLOW_FIRST_STAGE_CONSOLE=0",
Tom Cherry14fc0132017-05-09 17:11:57 -0700113 "-DALLOW_LOCAL_PROP_OVERRIDE=0",
114 "-DALLOW_PERMISSIVE_SELINUX=0",
Bart Van Asscheaee2ec82022-12-02 18:48:15 -0800115 "-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION",
Tom Cherry14fc0132017-05-09 17:11:57 -0700116 "-DDUMP_ON_UMOUNT_FAILURE=0",
Tom Cherrya2f91362020-02-20 10:50:00 -0800117 "-DINIT_FULL_SOURCES",
Yi-Yo Chiangbb77c542021-09-23 14:14:16 +0000118 "-DINSTALL_DEBUG_POLICY_TO_SYSTEM_EXT=0",
Bart Van Assche91ba2192022-12-02 18:48:48 -0800119 "-DLOG_UEVENTS=0",
120 "-DREBOOT_BOOTLOADER_ON_PANIC=0",
121 "-DSHUTDOWN_ZERO_TIMEOUT=0",
122 "-DWORLD_WRITABLE_KMSG=0",
123 "-Wall",
124 "-Werror",
125 "-Wextra",
126 "-Wno-unused-parameter",
127 "-Wthread-safety",
Tom Cherry14fc0132017-05-09 17:11:57 -0700128 ],
129 product_variables: {
130 debuggable: {
131 cppflags: [
Steve Muckled75f30a2019-05-21 15:50:39 -0700132 "-UALLOW_FIRST_STAGE_CONSOLE",
133 "-DALLOW_FIRST_STAGE_CONSOLE=1",
Tom Cherry14fc0132017-05-09 17:11:57 -0700134 "-UALLOW_LOCAL_PROP_OVERRIDE",
135 "-DALLOW_LOCAL_PROP_OVERRIDE=1",
136 "-UALLOW_PERMISSIVE_SELINUX",
137 "-DALLOW_PERMISSIVE_SELINUX=1",
138 "-UREBOOT_BOOTLOADER_ON_PANIC",
139 "-DREBOOT_BOOTLOADER_ON_PANIC=1",
140 "-UWORLD_WRITABLE_KMSG",
141 "-DWORLD_WRITABLE_KMSG=1",
142 "-UDUMP_ON_UMOUNT_FAILURE",
143 "-DDUMP_ON_UMOUNT_FAILURE=1",
144 ],
145 },
146 eng: {
147 cppflags: [
148 "-USHUTDOWN_ZERO_TIMEOUT",
149 "-DSHUTDOWN_ZERO_TIMEOUT=1",
150 ],
151 },
Dmitry Shmidtc3bc5092017-08-23 14:57:07 -0700152 uml: {
153 cppflags: ["-DUSER_MODE_LINUX"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800154 },
Tom Cherry14fc0132017-05-09 17:11:57 -0700155 },
Yi-Yo Chiangbb77c542021-09-23 14:14:16 +0000156 soong_config_variables: {
157 PRODUCT_INSTALL_DEBUG_POLICY_TO_SYSTEM_EXT: {
158 cflags: [
159 "-UINSTALL_DEBUG_POLICY_TO_SYSTEM_EXT",
160 "-DINSTALL_DEBUG_POLICY_TO_SYSTEM_EXT=1",
161 ],
162 },
163 },
Tom Cherry618d3102018-01-19 14:25:48 -0800164 static_libs: [
Tom Cherry618d3102018-01-19 14:25:48 -0800165 "libavb",
David Anderson12e53bc2022-10-03 21:37:12 -0700166 "libbootloader_message",
Bowgo Tsai30afda72019-04-11 23:57:24 +0800167 "libc++fs",
Yifan Hongd8ce1fb2019-03-22 17:21:58 -0700168 "libcgrouprc_format",
Jeffrey Vander Stoepbaeece62022-02-08 12:42:33 +0000169 "libfsverity_init",
Suren Baghdasaryanc29c2ba2019-10-22 17:18:42 -0700170 "liblmkd_utils",
Kelvin Zhang5cb1b022022-04-11 17:29:27 -0700171 "liblz4",
Jeffrey Vander Stoepbaeece62022-02-08 12:42:33 +0000172 "libmini_keyctl_static",
Steve Muckle18b981e2019-04-15 17:43:02 -0700173 "libmodprobe",
David Anderson9fd88622021-03-05 14:10:55 -0800174 "libprocinfo",
Tom Cherry618d3102018-01-19 14:25:48 -0800175 "libprotobuf-cpp-lite",
176 "libpropertyinfoserializer",
177 "libpropertyinfoparser",
Jeffrey Vander Stoepbaeece62022-02-08 12:42:33 +0000178 "libsigningutils",
David Andersonaca0bea2020-09-21 16:34:25 -0700179 "libsnapshot_cow",
David Andersondfe6d072019-10-09 16:24:03 -0700180 "libsnapshot_init",
Jooyung Han1d951b72020-07-05 03:33:36 +0900181 "libxml2",
Jiyong Park648ae3a2019-12-08 00:25:15 +0900182 "lib_apex_manifest_proto_lite",
Yifan Hong66f01152020-04-16 11:05:16 -0700183 "update_metadata-protos",
Jiyong Park787322c2018-06-01 19:26:42 +0900184 ],
185 shared_libs: [
Jiyong Park787322c2018-06-01 19:26:42 +0900186 "libbase",
Jeffrey Vander Stoepbaeece62022-02-08 12:42:33 +0000187 "libcrypto",
Tao Bao66209ca2018-07-25 22:35:45 -0700188 "libcutils",
Jiyong Park787322c2018-06-01 19:26:42 +0900189 "libdl",
Tao Bao66209ca2018-07-25 22:35:45 -0700190 "libext4_utils",
191 "libfs_mgr",
David Anderson0e330f12019-01-03 18:16:56 -0800192 "libgsi",
Tao Bao66209ca2018-07-25 22:35:45 -0700193 "libhidl-gen-utils",
194 "libkeyutils",
195 "liblog",
196 "liblogwrap",
Tom Cherry7bfea3d2018-11-06 14:12:05 -0800197 "liblp",
Suren Baghdasaryan82b72a52018-12-21 11:41:50 -0800198 "libprocessgroup",
Yifan Hong6f9ce2e2019-03-05 15:47:16 -0800199 "libprocessgroup_setup",
Jiyong Park012171d2018-06-19 16:55:05 +0900200 "libselinux",
Christopher Ferrisd2bd6c52022-05-11 14:42:38 -0700201 "libunwindstack",
Martijn Coenen62e985a2018-09-04 06:29:14 +0200202 "libutils",
Jeffrey Vander Stoepbaeece62022-02-08 12:42:33 +0000203 "libziparchive",
Tom Cherry618d3102018-01-19 14:25:48 -0800204 ],
Florian Mayerd705c2d2022-09-12 18:19:47 -0700205 header_libs: ["bionic_libc_platform_headers"],
Jiyong Park93318d42018-12-26 17:34:39 +0900206 bootstrap: true,
Daniel Norman8082ba22019-07-23 10:26:15 -0700207 visibility: [":__subpackages__"],
Tom Cherry14fc0132017-05-09 17:11:57 -0700208}
209
Devendra Singhi1df957b2022-02-15 21:52:55 +0530210cc_library_headers {
211 name: "libinit_headers",
212 export_include_dirs: ["."],
213 visibility: [":__subpackages__"],
214}
215
Tom Cherry14fc0132017-05-09 17:11:57 -0700216cc_library_static {
217 name: "libinit",
Tom Cherry31438482018-07-20 14:57:00 -0700218 recovery_available: true,
Daniel Norman8082ba22019-07-23 10:26:15 -0700219 defaults: [
220 "init_defaults",
221 "selinux_policy_version",
222 ],
Tom Cherry66196492020-02-06 11:56:58 -0800223 srcs: init_common_sources + init_device_sources,
Deyao Ren07595e12022-07-15 22:02:14 +0000224 export_include_dirs: ["."],
Jooyung Han1d951b72020-07-05 03:33:36 +0900225 generated_sources: [
226 "apex-info-list",
227 ],
Daniel Norman8082ba22019-07-23 10:26:15 -0700228 whole_static_libs: [
229 "libcap",
Trevor Radcliffefcfd7252022-06-08 14:19:45 +0000230 "libcom.android.sysprop.apex",
231 "libcom.android.sysprop.init",
Daniel Norman8082ba22019-07-23 10:26:15 -0700232 ],
Jayant Chowdhary478c7c12018-03-28 18:45:35 -0700233 header_libs: ["bootimg_headers"],
Tom Cherrya97faba2017-09-15 15:44:04 -0700234 proto: {
235 type: "lite",
236 export_proto_headers: true,
237 },
Martijn Coenen62e985a2018-09-04 06:29:14 +0200238
239 target: {
240 recovery: {
241 cflags: ["-DRECOVERY"],
Jooyung Han1d951b72020-07-05 03:33:36 +0900242 exclude_static_libs: [
243 "libxml2",
244 ],
245 exclude_generated_sources: [
246 "apex-info-list",
247 ],
Daniel Norman8082ba22019-07-23 10:26:15 -0700248 exclude_shared_libs: [
249 "libbinder",
250 "libutils",
251 ],
Martijn Coenen62e985a2018-09-04 06:29:14 +0200252 },
253 },
Deyao Ren07595e12022-07-15 22:02:14 +0000254 visibility: [
255 "//system/apex/apexd",
256 "//frameworks/native/cmds/installd",
257 ],
Tom Cherry14fc0132017-05-09 17:11:57 -0700258}
259
Steven Morelandceb36d02019-07-15 15:12:56 -0700260phony {
261 name: "init",
262 required: [
263 "init_second_stage",
264 ],
265}
266
Tom Cherry14fc0132017-05-09 17:11:57 -0700267cc_binary {
Tom Cherry31438482018-07-20 14:57:00 -0700268 name: "init_second_stage",
269 recovery_available: true,
270 stem: "init",
Tom Cherry14fc0132017-05-09 17:11:57 -0700271 defaults: ["init_defaults"],
Tom Cherry31438482018-07-20 14:57:00 -0700272 static_libs: ["libinit"],
Tom Cherry618d3102018-01-19 14:25:48 -0800273 srcs: ["main.cpp"],
Tom Cherry31438482018-07-20 14:57:00 -0700274 symlinks: ["ueventd"],
Martijn Coenen62e985a2018-09-04 06:29:14 +0200275 target: {
Yi-Yo Chiang9ba6a5b2021-07-24 22:50:17 +0800276 platform: {
277 required: [
278 "init.rc",
279 "ueventd.rc",
280 "e2fsdroid",
Cole Faust7e279e92022-09-05 18:12:42 -0700281 "extra_free_kbytes",
Yi-Yo Chiang9ba6a5b2021-07-24 22:50:17 +0800282 "make_f2fs",
283 "mke2fs",
284 "sload_f2fs",
285 ],
286 },
Martijn Coenen62e985a2018-09-04 06:29:14 +0200287 recovery: {
288 cflags: ["-DRECOVERY"],
Jooyung Han1d951b72020-07-05 03:33:36 +0900289 exclude_static_libs: [
290 "libxml2",
291 ],
Daniel Norman8082ba22019-07-23 10:26:15 -0700292 exclude_shared_libs: [
293 "libbinder",
294 "libutils",
295 ],
Yi-Yo Chiang9ba6a5b2021-07-24 22:50:17 +0800296 required: [
297 "init_recovery.rc",
298 "ueventd.rc.recovery",
299 "e2fsdroid.recovery",
300 "make_f2fs.recovery",
301 "mke2fs.recovery",
302 "sload_f2fs.recovery",
303 ],
Martijn Coenen62e985a2018-09-04 06:29:14 +0200304 },
305 },
Jiyong Park90353782021-01-25 18:41:40 +0900306 visibility: ["//packages/modules/Virtualization/microdroid"],
Tom Cherry14fc0132017-05-09 17:11:57 -0700307}
Tom Cherry14fc0132017-05-09 17:11:57 -0700308
Inseob Kim74182522021-06-11 12:58:53 +0900309soong_config_module_type {
310 name: "init_first_stage_cc_defaults",
311 module_type: "cc_defaults",
312 config_namespace: "ANDROID",
Yi-Yo Chiangddc97632022-10-07 21:15:03 +0800313 bool_variables: ["BOARD_USES_RECOVERY_AS_BOOT"],
Inseob Kim74182522021-06-11 12:58:53 +0900314 properties: ["installable"],
315}
316
317// Do not install init_first_stage even with mma if we're system-as-root.
318// Otherwise, it will overwrite the symlink.
319init_first_stage_cc_defaults {
320 name: "init_first_stage_defaults",
321 soong_config_variables: {
Bowgo Tsaiab079af2021-07-14 15:39:53 +0800322 BOARD_USES_RECOVERY_AS_BOOT: {
323 installable: false,
324 },
Inseob Kim74182522021-06-11 12:58:53 +0900325 },
326}
327
Jiyong Park13eb0532021-02-15 14:13:51 +0900328cc_binary {
Inseob Kim74182522021-06-11 12:58:53 +0900329 name: "init_first_stage",
330 stem: "init",
331 defaults: ["init_first_stage_defaults"],
Jiyong Park13eb0532021-02-15 14:13:51 +0900332
333 srcs: [
334 "block_dev_initializer.cpp",
335 "devices.cpp",
336 "first_stage_console.cpp",
337 "first_stage_init.cpp",
338 "first_stage_main.cpp",
339 "first_stage_mount.cpp",
340 "reboot_utils.cpp",
341 "selabel.cpp",
Jiyong Park13eb0532021-02-15 14:13:51 +0900342 "service_utils.cpp",
343 "snapuserd_transition.cpp",
344 "switch_root.cpp",
345 "uevent_listener.cpp",
346 "util.cpp",
347 ],
348
349 static_libs: [
350 "libc++fs",
351 "libfs_avb",
352 "libfs_mgr",
353 "libfec",
354 "libfec_rs",
355 "libsquashfs_utils",
Jiyong Park13eb0532021-02-15 14:13:51 +0900356 "libcrypto_utils",
Jiyong Park13eb0532021-02-15 14:13:51 +0900357 "libavb",
Jiyong Park13eb0532021-02-15 14:13:51 +0900358 "liblp",
359 "libcutils",
360 "libbase",
361 "liblog",
362 "libcrypto_static",
Jiyong Park13eb0532021-02-15 14:13:51 +0900363 "libselinux",
364 "libcap",
365 "libgsi",
Jiyong Park13eb0532021-02-15 14:13:51 +0900366 "liblzma",
367 "libunwindstack_no_dex",
Jiyong Park13eb0532021-02-15 14:13:51 +0900368 "libmodprobe",
369 "libext2_uuid",
370 "libprotobuf-cpp-lite",
371 "libsnapshot_cow",
Kelvin Zhang5cb1b022022-04-11 17:29:27 -0700372 "liblz4",
Jiyong Park13eb0532021-02-15 14:13:51 +0900373 "libsnapshot_init",
374 "update_metadata-protos",
David Anderson9fd88622021-03-05 14:10:55 -0800375 "libprocinfo",
Jiyong Park13eb0532021-02-15 14:13:51 +0900376 ],
377
378 static_executable: true,
Inseob Kim74182522021-06-11 12:58:53 +0900379 system_shared_libs: [],
Jiyong Park13eb0532021-02-15 14:13:51 +0900380
381 cflags: [
382 "-Wall",
383 "-Wextra",
384 "-Wno-unused-parameter",
385 "-Werror",
386 "-DALLOW_FIRST_STAGE_CONSOLE=0",
387 "-DALLOW_LOCAL_PROP_OVERRIDE=0",
388 "-DALLOW_PERMISSIVE_SELINUX=0",
389 "-DREBOOT_BOOTLOADER_ON_PANIC=0",
390 "-DWORLD_WRITABLE_KMSG=0",
391 "-DDUMP_ON_UMOUNT_FAILURE=0",
392 "-DSHUTDOWN_ZERO_TIMEOUT=0",
393 "-DLOG_UEVENTS=0",
394 "-DSEPOLICY_VERSION=30", // TODO(jiyong): externalize the version number
395 ],
396
397 product_variables: {
398 debuggable: {
399 cflags: [
400 "-UALLOW_FIRST_STAGE_CONSOLE",
401 "-DALLOW_FIRST_STAGE_CONSOLE=1",
402
403 "-UALLOW_LOCAL_PROP_OVERRIDE",
404 "-DALLOW_LOCAL_PROP_OVERRIDE=1",
405
406 "-UALLOW_PERMISSIVE_SELINUX",
407 "-DALLOW_PERMISSIVE_SELINUX=1",
408
409 "-UREBOOT_BOOTLOADER_ON_PANIC",
410 "-DREBOOT_BOOTLOADER_ON_PANIC=1",
411
412 "-UWORLD_WRITABLE_KMSG",
413 "-DWORLD_WRITABLE_KMSG=1",
414
415 "-UDUMP_ON_UMOUNT_FAILURE",
416 "-DDUMP_ON_UMOUNT_FAILURE=1",
417 ],
418 },
419
420 eng: {
421 cflags: [
422 "-USHUTDOWN_ZERO_TIMEOUT",
423 "-DSHUTDOWN_ZERO_TIMEOUT=1",
424 ],
425 },
426 },
427
428 sanitize: {
429 misc_undefined: ["signed-integer-overflow"],
Inseob Kim74182522021-06-11 12:58:53 +0900430
431 // First stage init is weird: it may start without stdout/stderr, and no /proc.
Jiyong Park13eb0532021-02-15 14:13:51 +0900432 hwaddress: false,
433 },
Inseob Kim74182522021-06-11 12:58:53 +0900434
435 // Install adb_debug.prop into debug ramdisk.
436 // This allows adb root on a user build, when debug ramdisk is used.
437 required: ["adb_debug.prop"],
438
439 ramdisk: true,
440
441 install_in_root: true,
442}
443
444phony {
445 name: "init_system",
446 required: ["init_second_stage"],
Jiyong Park13eb0532021-02-15 14:13:51 +0900447}
448
Tom Cherry14fc0132017-05-09 17:11:57 -0700449// Tests
450// ------------------------------------------------------------------------------
451
452cc_test {
Tom Cherry17b2be02019-08-20 10:43:48 -0700453 name: "CtsInitTestCases",
Tom Cherry14fc0132017-05-09 17:11:57 -0700454 defaults: ["init_defaults"],
Josh Gao6cad1392019-08-27 16:02:38 -0700455 require_root: true,
456
Tom Cherry17b2be02019-08-20 10:43:48 -0700457 compile_multilib: "both",
458 multilib: {
459 lib32: {
460 suffix: "32",
461 },
462 lib64: {
463 suffix: "64",
464 },
465 },
466
Tom Cherry14fc0132017-05-09 17:11:57 -0700467 srcs: [
468 "devices_test.cpp",
David Anderson1de73842021-05-13 20:18:14 -0700469 "epoll_test.cpp",
Tom Cherrydcb3d152019-08-07 16:02:28 -0700470 "firmware_handler_test.cpp",
Tom Cherry14fc0132017-05-09 17:11:57 -0700471 "init_test.cpp",
Bart Van Assche1693f422022-10-19 16:30:15 -0700472 "interprocess_fifo_test.cpp",
Mark Salyzyn75b901d2018-05-15 11:19:43 -0700473 "keychords_test.cpp",
Tom Cherrybdbf5042020-03-04 10:52:08 -0800474 "oneshot_on_test.cpp",
Tom Cherry16fad422017-08-04 15:59:03 -0700475 "persistent_properties_test.cpp",
Tom Cherry14fc0132017-05-09 17:11:57 -0700476 "property_service_test.cpp",
Tom Cherry927c5d52017-12-11 01:40:07 -0800477 "property_type_test.cpp",
Nikita Ioffe660ffde2020-12-10 16:52:35 +0000478 "reboot_test.cpp",
Tom Cherry7ac013d2017-08-25 10:39:25 -0700479 "rlimit_parser_test.cpp",
Tom Cherry14fc0132017-05-09 17:11:57 -0700480 "service_test.cpp",
Tom Cherrycb0f9bb2017-09-12 15:58:47 -0700481 "subcontext_test.cpp",
Tom Cherry2a5a4e72018-06-26 13:56:34 -0700482 "tokenizer_test.cpp",
Tom Cherry5f0198b2018-07-17 15:28:16 -0700483 "ueventd_parser_test.cpp",
Tom Cherryc2e181c2017-07-14 16:29:23 -0700484 "ueventd_test.cpp",
Tom Cherry14fc0132017-05-09 17:11:57 -0700485 "util_test.cpp",
486 ],
Bart Van Assche1693f422022-10-19 16:30:15 -0700487 static_libs: [
488 "libgmock",
489 "libinit",
490 ],
Tom Cherry17b2be02019-08-20 10:43:48 -0700491
492 test_suites: [
493 "cts",
494 "device-tests",
Tom Cherry17b2be02019-08-20 10:43:48 -0700495 ],
Tom Cherry14fc0132017-05-09 17:11:57 -0700496}
497
Tom Cherrycb0f9bb2017-09-12 15:58:47 -0700498cc_benchmark {
499 name: "init_benchmarks",
500 defaults: ["init_defaults"],
501 srcs: [
502 "subcontext_benchmark.cpp",
503 ],
Tom Cherry618d3102018-01-19 14:25:48 -0800504 static_libs: ["libinit"],
Tom Cherrycb0f9bb2017-09-12 15:58:47 -0700505}
506
Tom Cherrya2f91362020-02-20 10:50:00 -0800507cc_defaults {
508 name: "libinit_test_utils_libraries_defaults",
509 shared_libs: [
510 "libbase",
511 "libcutils",
512 "libselinux",
513 "libhidl-gen-utils",
514 "liblog",
515 "libprocessgroup",
516 "libprotobuf-cpp-lite",
517 ],
518}
519
520cc_library_static {
521 name: "libinit_test_utils",
522 defaults: ["libinit_test_utils_libraries_defaults"],
523 cflags: [
524 "-Wall",
525 "-Wextra",
526 "-Wno-unused-parameter",
527 "-Werror",
528 ],
529 srcs: init_common_sources + [
530 "test_utils/service_utils.cpp",
531 ],
532 whole_static_libs: [
533 "libcap",
534 ],
535 export_include_dirs: ["test_utils/include"], // for tests
Florian Mayerd705c2d2022-09-12 18:19:47 -0700536 header_libs: ["bionic_libc_platform_headers"],
Tom Cherrya2f91362020-02-20 10:50:00 -0800537}
538
Tom Cherryde6bd502018-02-13 16:50:08 -0800539// Host Verifier
540// ------------------------------------------------------------------------------
541
542genrule {
543 name: "generated_stub_builtin_function_map",
Tom Cherry4772f1d2019-07-30 09:34:41 -0700544 tool_files: ["host_builtin_map.py"],
Tom Cherryde6bd502018-02-13 16:50:08 -0800545 out: ["generated_stub_builtin_function_map.h"],
Daniel Normand2533c32019-08-02 15:13:50 -0700546 srcs: [
547 "builtins.cpp",
548 "check_builtins.cpp",
549 ],
Tom Cherry4772f1d2019-07-30 09:34:41 -0700550 cmd: "$(location host_builtin_map.py) --builtins $(location builtins.cpp) --check_builtins $(location check_builtins.cpp) > $(out)",
Tom Cherryde6bd502018-02-13 16:50:08 -0800551}
552
Daniel Normanf1200fb2022-03-09 10:49:26 -0800553cc_defaults {
554 name: "init_host_defaults",
Tom Cherryde6bd502018-02-13 16:50:08 -0800555 host_supported: true,
Tom Cherryde6bd502018-02-13 16:50:08 -0800556 cflags: [
557 "-Wall",
558 "-Wextra",
559 "-Wno-unused-parameter",
560 "-Werror",
561 ],
562 static_libs: [
563 "libbase",
564 "libselinux",
Tom Cherryb5f2ec02019-11-08 17:54:27 -0800565 "libpropertyinfoserializer",
566 "libpropertyinfoparser",
Tom Cherryde6bd502018-02-13 16:50:08 -0800567 ],
568 whole_static_libs: ["libcap"],
569 shared_libs: [
Tom Cherryde6bd502018-02-13 16:50:08 -0800570 "libcutils",
Daniel Norman3f42a762019-07-09 11:00:53 -0700571 "libhidl-gen-utils",
Steven Moreland422a7582019-10-15 14:53:19 -0700572 "libhidlmetadata",
Daniel Norman3f42a762019-07-09 11:00:53 -0700573 "liblog",
574 "libprocessgroup",
575 "libprotobuf-cpp-lite",
Tom Cherryde6bd502018-02-13 16:50:08 -0800576 ],
Tom Cherryde6bd502018-02-13 16:50:08 -0800577 proto: {
578 type: "lite",
579 },
Yifan Hong3c4aa112018-06-20 22:49:48 +0000580 generated_headers: [
581 "generated_stub_builtin_function_map",
Daniel Norman8082ba22019-07-23 10:26:15 -0700582 "generated_android_ids",
Yifan Hong3c4aa112018-06-20 22:49:48 +0000583 ],
Tom Cherry96ff0fe2018-02-28 17:20:27 -0800584 target: {
Tom Cherry547f7312018-02-28 21:40:46 -0800585 android: {
586 enabled: false,
587 },
Tom Cherry96ff0fe2018-02-28 17:20:27 -0800588 darwin: {
Yifan Hong3c4aa112018-06-20 22:49:48 +0000589 enabled: false,
Tom Cherry96ff0fe2018-02-28 17:20:27 -0800590 },
591 },
Tom Cherryde6bd502018-02-13 16:50:08 -0800592}
Suren Baghdasaryan642048d2021-06-15 12:28:24 -0700593
Daniel Normanf1200fb2022-03-09 10:49:26 -0800594cc_binary {
595 name: "host_init_verifier",
596 defaults: ["init_host_defaults"],
597 srcs: init_common_sources + init_host_sources,
598}
599
600cc_library_host_static {
601 name: "libinit_host",
602 defaults: ["init_host_defaults"],
603 srcs: init_common_sources,
604 export_include_dirs: ["."],
605 proto: {
606 export_proto_headers: true,
607 },
608 visibility: [
609 // host_apex_verifier performs a subset of init.rc validation
610 "//system/apex/tools",
611 ],
612}
613
Suren Baghdasaryan642048d2021-06-15 12:28:24 -0700614sh_binary {
Cole Faust7e279e92022-09-05 18:12:42 -0700615 name: "extra_free_kbytes",
Suren Baghdasaryan642048d2021-06-15 12:28:24 -0700616 src: "extra_free_kbytes.sh",
Cole Faust7e279e92022-09-05 18:12:42 -0700617 filename_from_src: true,
Suren Baghdasaryan642048d2021-06-15 12:28:24 -0700618}