blob: c3abefe14955aa47bb3d29948ac22af774d1e137 [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",
Tom Cherry66196492020-02-06 11:56:58 -080091]
92
Yi-Yo Chiangbb77c542021-09-23 14:14:16 +000093soong_config_module_type {
94 name: "libinit_cc_defaults",
95 module_type: "cc_defaults",
96 config_namespace: "ANDROID",
97 bool_variables: [
98 "PRODUCT_INSTALL_DEBUG_POLICY_TO_SYSTEM_EXT",
99 ],
100 properties: [
101 "cflags",
102 ],
103}
104
105libinit_cc_defaults {
Tom Cherry14fc0132017-05-09 17:11:57 -0700106 name: "init_defaults",
Tom Cherry14fc0132017-05-09 17:11:57 -0700107 sanitize: {
Tom Cherry2ffd65e2017-07-26 14:17:09 -0700108 misc_undefined: ["signed-integer-overflow"],
Tom Cherry14fc0132017-05-09 17:11:57 -0700109 },
Chih-Hung Hsieh122352d2017-10-02 15:20:07 -0700110 cflags: [
Steve Muckled75f30a2019-05-21 15:50:39 -0700111 "-DALLOW_FIRST_STAGE_CONSOLE=0",
Tom Cherry14fc0132017-05-09 17:11:57 -0700112 "-DALLOW_LOCAL_PROP_OVERRIDE=0",
113 "-DALLOW_PERMISSIVE_SELINUX=0",
Bart Van Asscheaee2ec82022-12-02 18:48:15 -0800114 "-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION",
Tom Cherry14fc0132017-05-09 17:11:57 -0700115 "-DDUMP_ON_UMOUNT_FAILURE=0",
Tom Cherrya2f91362020-02-20 10:50:00 -0800116 "-DINIT_FULL_SOURCES",
Yi-Yo Chiangbb77c542021-09-23 14:14:16 +0000117 "-DINSTALL_DEBUG_POLICY_TO_SYSTEM_EXT=0",
Bart Van Assche91ba2192022-12-02 18:48:48 -0800118 "-DLOG_UEVENTS=0",
119 "-DREBOOT_BOOTLOADER_ON_PANIC=0",
120 "-DSHUTDOWN_ZERO_TIMEOUT=0",
121 "-DWORLD_WRITABLE_KMSG=0",
122 "-Wall",
123 "-Werror",
124 "-Wextra",
125 "-Wno-unused-parameter",
126 "-Wthread-safety",
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",
Suren Baghdasaryanc29c2ba2019-10-22 17:18:42 -0700168 "liblmkd_utils",
Kelvin Zhang5cb1b022022-04-11 17:29:27 -0700169 "liblz4",
Kelvin Zhang32dcac72023-02-15 16:23:46 -0800170 "libzstd",
Steve Muckle18b981e2019-04-15 17:43:02 -0700171 "libmodprobe",
David Anderson9fd88622021-03-05 14:10:55 -0800172 "libprocinfo",
Tom Cherry618d3102018-01-19 14:25:48 -0800173 "libprotobuf-cpp-lite",
174 "libpropertyinfoserializer",
175 "libpropertyinfoparser",
David Andersonaca0bea2020-09-21 16:34:25 -0700176 "libsnapshot_cow",
David Andersondfe6d072019-10-09 16:24:03 -0700177 "libsnapshot_init",
Jooyung Han1d951b72020-07-05 03:33:36 +0900178 "libxml2",
Jiyong Park648ae3a2019-12-08 00:25:15 +0900179 "lib_apex_manifest_proto_lite",
Yifan Hong66f01152020-04-16 11:05:16 -0700180 "update_metadata-protos",
Jiyong Park787322c2018-06-01 19:26:42 +0900181 ],
182 shared_libs: [
Jiyong Park787322c2018-06-01 19:26:42 +0900183 "libbase",
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",
Tao Bao66209ca2018-07-25 22:35:45 -0700190 "liblog",
191 "liblogwrap",
Tom Cherry7bfea3d2018-11-06 14:12:05 -0800192 "liblp",
Suren Baghdasaryan82b72a52018-12-21 11:41:50 -0800193 "libprocessgroup",
Yifan Hong6f9ce2e2019-03-05 15:47:16 -0800194 "libprocessgroup_setup",
Jiyong Park012171d2018-06-19 16:55:05 +0900195 "libselinux",
Christopher Ferrisd2bd6c52022-05-11 14:42:38 -0700196 "libunwindstack",
Martijn Coenen62e985a2018-09-04 06:29:14 +0200197 "libutils",
Justin Yun6bc1bfe2024-01-10 13:47:02 +0900198 "libvendorsupport",
Tom Cherry618d3102018-01-19 14:25:48 -0800199 ],
Florian Mayerd705c2d2022-09-12 18:19:47 -0700200 header_libs: ["bionic_libc_platform_headers"],
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
Nikita Ioffea66adf42023-06-26 14:55:31 +0100211cc_defaults {
212 name: "libinit_defaults",
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,
Deyao Ren07595e12022-07-15 22:02:14 +0000219 export_include_dirs: ["."],
Jooyung Han1d951b72020-07-05 03:33:36 +0900220 generated_sources: [
221 "apex-info-list",
222 ],
Daniel Norman8082ba22019-07-23 10:26:15 -0700223 whole_static_libs: [
224 "libcap",
Trevor Radcliffefcfd7252022-06-08 14:19:45 +0000225 "libcom.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 },
Nikita Ioffea66adf42023-06-26 14:55:31 +0100248}
249
250cc_library_static {
251 name: "libinit",
252 defaults: ["libinit_defaults"],
253}
254
255cc_library_static {
256 name: "libinit.microdroid",
257 defaults: ["libinit_defaults"],
258 cflags: ["-DMICRODROID=1"],
Tom Cherry14fc0132017-05-09 17:11:57 -0700259}
260
Steven Morelandceb36d02019-07-15 15:12:56 -0700261phony {
262 name: "init",
263 required: [
264 "init_second_stage",
265 ],
266}
267
Nikita Ioffe55dd3252023-06-21 16:44:40 +0100268cc_defaults {
269 name: "init_second_stage_defaults",
Tom Cherry31438482018-07-20 14:57:00 -0700270 recovery_available: true,
271 stem: "init",
Tom Cherry14fc0132017-05-09 17:11:57 -0700272 defaults: ["init_defaults"],
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 },
Nikita Ioffe55dd3252023-06-21 16:44:40 +0100306}
307
308cc_binary {
309 name: "init_second_stage",
310 defaults: ["init_second_stage_defaults"],
Nikita Ioffea66adf42023-06-26 14:55:31 +0100311 static_libs: ["libinit"],
Nikita Ioffe55dd3252023-06-21 16:44:40 +0100312}
313
314cc_binary {
315 name: "init_second_stage.microdroid",
316 defaults: ["init_second_stage_defaults"],
Nikita Ioffea66adf42023-06-26 14:55:31 +0100317 static_libs: ["libinit.microdroid"],
318 cflags: ["-DMICRODROID=1"],
Nikita Ioffe55dd3252023-06-21 16:44:40 +0100319 installable: false,
Jiyong Park90353782021-01-25 18:41:40 +0900320 visibility: ["//packages/modules/Virtualization/microdroid"],
Tom Cherry14fc0132017-05-09 17:11:57 -0700321}
Tom Cherry14fc0132017-05-09 17:11:57 -0700322
Inseob Kim74182522021-06-11 12:58:53 +0900323soong_config_module_type {
324 name: "init_first_stage_cc_defaults",
325 module_type: "cc_defaults",
326 config_namespace: "ANDROID",
Yi-Yo Chiangddc97632022-10-07 21:15:03 +0800327 bool_variables: ["BOARD_USES_RECOVERY_AS_BOOT"],
Inseob Kim74182522021-06-11 12:58:53 +0900328 properties: ["installable"],
329}
330
331// Do not install init_first_stage even with mma if we're system-as-root.
332// Otherwise, it will overwrite the symlink.
333init_first_stage_cc_defaults {
334 name: "init_first_stage_defaults",
335 soong_config_variables: {
Bowgo Tsaiab079af2021-07-14 15:39:53 +0800336 BOARD_USES_RECOVERY_AS_BOOT: {
337 installable: false,
338 },
Inseob Kim74182522021-06-11 12:58:53 +0900339 },
Inseob Kim74182522021-06-11 12:58:53 +0900340
Inseob Kim74182522021-06-11 12:58:53 +0900341 stem: "init",
Jiyong Park13eb0532021-02-15 14:13:51 +0900342
343 srcs: [
344 "block_dev_initializer.cpp",
345 "devices.cpp",
346 "first_stage_console.cpp",
347 "first_stage_init.cpp",
348 "first_stage_main.cpp",
349 "first_stage_mount.cpp",
350 "reboot_utils.cpp",
351 "selabel.cpp",
Jiyong Park13eb0532021-02-15 14:13:51 +0900352 "service_utils.cpp",
353 "snapuserd_transition.cpp",
354 "switch_root.cpp",
355 "uevent_listener.cpp",
356 "util.cpp",
357 ],
358
359 static_libs: [
360 "libc++fs",
361 "libfs_avb",
362 "libfs_mgr",
363 "libfec",
364 "libfec_rs",
365 "libsquashfs_utils",
Jiyong Park13eb0532021-02-15 14:13:51 +0900366 "libcrypto_utils",
Jiyong Park13eb0532021-02-15 14:13:51 +0900367 "libavb",
Jiyong Park13eb0532021-02-15 14:13:51 +0900368 "liblp",
369 "libcutils",
370 "libbase",
371 "liblog",
372 "libcrypto_static",
Jiyong Park13eb0532021-02-15 14:13:51 +0900373 "libselinux",
374 "libcap",
375 "libgsi",
Jiyong Park13eb0532021-02-15 14:13:51 +0900376 "liblzma",
377 "libunwindstack_no_dex",
Jiyong Park13eb0532021-02-15 14:13:51 +0900378 "libmodprobe",
379 "libext2_uuid",
380 "libprotobuf-cpp-lite",
381 "libsnapshot_cow",
Kelvin Zhang5cb1b022022-04-11 17:29:27 -0700382 "liblz4",
Kelvin Zhang32dcac72023-02-15 16:23:46 -0800383 "libzstd",
Jiyong Park13eb0532021-02-15 14:13:51 +0900384 "libsnapshot_init",
385 "update_metadata-protos",
David Anderson9fd88622021-03-05 14:10:55 -0800386 "libprocinfo",
Jiyong Park13eb0532021-02-15 14:13:51 +0900387 ],
388
389 static_executable: true,
Inseob Kim74182522021-06-11 12:58:53 +0900390 system_shared_libs: [],
Jiyong Park13eb0532021-02-15 14:13:51 +0900391
392 cflags: [
393 "-Wall",
394 "-Wextra",
395 "-Wno-unused-parameter",
396 "-Werror",
397 "-DALLOW_FIRST_STAGE_CONSOLE=0",
398 "-DALLOW_LOCAL_PROP_OVERRIDE=0",
399 "-DALLOW_PERMISSIVE_SELINUX=0",
400 "-DREBOOT_BOOTLOADER_ON_PANIC=0",
401 "-DWORLD_WRITABLE_KMSG=0",
402 "-DDUMP_ON_UMOUNT_FAILURE=0",
403 "-DSHUTDOWN_ZERO_TIMEOUT=0",
404 "-DLOG_UEVENTS=0",
405 "-DSEPOLICY_VERSION=30", // TODO(jiyong): externalize the version number
406 ],
407
408 product_variables: {
409 debuggable: {
410 cflags: [
411 "-UALLOW_FIRST_STAGE_CONSOLE",
412 "-DALLOW_FIRST_STAGE_CONSOLE=1",
413
414 "-UALLOW_LOCAL_PROP_OVERRIDE",
415 "-DALLOW_LOCAL_PROP_OVERRIDE=1",
416
417 "-UALLOW_PERMISSIVE_SELINUX",
418 "-DALLOW_PERMISSIVE_SELINUX=1",
419
420 "-UREBOOT_BOOTLOADER_ON_PANIC",
421 "-DREBOOT_BOOTLOADER_ON_PANIC=1",
422
423 "-UWORLD_WRITABLE_KMSG",
424 "-DWORLD_WRITABLE_KMSG=1",
425
426 "-UDUMP_ON_UMOUNT_FAILURE",
427 "-DDUMP_ON_UMOUNT_FAILURE=1",
428 ],
429 },
430
431 eng: {
432 cflags: [
433 "-USHUTDOWN_ZERO_TIMEOUT",
434 "-DSHUTDOWN_ZERO_TIMEOUT=1",
435 ],
436 },
437 },
438
439 sanitize: {
440 misc_undefined: ["signed-integer-overflow"],
Inseob Kim74182522021-06-11 12:58:53 +0900441
442 // First stage init is weird: it may start without stdout/stderr, and no /proc.
Jiyong Park13eb0532021-02-15 14:13:51 +0900443 hwaddress: false,
444 },
Inseob Kim74182522021-06-11 12:58:53 +0900445
446 // Install adb_debug.prop into debug ramdisk.
447 // This allows adb root on a user build, when debug ramdisk is used.
448 required: ["adb_debug.prop"],
449
450 ramdisk: true,
451
452 install_in_root: true,
453}
454
Nikita Ioffe55dd3252023-06-21 16:44:40 +0100455cc_binary {
456 name: "init_first_stage",
457 defaults: ["init_first_stage_defaults"],
458}
459
460cc_binary {
461 name: "init_first_stage.microdroid",
462 defaults: ["init_first_stage_defaults"],
Nikita Ioffea66adf42023-06-26 14:55:31 +0100463 cflags: ["-DMICRODROID=1"],
Nikita Ioffe55dd3252023-06-21 16:44:40 +0100464 installable: false,
465}
466
Inseob Kim74182522021-06-11 12:58:53 +0900467phony {
468 name: "init_system",
469 required: ["init_second_stage"],
Jiyong Park13eb0532021-02-15 14:13:51 +0900470}
471
Tom Cherry14fc0132017-05-09 17:11:57 -0700472// Tests
473// ------------------------------------------------------------------------------
474
475cc_test {
Jiyong Park75070b32024-01-30 10:17:37 +0900476 // Note: This is NOT a CTS test. See b/320800872
Tom Cherry17b2be02019-08-20 10:43:48 -0700477 name: "CtsInitTestCases",
Tom Cherry14fc0132017-05-09 17:11:57 -0700478 defaults: ["init_defaults"],
Josh Gao6cad1392019-08-27 16:02:38 -0700479 require_root: true,
480
David Andersoncbd082d2022-12-06 20:11:40 -0800481 compile_multilib: "first",
Tom Cherry17b2be02019-08-20 10:43:48 -0700482
Tom Cherry14fc0132017-05-09 17:11:57 -0700483 srcs: [
484 "devices_test.cpp",
David Anderson1de73842021-05-13 20:18:14 -0700485 "epoll_test.cpp",
Tom Cherrydcb3d152019-08-07 16:02:28 -0700486 "firmware_handler_test.cpp",
Tom Cherry14fc0132017-05-09 17:11:57 -0700487 "init_test.cpp",
Bart Van Assche1693f422022-10-19 16:30:15 -0700488 "interprocess_fifo_test.cpp",
Mark Salyzyn75b901d2018-05-15 11:19:43 -0700489 "keychords_test.cpp",
Tom Cherrybdbf5042020-03-04 10:52:08 -0800490 "oneshot_on_test.cpp",
Tom Cherry16fad422017-08-04 15:59:03 -0700491 "persistent_properties_test.cpp",
Tom Cherry14fc0132017-05-09 17:11:57 -0700492 "property_service_test.cpp",
Tom Cherry927c5d52017-12-11 01:40:07 -0800493 "property_type_test.cpp",
Nikita Ioffe660ffde2020-12-10 16:52:35 +0000494 "reboot_test.cpp",
Tom Cherry7ac013d2017-08-25 10:39:25 -0700495 "rlimit_parser_test.cpp",
Tom Cherry14fc0132017-05-09 17:11:57 -0700496 "service_test.cpp",
Tom Cherrycb0f9bb2017-09-12 15:58:47 -0700497 "subcontext_test.cpp",
Tom Cherry2a5a4e72018-06-26 13:56:34 -0700498 "tokenizer_test.cpp",
Tom Cherry5f0198b2018-07-17 15:28:16 -0700499 "ueventd_parser_test.cpp",
Tom Cherryc2e181c2017-07-14 16:29:23 -0700500 "ueventd_test.cpp",
Tom Cherry14fc0132017-05-09 17:11:57 -0700501 "util_test.cpp",
502 ],
Bart Van Assche1693f422022-10-19 16:30:15 -0700503 static_libs: [
504 "libgmock",
505 "libinit",
506 ],
Tom Cherry17b2be02019-08-20 10:43:48 -0700507
508 test_suites: [
Tom Cherry17b2be02019-08-20 10:43:48 -0700509 "device-tests",
Tom Cherry17b2be02019-08-20 10:43:48 -0700510 ],
Tom Cherry14fc0132017-05-09 17:11:57 -0700511}
512
Tom Cherrycb0f9bb2017-09-12 15:58:47 -0700513cc_benchmark {
514 name: "init_benchmarks",
515 defaults: ["init_defaults"],
516 srcs: [
517 "subcontext_benchmark.cpp",
518 ],
Tom Cherry618d3102018-01-19 14:25:48 -0800519 static_libs: ["libinit"],
Tom Cherrycb0f9bb2017-09-12 15:58:47 -0700520}
521
Tom Cherrya2f91362020-02-20 10:50:00 -0800522cc_defaults {
523 name: "libinit_test_utils_libraries_defaults",
524 shared_libs: [
525 "libbase",
526 "libcutils",
527 "libselinux",
Tom Cherrya2f91362020-02-20 10:50:00 -0800528 "liblog",
529 "libprocessgroup",
530 "libprotobuf-cpp-lite",
531 ],
Steven Moreland973aade2023-03-15 19:39:15 +0000532 static_libs: [
Yi-Yo Chiangb8c23252023-07-25 22:08:55 +0800533 "libfs_mgr",
Steven Moreland973aade2023-03-15 19:39:15 +0000534 "libhidl-gen-utils",
535 ],
Tom Cherrya2f91362020-02-20 10:50:00 -0800536}
537
538cc_library_static {
539 name: "libinit_test_utils",
540 defaults: ["libinit_test_utils_libraries_defaults"],
541 cflags: [
542 "-Wall",
543 "-Wextra",
544 "-Wno-unused-parameter",
545 "-Werror",
546 ],
547 srcs: init_common_sources + [
548 "test_utils/service_utils.cpp",
549 ],
550 whole_static_libs: [
551 "libcap",
552 ],
553 export_include_dirs: ["test_utils/include"], // for tests
Florian Mayerd705c2d2022-09-12 18:19:47 -0700554 header_libs: ["bionic_libc_platform_headers"],
Tom Cherrya2f91362020-02-20 10:50:00 -0800555}
556
Tom Cherryde6bd502018-02-13 16:50:08 -0800557// Host Verifier
558// ------------------------------------------------------------------------------
559
560genrule {
561 name: "generated_stub_builtin_function_map",
Tom Cherry4772f1d2019-07-30 09:34:41 -0700562 tool_files: ["host_builtin_map.py"],
Tom Cherryde6bd502018-02-13 16:50:08 -0800563 out: ["generated_stub_builtin_function_map.h"],
Daniel Normand2533c32019-08-02 15:13:50 -0700564 srcs: [
565 "builtins.cpp",
566 "check_builtins.cpp",
567 ],
Tom Cherry4772f1d2019-07-30 09:34:41 -0700568 cmd: "$(location host_builtin_map.py) --builtins $(location builtins.cpp) --check_builtins $(location check_builtins.cpp) > $(out)",
Tom Cherryde6bd502018-02-13 16:50:08 -0800569}
570
Daniel Normanf1200fb2022-03-09 10:49:26 -0800571cc_defaults {
572 name: "init_host_defaults",
Tom Cherryde6bd502018-02-13 16:50:08 -0800573 host_supported: true,
Tom Cherryde6bd502018-02-13 16:50:08 -0800574 cflags: [
575 "-Wall",
576 "-Wextra",
577 "-Wno-unused-parameter",
578 "-Werror",
579 ],
580 static_libs: [
581 "libbase",
582 "libselinux",
Tom Cherryb5f2ec02019-11-08 17:54:27 -0800583 "libpropertyinfoserializer",
584 "libpropertyinfoparser",
Tom Cherryde6bd502018-02-13 16:50:08 -0800585 ],
586 whole_static_libs: ["libcap"],
587 shared_libs: [
Tom Cherryde6bd502018-02-13 16:50:08 -0800588 "libcutils",
Daniel Norman3f42a762019-07-09 11:00:53 -0700589 "libhidl-gen-utils",
Steven Moreland422a7582019-10-15 14:53:19 -0700590 "libhidlmetadata",
Daniel Norman3f42a762019-07-09 11:00:53 -0700591 "liblog",
592 "libprocessgroup",
593 "libprotobuf-cpp-lite",
Tom Cherryde6bd502018-02-13 16:50:08 -0800594 ],
Tom Cherryde6bd502018-02-13 16:50:08 -0800595 proto: {
596 type: "lite",
597 },
Yifan Hong3c4aa112018-06-20 22:49:48 +0000598 generated_headers: [
599 "generated_stub_builtin_function_map",
Yifan Hong3c4aa112018-06-20 22:49:48 +0000600 ],
Tom Cherry96ff0fe2018-02-28 17:20:27 -0800601 target: {
Tom Cherry547f7312018-02-28 21:40:46 -0800602 android: {
603 enabled: false,
604 },
Tom Cherry96ff0fe2018-02-28 17:20:27 -0800605 darwin: {
Yifan Hong3c4aa112018-06-20 22:49:48 +0000606 enabled: false,
Tom Cherry96ff0fe2018-02-28 17:20:27 -0800607 },
608 },
Tom Cherryde6bd502018-02-13 16:50:08 -0800609}
Suren Baghdasaryan642048d2021-06-15 12:28:24 -0700610
Daniel Normanf1200fb2022-03-09 10:49:26 -0800611cc_binary {
612 name: "host_init_verifier",
613 defaults: ["init_host_defaults"],
Jooyung Han39e8be42024-02-16 17:23:34 +0900614 srcs: ["host_init_verifier.cpp"] + init_common_sources + init_host_sources,
Jooyung Han18407b72024-02-24 09:16:35 +0900615 generated_headers: [
616 "generated_android_ids",
617 ],
Daniel Normanf1200fb2022-03-09 10:49:26 -0800618}
619
620cc_library_host_static {
621 name: "libinit_host",
622 defaults: ["init_host_defaults"],
Jooyung Han39e8be42024-02-16 17:23:34 +0900623 srcs: init_common_sources + init_host_sources,
Daniel Normanf1200fb2022-03-09 10:49:26 -0800624 export_include_dirs: ["."],
625 proto: {
626 export_proto_headers: true,
627 },
628 visibility: [
629 // host_apex_verifier performs a subset of init.rc validation
630 "//system/apex/tools",
631 ],
632}
633
Suren Baghdasaryan642048d2021-06-15 12:28:24 -0700634sh_binary {
Cole Faust7e279e92022-09-05 18:12:42 -0700635 name: "extra_free_kbytes",
Suren Baghdasaryan642048d2021-06-15 12:28:24 -0700636 src: "extra_free_kbytes.sh",
Cole Faust7e279e92022-09-05 18:12:42 -0700637 filename_from_src: true,
Suren Baghdasaryan642048d2021-06-15 12:28:24 -0700638}