blob: f6f1e8c8cc865cedf62b379c780799b51dc8569b [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 = [
Deyao Ren238e9092022-07-21 23:05:13 +000056 "apex_init_util.cpp",
David Anderson41175592020-03-20 19:38:28 -070057 "block_dev_initializer.cpp",
Tom Cherry66196492020-02-06 11:56:58 -080058 "bootchart.cpp",
59 "builtins.cpp",
60 "devices.cpp",
61 "firmware_handler.cpp",
Steve Mucklea4bf2ce2019-11-01 13:58:02 -070062 "first_stage_console.cpp",
Tom Cherry66196492020-02-06 11:56:58 -080063 "first_stage_init.cpp",
64 "first_stage_mount.cpp",
65 "fscrypt_init_extensions.cpp",
66 "init.cpp",
67 "lmkd_service.cpp",
68 "modalias_handler.cpp",
69 "mount_handler.cpp",
70 "mount_namespace.cpp",
71 "persistent_properties.cpp",
72 "persistent_properties.proto",
73 "property_service.cpp",
74 "property_service.proto",
75 "reboot.cpp",
76 "reboot_utils.cpp",
77 "security.cpp",
78 "selabel.cpp",
79 "selinux.cpp",
80 "sigchld_handler.cpp",
David Anderson491e4da2020-12-08 00:21:20 -080081 "snapuserd_transition.cpp",
Tom Cherry66196492020-02-06 11:56:58 -080082 "switch_root.cpp",
83 "uevent_listener.cpp",
84 "ueventd.cpp",
85 "ueventd_parser.cpp",
86]
87init_host_sources = [
88 "check_builtins.cpp",
89 "host_import_parser.cpp",
90 "host_init_verifier.cpp",
91]
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: [
Tom Cherry14fc0132017-05-09 17:11:57 -0700111 "-DLOG_UEVENTS=0",
112 "-Wall",
113 "-Wextra",
114 "-Wno-unused-parameter",
115 "-Werror",
Tom Cherry802864c2020-03-12 14:29:25 -0700116 "-Wthread-safety",
Steve Muckled75f30a2019-05-21 15:50:39 -0700117 "-DALLOW_FIRST_STAGE_CONSOLE=0",
Tom Cherry14fc0132017-05-09 17:11:57 -0700118 "-DALLOW_LOCAL_PROP_OVERRIDE=0",
119 "-DALLOW_PERMISSIVE_SELINUX=0",
120 "-DREBOOT_BOOTLOADER_ON_PANIC=0",
121 "-DWORLD_WRITABLE_KMSG=0",
122 "-DDUMP_ON_UMOUNT_FAILURE=0",
123 "-DSHUTDOWN_ZERO_TIMEOUT=0",
Tom Cherrya2f91362020-02-20 10:50:00 -0800124 "-DINIT_FULL_SOURCES",
Yi-Yo Chiangbb77c542021-09-23 14:14:16 +0000125 "-DINSTALL_DEBUG_POLICY_TO_SYSTEM_EXT=0",
Tom Cherry14fc0132017-05-09 17:11:57 -0700126 ],
127 product_variables: {
128 debuggable: {
129 cppflags: [
Steve Muckled75f30a2019-05-21 15:50:39 -0700130 "-UALLOW_FIRST_STAGE_CONSOLE",
131 "-DALLOW_FIRST_STAGE_CONSOLE=1",
Tom Cherry14fc0132017-05-09 17:11:57 -0700132 "-UALLOW_LOCAL_PROP_OVERRIDE",
133 "-DALLOW_LOCAL_PROP_OVERRIDE=1",
134 "-UALLOW_PERMISSIVE_SELINUX",
135 "-DALLOW_PERMISSIVE_SELINUX=1",
136 "-UREBOOT_BOOTLOADER_ON_PANIC",
137 "-DREBOOT_BOOTLOADER_ON_PANIC=1",
138 "-UWORLD_WRITABLE_KMSG",
139 "-DWORLD_WRITABLE_KMSG=1",
140 "-UDUMP_ON_UMOUNT_FAILURE",
141 "-DDUMP_ON_UMOUNT_FAILURE=1",
142 ],
143 },
144 eng: {
145 cppflags: [
146 "-USHUTDOWN_ZERO_TIMEOUT",
147 "-DSHUTDOWN_ZERO_TIMEOUT=1",
148 ],
149 },
Dmitry Shmidtc3bc5092017-08-23 14:57:07 -0700150 uml: {
151 cppflags: ["-DUSER_MODE_LINUX"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800152 },
Tom Cherry14fc0132017-05-09 17:11:57 -0700153 },
Yi-Yo Chiangbb77c542021-09-23 14:14:16 +0000154 soong_config_variables: {
155 PRODUCT_INSTALL_DEBUG_POLICY_TO_SYSTEM_EXT: {
156 cflags: [
157 "-UINSTALL_DEBUG_POLICY_TO_SYSTEM_EXT",
158 "-DINSTALL_DEBUG_POLICY_TO_SYSTEM_EXT=1",
159 ],
160 },
161 },
Tom Cherry618d3102018-01-19 14:25:48 -0800162 static_libs: [
Tom Cherry618d3102018-01-19 14:25:48 -0800163 "libavb",
David Anderson12e53bc2022-10-03 21:37:12 -0700164 "libbootloader_message",
Bowgo Tsai30afda72019-04-11 23:57:24 +0800165 "libc++fs",
Yifan Hongd8ce1fb2019-03-22 17:21:58 -0700166 "libcgrouprc_format",
Jeffrey Vander Stoepbaeece62022-02-08 12:42:33 +0000167 "libfsverity_init",
Suren Baghdasaryanc29c2ba2019-10-22 17:18:42 -0700168 "liblmkd_utils",
Kelvin Zhang5cb1b022022-04-11 17:29:27 -0700169 "liblz4",
Jeffrey Vander Stoepbaeece62022-02-08 12:42:33 +0000170 "libmini_keyctl_static",
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",
Jeffrey Vander Stoepbaeece62022-02-08 12:42:33 +0000176 "libsigningutils",
David Andersonaca0bea2020-09-21 16:34:25 -0700177 "libsnapshot_cow",
David Andersondfe6d072019-10-09 16:24:03 -0700178 "libsnapshot_init",
Jooyung Han1d951b72020-07-05 03:33:36 +0900179 "libxml2",
Jiyong Park648ae3a2019-12-08 00:25:15 +0900180 "lib_apex_manifest_proto_lite",
Yifan Hong66f01152020-04-16 11:05:16 -0700181 "update_metadata-protos",
Jiyong Park787322c2018-06-01 19:26:42 +0900182 ],
183 shared_libs: [
Jiyong Park787322c2018-06-01 19:26:42 +0900184 "libbase",
Jeffrey Vander Stoepbaeece62022-02-08 12:42:33 +0000185 "libcrypto",
Tao Bao66209ca2018-07-25 22:35:45 -0700186 "libcutils",
Jiyong Park787322c2018-06-01 19:26:42 +0900187 "libdl",
Tao Bao66209ca2018-07-25 22:35:45 -0700188 "libext4_utils",
189 "libfs_mgr",
David Anderson0e330f12019-01-03 18:16:56 -0800190 "libgsi",
Tao Bao66209ca2018-07-25 22:35:45 -0700191 "libhidl-gen-utils",
192 "libkeyutils",
193 "liblog",
194 "liblogwrap",
Tom Cherry7bfea3d2018-11-06 14:12:05 -0800195 "liblp",
Suren Baghdasaryan82b72a52018-12-21 11:41:50 -0800196 "libprocessgroup",
Yifan Hong6f9ce2e2019-03-05 15:47:16 -0800197 "libprocessgroup_setup",
Jiyong Park012171d2018-06-19 16:55:05 +0900198 "libselinux",
Christopher Ferrisd2bd6c52022-05-11 14:42:38 -0700199 "libunwindstack",
Martijn Coenen62e985a2018-09-04 06:29:14 +0200200 "libutils",
Jeffrey Vander Stoepbaeece62022-02-08 12:42:33 +0000201 "libziparchive",
Tom Cherry618d3102018-01-19 14:25:48 -0800202 ],
Florian Mayerd705c2d2022-09-12 18:19:47 -0700203 header_libs: ["bionic_libc_platform_headers"],
Jiyong Park93318d42018-12-26 17:34:39 +0900204 bootstrap: true,
Daniel Norman8082ba22019-07-23 10:26:15 -0700205 visibility: [":__subpackages__"],
Tom Cherry14fc0132017-05-09 17:11:57 -0700206}
207
Devendra Singhi1df957b2022-02-15 21:52:55 +0530208cc_library_headers {
209 name: "libinit_headers",
210 export_include_dirs: ["."],
211 visibility: [":__subpackages__"],
212}
213
Tom Cherry14fc0132017-05-09 17:11:57 -0700214cc_library_static {
215 name: "libinit",
Tom Cherry31438482018-07-20 14:57:00 -0700216 recovery_available: true,
Daniel Norman8082ba22019-07-23 10:26:15 -0700217 defaults: [
218 "init_defaults",
219 "selinux_policy_version",
220 ],
Tom Cherry66196492020-02-06 11:56:58 -0800221 srcs: init_common_sources + init_device_sources,
Deyao Ren07595e12022-07-15 22:02:14 +0000222 export_include_dirs: ["."],
Jooyung Han1d951b72020-07-05 03:33:36 +0900223 generated_sources: [
224 "apex-info-list",
225 ],
Daniel Norman8082ba22019-07-23 10:26:15 -0700226 whole_static_libs: [
227 "libcap",
Trevor Radcliffefcfd7252022-06-08 14:19:45 +0000228 "libcom.android.sysprop.apex",
229 "libcom.android.sysprop.init",
Daniel Norman8082ba22019-07-23 10:26:15 -0700230 ],
Jayant Chowdhary478c7c12018-03-28 18:45:35 -0700231 header_libs: ["bootimg_headers"],
Tom Cherrya97faba2017-09-15 15:44:04 -0700232 proto: {
233 type: "lite",
234 export_proto_headers: true,
235 },
Martijn Coenen62e985a2018-09-04 06:29:14 +0200236
237 target: {
238 recovery: {
239 cflags: ["-DRECOVERY"],
Jooyung Han1d951b72020-07-05 03:33:36 +0900240 exclude_static_libs: [
241 "libxml2",
242 ],
243 exclude_generated_sources: [
244 "apex-info-list",
245 ],
Daniel Norman8082ba22019-07-23 10:26:15 -0700246 exclude_shared_libs: [
247 "libbinder",
248 "libutils",
249 ],
Martijn Coenen62e985a2018-09-04 06:29:14 +0200250 },
251 },
Deyao Ren07595e12022-07-15 22:02:14 +0000252 visibility: [
253 "//system/apex/apexd",
254 "//frameworks/native/cmds/installd",
255 ],
Tom Cherry14fc0132017-05-09 17:11:57 -0700256}
257
Steven Morelandceb36d02019-07-15 15:12:56 -0700258phony {
259 name: "init",
260 required: [
261 "init_second_stage",
262 ],
263}
264
Tom Cherry14fc0132017-05-09 17:11:57 -0700265cc_binary {
Tom Cherry31438482018-07-20 14:57:00 -0700266 name: "init_second_stage",
267 recovery_available: true,
268 stem: "init",
Tom Cherry14fc0132017-05-09 17:11:57 -0700269 defaults: ["init_defaults"],
Tom Cherry31438482018-07-20 14:57:00 -0700270 static_libs: ["libinit"],
Tom Cherry618d3102018-01-19 14:25:48 -0800271 srcs: ["main.cpp"],
Tom Cherry31438482018-07-20 14:57:00 -0700272 symlinks: ["ueventd"],
Martijn Coenen62e985a2018-09-04 06:29:14 +0200273 target: {
Yi-Yo Chiang9ba6a5b2021-07-24 22:50:17 +0800274 platform: {
275 required: [
276 "init.rc",
277 "ueventd.rc",
278 "e2fsdroid",
Cole Faust7e279e92022-09-05 18:12:42 -0700279 "extra_free_kbytes",
Yi-Yo Chiang9ba6a5b2021-07-24 22:50:17 +0800280 "make_f2fs",
281 "mke2fs",
282 "sload_f2fs",
283 ],
284 },
Martijn Coenen62e985a2018-09-04 06:29:14 +0200285 recovery: {
286 cflags: ["-DRECOVERY"],
Jooyung Han1d951b72020-07-05 03:33:36 +0900287 exclude_static_libs: [
288 "libxml2",
289 ],
Daniel Norman8082ba22019-07-23 10:26:15 -0700290 exclude_shared_libs: [
291 "libbinder",
292 "libutils",
293 ],
Yi-Yo Chiang9ba6a5b2021-07-24 22:50:17 +0800294 required: [
295 "init_recovery.rc",
296 "ueventd.rc.recovery",
297 "e2fsdroid.recovery",
298 "make_f2fs.recovery",
299 "mke2fs.recovery",
300 "sload_f2fs.recovery",
301 ],
Martijn Coenen62e985a2018-09-04 06:29:14 +0200302 },
303 },
Jiyong Park90353782021-01-25 18:41:40 +0900304 visibility: ["//packages/modules/Virtualization/microdroid"],
Tom Cherry14fc0132017-05-09 17:11:57 -0700305}
Tom Cherry14fc0132017-05-09 17:11:57 -0700306
Inseob Kim74182522021-06-11 12:58:53 +0900307soong_config_module_type {
308 name: "init_first_stage_cc_defaults",
309 module_type: "cc_defaults",
310 config_namespace: "ANDROID",
Yi-Yo Chiangddc97632022-10-07 21:15:03 +0800311 bool_variables: ["BOARD_USES_RECOVERY_AS_BOOT"],
Inseob Kim74182522021-06-11 12:58:53 +0900312 properties: ["installable"],
313}
314
315// Do not install init_first_stage even with mma if we're system-as-root.
316// Otherwise, it will overwrite the symlink.
317init_first_stage_cc_defaults {
318 name: "init_first_stage_defaults",
319 soong_config_variables: {
Bowgo Tsaiab079af2021-07-14 15:39:53 +0800320 BOARD_USES_RECOVERY_AS_BOOT: {
321 installable: false,
322 },
Inseob Kim74182522021-06-11 12:58:53 +0900323 },
324}
325
Jiyong Park13eb0532021-02-15 14:13:51 +0900326cc_binary {
Inseob Kim74182522021-06-11 12:58:53 +0900327 name: "init_first_stage",
328 stem: "init",
329 defaults: ["init_first_stage_defaults"],
Jiyong Park13eb0532021-02-15 14:13:51 +0900330
331 srcs: [
332 "block_dev_initializer.cpp",
333 "devices.cpp",
334 "first_stage_console.cpp",
335 "first_stage_init.cpp",
336 "first_stage_main.cpp",
337 "first_stage_mount.cpp",
338 "reboot_utils.cpp",
339 "selabel.cpp",
Jiyong Park13eb0532021-02-15 14:13:51 +0900340 "service_utils.cpp",
341 "snapuserd_transition.cpp",
342 "switch_root.cpp",
343 "uevent_listener.cpp",
344 "util.cpp",
345 ],
346
347 static_libs: [
348 "libc++fs",
349 "libfs_avb",
350 "libfs_mgr",
351 "libfec",
352 "libfec_rs",
353 "libsquashfs_utils",
Jiyong Park13eb0532021-02-15 14:13:51 +0900354 "libcrypto_utils",
Jiyong Park13eb0532021-02-15 14:13:51 +0900355 "libavb",
Jiyong Park13eb0532021-02-15 14:13:51 +0900356 "liblp",
357 "libcutils",
358 "libbase",
359 "liblog",
360 "libcrypto_static",
Jiyong Park13eb0532021-02-15 14:13:51 +0900361 "libselinux",
362 "libcap",
363 "libgsi",
Jiyong Park13eb0532021-02-15 14:13:51 +0900364 "liblzma",
365 "libunwindstack_no_dex",
Jiyong Park13eb0532021-02-15 14:13:51 +0900366 "libmodprobe",
367 "libext2_uuid",
368 "libprotobuf-cpp-lite",
369 "libsnapshot_cow",
Kelvin Zhang5cb1b022022-04-11 17:29:27 -0700370 "liblz4",
Jiyong Park13eb0532021-02-15 14:13:51 +0900371 "libsnapshot_init",
372 "update_metadata-protos",
David Anderson9fd88622021-03-05 14:10:55 -0800373 "libprocinfo",
Jiyong Park13eb0532021-02-15 14:13:51 +0900374 ],
375
376 static_executable: true,
Inseob Kim74182522021-06-11 12:58:53 +0900377 system_shared_libs: [],
Jiyong Park13eb0532021-02-15 14:13:51 +0900378
379 cflags: [
380 "-Wall",
381 "-Wextra",
382 "-Wno-unused-parameter",
383 "-Werror",
384 "-DALLOW_FIRST_STAGE_CONSOLE=0",
385 "-DALLOW_LOCAL_PROP_OVERRIDE=0",
386 "-DALLOW_PERMISSIVE_SELINUX=0",
387 "-DREBOOT_BOOTLOADER_ON_PANIC=0",
388 "-DWORLD_WRITABLE_KMSG=0",
389 "-DDUMP_ON_UMOUNT_FAILURE=0",
390 "-DSHUTDOWN_ZERO_TIMEOUT=0",
391 "-DLOG_UEVENTS=0",
392 "-DSEPOLICY_VERSION=30", // TODO(jiyong): externalize the version number
393 ],
394
395 product_variables: {
396 debuggable: {
397 cflags: [
398 "-UALLOW_FIRST_STAGE_CONSOLE",
399 "-DALLOW_FIRST_STAGE_CONSOLE=1",
400
401 "-UALLOW_LOCAL_PROP_OVERRIDE",
402 "-DALLOW_LOCAL_PROP_OVERRIDE=1",
403
404 "-UALLOW_PERMISSIVE_SELINUX",
405 "-DALLOW_PERMISSIVE_SELINUX=1",
406
407 "-UREBOOT_BOOTLOADER_ON_PANIC",
408 "-DREBOOT_BOOTLOADER_ON_PANIC=1",
409
410 "-UWORLD_WRITABLE_KMSG",
411 "-DWORLD_WRITABLE_KMSG=1",
412
413 "-UDUMP_ON_UMOUNT_FAILURE",
414 "-DDUMP_ON_UMOUNT_FAILURE=1",
415 ],
416 },
417
418 eng: {
419 cflags: [
420 "-USHUTDOWN_ZERO_TIMEOUT",
421 "-DSHUTDOWN_ZERO_TIMEOUT=1",
422 ],
423 },
424 },
425
426 sanitize: {
427 misc_undefined: ["signed-integer-overflow"],
Inseob Kim74182522021-06-11 12:58:53 +0900428
429 // First stage init is weird: it may start without stdout/stderr, and no /proc.
Jiyong Park13eb0532021-02-15 14:13:51 +0900430 hwaddress: false,
431 },
Inseob Kim74182522021-06-11 12:58:53 +0900432
433 // Install adb_debug.prop into debug ramdisk.
434 // This allows adb root on a user build, when debug ramdisk is used.
435 required: ["adb_debug.prop"],
436
437 ramdisk: true,
438
439 install_in_root: true,
440}
441
442phony {
443 name: "init_system",
444 required: ["init_second_stage"],
Jiyong Park13eb0532021-02-15 14:13:51 +0900445}
446
Tom Cherry14fc0132017-05-09 17:11:57 -0700447// Tests
448// ------------------------------------------------------------------------------
449
450cc_test {
Tom Cherry17b2be02019-08-20 10:43:48 -0700451 name: "CtsInitTestCases",
Tom Cherry14fc0132017-05-09 17:11:57 -0700452 defaults: ["init_defaults"],
Josh Gao6cad1392019-08-27 16:02:38 -0700453 require_root: true,
454
Tom Cherry17b2be02019-08-20 10:43:48 -0700455 compile_multilib: "both",
456 multilib: {
457 lib32: {
458 suffix: "32",
459 },
460 lib64: {
461 suffix: "64",
462 },
463 },
464
Tom Cherry14fc0132017-05-09 17:11:57 -0700465 srcs: [
466 "devices_test.cpp",
David Anderson1de73842021-05-13 20:18:14 -0700467 "epoll_test.cpp",
Tom Cherrydcb3d152019-08-07 16:02:28 -0700468 "firmware_handler_test.cpp",
Tom Cherry14fc0132017-05-09 17:11:57 -0700469 "init_test.cpp",
Mark Salyzyn75b901d2018-05-15 11:19:43 -0700470 "keychords_test.cpp",
Tom Cherrybdbf5042020-03-04 10:52:08 -0800471 "oneshot_on_test.cpp",
Tom Cherry16fad422017-08-04 15:59:03 -0700472 "persistent_properties_test.cpp",
Tom Cherry14fc0132017-05-09 17:11:57 -0700473 "property_service_test.cpp",
Tom Cherry927c5d52017-12-11 01:40:07 -0800474 "property_type_test.cpp",
Nikita Ioffe660ffde2020-12-10 16:52:35 +0000475 "reboot_test.cpp",
Tom Cherry7ac013d2017-08-25 10:39:25 -0700476 "rlimit_parser_test.cpp",
Tom Cherry14fc0132017-05-09 17:11:57 -0700477 "service_test.cpp",
Tom Cherrycb0f9bb2017-09-12 15:58:47 -0700478 "subcontext_test.cpp",
Tom Cherry2a5a4e72018-06-26 13:56:34 -0700479 "tokenizer_test.cpp",
Tom Cherry5f0198b2018-07-17 15:28:16 -0700480 "ueventd_parser_test.cpp",
Tom Cherryc2e181c2017-07-14 16:29:23 -0700481 "ueventd_test.cpp",
Tom Cherry14fc0132017-05-09 17:11:57 -0700482 "util_test.cpp",
483 ],
Tom Cherry618d3102018-01-19 14:25:48 -0800484 static_libs: ["libinit"],
Tom Cherry17b2be02019-08-20 10:43:48 -0700485
486 test_suites: [
487 "cts",
488 "device-tests",
Tom Cherry17b2be02019-08-20 10:43:48 -0700489 ],
Tom Cherry14fc0132017-05-09 17:11:57 -0700490}
491
Tom Cherrycb0f9bb2017-09-12 15:58:47 -0700492cc_benchmark {
493 name: "init_benchmarks",
494 defaults: ["init_defaults"],
495 srcs: [
496 "subcontext_benchmark.cpp",
497 ],
Tom Cherry618d3102018-01-19 14:25:48 -0800498 static_libs: ["libinit"],
Tom Cherrycb0f9bb2017-09-12 15:58:47 -0700499}
500
Tom Cherrya2f91362020-02-20 10:50:00 -0800501cc_defaults {
502 name: "libinit_test_utils_libraries_defaults",
503 shared_libs: [
504 "libbase",
505 "libcutils",
506 "libselinux",
507 "libhidl-gen-utils",
508 "liblog",
509 "libprocessgroup",
510 "libprotobuf-cpp-lite",
511 ],
512}
513
514cc_library_static {
515 name: "libinit_test_utils",
516 defaults: ["libinit_test_utils_libraries_defaults"],
517 cflags: [
518 "-Wall",
519 "-Wextra",
520 "-Wno-unused-parameter",
521 "-Werror",
522 ],
523 srcs: init_common_sources + [
524 "test_utils/service_utils.cpp",
525 ],
526 whole_static_libs: [
527 "libcap",
528 ],
529 export_include_dirs: ["test_utils/include"], // for tests
Florian Mayerd705c2d2022-09-12 18:19:47 -0700530 header_libs: ["bionic_libc_platform_headers"],
Tom Cherrya2f91362020-02-20 10:50:00 -0800531}
532
Tom Cherryde6bd502018-02-13 16:50:08 -0800533// Host Verifier
534// ------------------------------------------------------------------------------
535
536genrule {
537 name: "generated_stub_builtin_function_map",
Tom Cherry4772f1d2019-07-30 09:34:41 -0700538 tool_files: ["host_builtin_map.py"],
Tom Cherryde6bd502018-02-13 16:50:08 -0800539 out: ["generated_stub_builtin_function_map.h"],
Daniel Normand2533c32019-08-02 15:13:50 -0700540 srcs: [
541 "builtins.cpp",
542 "check_builtins.cpp",
543 ],
Tom Cherry4772f1d2019-07-30 09:34:41 -0700544 cmd: "$(location host_builtin_map.py) --builtins $(location builtins.cpp) --check_builtins $(location check_builtins.cpp) > $(out)",
Tom Cherryde6bd502018-02-13 16:50:08 -0800545}
546
Daniel Normanf1200fb2022-03-09 10:49:26 -0800547cc_defaults {
548 name: "init_host_defaults",
Tom Cherryde6bd502018-02-13 16:50:08 -0800549 host_supported: true,
Tom Cherryde6bd502018-02-13 16:50:08 -0800550 cflags: [
551 "-Wall",
552 "-Wextra",
553 "-Wno-unused-parameter",
554 "-Werror",
555 ],
556 static_libs: [
557 "libbase",
558 "libselinux",
Tom Cherryb5f2ec02019-11-08 17:54:27 -0800559 "libpropertyinfoserializer",
560 "libpropertyinfoparser",
Tom Cherryde6bd502018-02-13 16:50:08 -0800561 ],
562 whole_static_libs: ["libcap"],
563 shared_libs: [
Tom Cherryde6bd502018-02-13 16:50:08 -0800564 "libcutils",
Daniel Norman3f42a762019-07-09 11:00:53 -0700565 "libhidl-gen-utils",
Steven Moreland422a7582019-10-15 14:53:19 -0700566 "libhidlmetadata",
Daniel Norman3f42a762019-07-09 11:00:53 -0700567 "liblog",
568 "libprocessgroup",
569 "libprotobuf-cpp-lite",
Tom Cherryde6bd502018-02-13 16:50:08 -0800570 ],
Tom Cherryde6bd502018-02-13 16:50:08 -0800571 proto: {
572 type: "lite",
573 },
Yifan Hong3c4aa112018-06-20 22:49:48 +0000574 generated_headers: [
575 "generated_stub_builtin_function_map",
Daniel Norman8082ba22019-07-23 10:26:15 -0700576 "generated_android_ids",
Yifan Hong3c4aa112018-06-20 22:49:48 +0000577 ],
Tom Cherry96ff0fe2018-02-28 17:20:27 -0800578 target: {
Tom Cherry547f7312018-02-28 21:40:46 -0800579 android: {
580 enabled: false,
581 },
Tom Cherry96ff0fe2018-02-28 17:20:27 -0800582 darwin: {
Yifan Hong3c4aa112018-06-20 22:49:48 +0000583 enabled: false,
Tom Cherry96ff0fe2018-02-28 17:20:27 -0800584 },
585 },
Tom Cherryde6bd502018-02-13 16:50:08 -0800586}
Suren Baghdasaryan642048d2021-06-15 12:28:24 -0700587
Daniel Normanf1200fb2022-03-09 10:49:26 -0800588cc_binary {
589 name: "host_init_verifier",
590 defaults: ["init_host_defaults"],
591 srcs: init_common_sources + init_host_sources,
592}
593
594cc_library_host_static {
595 name: "libinit_host",
596 defaults: ["init_host_defaults"],
597 srcs: init_common_sources,
598 export_include_dirs: ["."],
599 proto: {
600 export_proto_headers: true,
601 },
602 visibility: [
603 // host_apex_verifier performs a subset of init.rc validation
604 "//system/apex/tools",
605 ],
606}
607
Suren Baghdasaryan642048d2021-06-15 12:28:24 -0700608sh_binary {
Cole Faust7e279e92022-09-05 18:12:42 -0700609 name: "extra_free_kbytes",
Suren Baghdasaryan642048d2021-06-15 12:28:24 -0700610 src: "extra_free_kbytes.sh",
Cole Faust7e279e92022-09-05 18:12:42 -0700611 filename_from_src: true,
Suren Baghdasaryan642048d2021-06-15 12:28:24 -0700612}