blob: 06060db5bbebc5d0cec6f39aeee383a05216c7eb [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",
Kelvin Zhang32dcac72023-02-15 16:23:46 -0800172 "libzstd",
Jeffrey Vander Stoepbaeece62022-02-08 12:42:33 +0000173 "libmini_keyctl_static",
Steve Muckle18b981e2019-04-15 17:43:02 -0700174 "libmodprobe",
David Anderson9fd88622021-03-05 14:10:55 -0800175 "libprocinfo",
Tom Cherry618d3102018-01-19 14:25:48 -0800176 "libprotobuf-cpp-lite",
177 "libpropertyinfoserializer",
178 "libpropertyinfoparser",
Jeffrey Vander Stoepbaeece62022-02-08 12:42:33 +0000179 "libsigningutils",
David Andersonaca0bea2020-09-21 16:34:25 -0700180 "libsnapshot_cow",
David Andersondfe6d072019-10-09 16:24:03 -0700181 "libsnapshot_init",
Jooyung Han1d951b72020-07-05 03:33:36 +0900182 "libxml2",
Jiyong Park648ae3a2019-12-08 00:25:15 +0900183 "lib_apex_manifest_proto_lite",
Yifan Hong66f01152020-04-16 11:05:16 -0700184 "update_metadata-protos",
Jiyong Park787322c2018-06-01 19:26:42 +0900185 ],
186 shared_libs: [
Jiyong Park787322c2018-06-01 19:26:42 +0900187 "libbase",
Jeffrey Vander Stoepbaeece62022-02-08 12:42:33 +0000188 "libcrypto",
Tao Bao66209ca2018-07-25 22:35:45 -0700189 "libcutils",
Jiyong Park787322c2018-06-01 19:26:42 +0900190 "libdl",
Tao Bao66209ca2018-07-25 22:35:45 -0700191 "libext4_utils",
192 "libfs_mgr",
David Anderson0e330f12019-01-03 18:16:56 -0800193 "libgsi",
Tao Bao66209ca2018-07-25 22:35:45 -0700194 "libhidl-gen-utils",
195 "libkeyutils",
196 "liblog",
197 "liblogwrap",
Tom Cherry7bfea3d2018-11-06 14:12:05 -0800198 "liblp",
Suren Baghdasaryan82b72a52018-12-21 11:41:50 -0800199 "libprocessgroup",
Yifan Hong6f9ce2e2019-03-05 15:47:16 -0800200 "libprocessgroup_setup",
Jiyong Park012171d2018-06-19 16:55:05 +0900201 "libselinux",
Christopher Ferrisd2bd6c52022-05-11 14:42:38 -0700202 "libunwindstack",
Martijn Coenen62e985a2018-09-04 06:29:14 +0200203 "libutils",
Jeffrey Vander Stoepbaeece62022-02-08 12:42:33 +0000204 "libziparchive",
Tom Cherry618d3102018-01-19 14:25:48 -0800205 ],
Florian Mayerd705c2d2022-09-12 18:19:47 -0700206 header_libs: ["bionic_libc_platform_headers"],
Jiyong Park93318d42018-12-26 17:34:39 +0900207 bootstrap: true,
Daniel Norman8082ba22019-07-23 10:26:15 -0700208 visibility: [":__subpackages__"],
Tom Cherry14fc0132017-05-09 17:11:57 -0700209}
210
Devendra Singhi1df957b2022-02-15 21:52:55 +0530211cc_library_headers {
212 name: "libinit_headers",
213 export_include_dirs: ["."],
214 visibility: [":__subpackages__"],
215}
216
Nikita Ioffea66adf42023-06-26 14:55:31 +0100217cc_defaults {
218 name: "libinit_defaults",
Tom Cherry31438482018-07-20 14:57:00 -0700219 recovery_available: true,
Daniel Norman8082ba22019-07-23 10:26:15 -0700220 defaults: [
221 "init_defaults",
222 "selinux_policy_version",
223 ],
Tom Cherry66196492020-02-06 11:56:58 -0800224 srcs: init_common_sources + init_device_sources,
Deyao Ren07595e12022-07-15 22:02:14 +0000225 export_include_dirs: ["."],
Jooyung Han1d951b72020-07-05 03:33:36 +0900226 generated_sources: [
227 "apex-info-list",
228 ],
Daniel Norman8082ba22019-07-23 10:26:15 -0700229 whole_static_libs: [
230 "libcap",
Trevor Radcliffefcfd7252022-06-08 14:19:45 +0000231 "libcom.android.sysprop.apex",
232 "libcom.android.sysprop.init",
Daniel Norman8082ba22019-07-23 10:26:15 -0700233 ],
Jayant Chowdhary478c7c12018-03-28 18:45:35 -0700234 header_libs: ["bootimg_headers"],
Tom Cherrya97faba2017-09-15 15:44:04 -0700235 proto: {
236 type: "lite",
237 export_proto_headers: true,
238 },
Martijn Coenen62e985a2018-09-04 06:29:14 +0200239
240 target: {
241 recovery: {
242 cflags: ["-DRECOVERY"],
Jooyung Han1d951b72020-07-05 03:33:36 +0900243 exclude_static_libs: [
244 "libxml2",
245 ],
246 exclude_generated_sources: [
247 "apex-info-list",
248 ],
Daniel Norman8082ba22019-07-23 10:26:15 -0700249 exclude_shared_libs: [
250 "libbinder",
251 "libutils",
252 ],
Martijn Coenen62e985a2018-09-04 06:29:14 +0200253 },
254 },
Nikita Ioffea66adf42023-06-26 14:55:31 +0100255}
256
257cc_library_static {
258 name: "libinit",
259 defaults: ["libinit_defaults"],
260}
261
262cc_library_static {
263 name: "libinit.microdroid",
264 defaults: ["libinit_defaults"],
265 cflags: ["-DMICRODROID=1"],
Tom Cherry14fc0132017-05-09 17:11:57 -0700266}
267
Steven Morelandceb36d02019-07-15 15:12:56 -0700268phony {
269 name: "init",
270 required: [
271 "init_second_stage",
272 ],
273}
274
Nikita Ioffe55dd3252023-06-21 16:44:40 +0100275cc_defaults {
276 name: "init_second_stage_defaults",
Tom Cherry31438482018-07-20 14:57:00 -0700277 recovery_available: true,
278 stem: "init",
Tom Cherry14fc0132017-05-09 17:11:57 -0700279 defaults: ["init_defaults"],
Tom Cherry618d3102018-01-19 14:25:48 -0800280 srcs: ["main.cpp"],
Tom Cherry31438482018-07-20 14:57:00 -0700281 symlinks: ["ueventd"],
Martijn Coenen62e985a2018-09-04 06:29:14 +0200282 target: {
Yi-Yo Chiang9ba6a5b2021-07-24 22:50:17 +0800283 platform: {
284 required: [
285 "init.rc",
286 "ueventd.rc",
287 "e2fsdroid",
Cole Faust7e279e92022-09-05 18:12:42 -0700288 "extra_free_kbytes",
Yi-Yo Chiang9ba6a5b2021-07-24 22:50:17 +0800289 "make_f2fs",
290 "mke2fs",
291 "sload_f2fs",
292 ],
293 },
Martijn Coenen62e985a2018-09-04 06:29:14 +0200294 recovery: {
295 cflags: ["-DRECOVERY"],
Jooyung Han1d951b72020-07-05 03:33:36 +0900296 exclude_static_libs: [
297 "libxml2",
298 ],
Daniel Norman8082ba22019-07-23 10:26:15 -0700299 exclude_shared_libs: [
300 "libbinder",
301 "libutils",
302 ],
Yi-Yo Chiang9ba6a5b2021-07-24 22:50:17 +0800303 required: [
304 "init_recovery.rc",
305 "ueventd.rc.recovery",
306 "e2fsdroid.recovery",
307 "make_f2fs.recovery",
308 "mke2fs.recovery",
309 "sload_f2fs.recovery",
310 ],
Martijn Coenen62e985a2018-09-04 06:29:14 +0200311 },
312 },
Nikita Ioffe55dd3252023-06-21 16:44:40 +0100313}
314
315cc_binary {
316 name: "init_second_stage",
317 defaults: ["init_second_stage_defaults"],
Nikita Ioffea66adf42023-06-26 14:55:31 +0100318 static_libs: ["libinit"],
Nikita Ioffe55dd3252023-06-21 16:44:40 +0100319}
320
321cc_binary {
322 name: "init_second_stage.microdroid",
323 defaults: ["init_second_stage_defaults"],
Nikita Ioffea66adf42023-06-26 14:55:31 +0100324 static_libs: ["libinit.microdroid"],
325 cflags: ["-DMICRODROID=1"],
Nikita Ioffe55dd3252023-06-21 16:44:40 +0100326 installable: false,
Jiyong Park90353782021-01-25 18:41:40 +0900327 visibility: ["//packages/modules/Virtualization/microdroid"],
Tom Cherry14fc0132017-05-09 17:11:57 -0700328}
Tom Cherry14fc0132017-05-09 17:11:57 -0700329
Nikita Ioffe55dd3252023-06-21 16:44:40 +0100330
Inseob Kim74182522021-06-11 12:58:53 +0900331soong_config_module_type {
332 name: "init_first_stage_cc_defaults",
333 module_type: "cc_defaults",
334 config_namespace: "ANDROID",
Yi-Yo Chiangddc97632022-10-07 21:15:03 +0800335 bool_variables: ["BOARD_USES_RECOVERY_AS_BOOT"],
Inseob Kim74182522021-06-11 12:58:53 +0900336 properties: ["installable"],
337}
338
339// Do not install init_first_stage even with mma if we're system-as-root.
340// Otherwise, it will overwrite the symlink.
341init_first_stage_cc_defaults {
342 name: "init_first_stage_defaults",
343 soong_config_variables: {
Bowgo Tsaiab079af2021-07-14 15:39:53 +0800344 BOARD_USES_RECOVERY_AS_BOOT: {
345 installable: false,
346 },
Inseob Kim74182522021-06-11 12:58:53 +0900347 },
Inseob Kim74182522021-06-11 12:58:53 +0900348
Inseob Kim74182522021-06-11 12:58:53 +0900349 stem: "init",
Jiyong Park13eb0532021-02-15 14:13:51 +0900350
351 srcs: [
352 "block_dev_initializer.cpp",
353 "devices.cpp",
354 "first_stage_console.cpp",
355 "first_stage_init.cpp",
356 "first_stage_main.cpp",
357 "first_stage_mount.cpp",
358 "reboot_utils.cpp",
359 "selabel.cpp",
Jiyong Park13eb0532021-02-15 14:13:51 +0900360 "service_utils.cpp",
361 "snapuserd_transition.cpp",
362 "switch_root.cpp",
363 "uevent_listener.cpp",
364 "util.cpp",
365 ],
366
367 static_libs: [
368 "libc++fs",
369 "libfs_avb",
370 "libfs_mgr",
371 "libfec",
372 "libfec_rs",
373 "libsquashfs_utils",
Jiyong Park13eb0532021-02-15 14:13:51 +0900374 "libcrypto_utils",
Jiyong Park13eb0532021-02-15 14:13:51 +0900375 "libavb",
Jiyong Park13eb0532021-02-15 14:13:51 +0900376 "liblp",
377 "libcutils",
378 "libbase",
379 "liblog",
380 "libcrypto_static",
Jiyong Park13eb0532021-02-15 14:13:51 +0900381 "libselinux",
382 "libcap",
383 "libgsi",
Jiyong Park13eb0532021-02-15 14:13:51 +0900384 "liblzma",
385 "libunwindstack_no_dex",
Jiyong Park13eb0532021-02-15 14:13:51 +0900386 "libmodprobe",
387 "libext2_uuid",
388 "libprotobuf-cpp-lite",
389 "libsnapshot_cow",
Kelvin Zhang5cb1b022022-04-11 17:29:27 -0700390 "liblz4",
Kelvin Zhang32dcac72023-02-15 16:23:46 -0800391 "libzstd",
Jiyong Park13eb0532021-02-15 14:13:51 +0900392 "libsnapshot_init",
393 "update_metadata-protos",
David Anderson9fd88622021-03-05 14:10:55 -0800394 "libprocinfo",
Jiyong Park13eb0532021-02-15 14:13:51 +0900395 ],
396
397 static_executable: true,
Inseob Kim74182522021-06-11 12:58:53 +0900398 system_shared_libs: [],
Jiyong Park13eb0532021-02-15 14:13:51 +0900399
400 cflags: [
401 "-Wall",
402 "-Wextra",
403 "-Wno-unused-parameter",
404 "-Werror",
405 "-DALLOW_FIRST_STAGE_CONSOLE=0",
406 "-DALLOW_LOCAL_PROP_OVERRIDE=0",
407 "-DALLOW_PERMISSIVE_SELINUX=0",
408 "-DREBOOT_BOOTLOADER_ON_PANIC=0",
409 "-DWORLD_WRITABLE_KMSG=0",
410 "-DDUMP_ON_UMOUNT_FAILURE=0",
411 "-DSHUTDOWN_ZERO_TIMEOUT=0",
412 "-DLOG_UEVENTS=0",
413 "-DSEPOLICY_VERSION=30", // TODO(jiyong): externalize the version number
414 ],
415
416 product_variables: {
417 debuggable: {
418 cflags: [
419 "-UALLOW_FIRST_STAGE_CONSOLE",
420 "-DALLOW_FIRST_STAGE_CONSOLE=1",
421
422 "-UALLOW_LOCAL_PROP_OVERRIDE",
423 "-DALLOW_LOCAL_PROP_OVERRIDE=1",
424
425 "-UALLOW_PERMISSIVE_SELINUX",
426 "-DALLOW_PERMISSIVE_SELINUX=1",
427
428 "-UREBOOT_BOOTLOADER_ON_PANIC",
429 "-DREBOOT_BOOTLOADER_ON_PANIC=1",
430
431 "-UWORLD_WRITABLE_KMSG",
432 "-DWORLD_WRITABLE_KMSG=1",
433
434 "-UDUMP_ON_UMOUNT_FAILURE",
435 "-DDUMP_ON_UMOUNT_FAILURE=1",
436 ],
437 },
438
439 eng: {
440 cflags: [
441 "-USHUTDOWN_ZERO_TIMEOUT",
442 "-DSHUTDOWN_ZERO_TIMEOUT=1",
443 ],
444 },
445 },
446
447 sanitize: {
448 misc_undefined: ["signed-integer-overflow"],
Inseob Kim74182522021-06-11 12:58:53 +0900449
450 // First stage init is weird: it may start without stdout/stderr, and no /proc.
Jiyong Park13eb0532021-02-15 14:13:51 +0900451 hwaddress: false,
452 },
Inseob Kim74182522021-06-11 12:58:53 +0900453
454 // Install adb_debug.prop into debug ramdisk.
455 // This allows adb root on a user build, when debug ramdisk is used.
456 required: ["adb_debug.prop"],
457
458 ramdisk: true,
459
460 install_in_root: true,
461}
462
Nikita Ioffe55dd3252023-06-21 16:44:40 +0100463cc_binary {
464 name: "init_first_stage",
465 defaults: ["init_first_stage_defaults"],
466}
467
468cc_binary {
469 name: "init_first_stage.microdroid",
470 defaults: ["init_first_stage_defaults"],
Nikita Ioffea66adf42023-06-26 14:55:31 +0100471 cflags: ["-DMICRODROID=1"],
Nikita Ioffe55dd3252023-06-21 16:44:40 +0100472 installable: false,
473}
474
Inseob Kim74182522021-06-11 12:58:53 +0900475phony {
476 name: "init_system",
477 required: ["init_second_stage"],
Jiyong Park13eb0532021-02-15 14:13:51 +0900478}
479
Tom Cherry14fc0132017-05-09 17:11:57 -0700480// Tests
481// ------------------------------------------------------------------------------
482
483cc_test {
Tom Cherry17b2be02019-08-20 10:43:48 -0700484 name: "CtsInitTestCases",
Tom Cherry14fc0132017-05-09 17:11:57 -0700485 defaults: ["init_defaults"],
Josh Gao6cad1392019-08-27 16:02:38 -0700486 require_root: true,
487
David Andersoncbd082d2022-12-06 20:11:40 -0800488 compile_multilib: "first",
Tom Cherry17b2be02019-08-20 10:43:48 -0700489
Tom Cherry14fc0132017-05-09 17:11:57 -0700490 srcs: [
491 "devices_test.cpp",
David Anderson1de73842021-05-13 20:18:14 -0700492 "epoll_test.cpp",
Tom Cherrydcb3d152019-08-07 16:02:28 -0700493 "firmware_handler_test.cpp",
Tom Cherry14fc0132017-05-09 17:11:57 -0700494 "init_test.cpp",
Bart Van Assche1693f422022-10-19 16:30:15 -0700495 "interprocess_fifo_test.cpp",
Mark Salyzyn75b901d2018-05-15 11:19:43 -0700496 "keychords_test.cpp",
Tom Cherrybdbf5042020-03-04 10:52:08 -0800497 "oneshot_on_test.cpp",
Tom Cherry16fad422017-08-04 15:59:03 -0700498 "persistent_properties_test.cpp",
Tom Cherry14fc0132017-05-09 17:11:57 -0700499 "property_service_test.cpp",
Tom Cherry927c5d52017-12-11 01:40:07 -0800500 "property_type_test.cpp",
Nikita Ioffe660ffde2020-12-10 16:52:35 +0000501 "reboot_test.cpp",
Tom Cherry7ac013d2017-08-25 10:39:25 -0700502 "rlimit_parser_test.cpp",
Tom Cherry14fc0132017-05-09 17:11:57 -0700503 "service_test.cpp",
Tom Cherrycb0f9bb2017-09-12 15:58:47 -0700504 "subcontext_test.cpp",
Tom Cherry2a5a4e72018-06-26 13:56:34 -0700505 "tokenizer_test.cpp",
Tom Cherry5f0198b2018-07-17 15:28:16 -0700506 "ueventd_parser_test.cpp",
Tom Cherryc2e181c2017-07-14 16:29:23 -0700507 "ueventd_test.cpp",
Tom Cherry14fc0132017-05-09 17:11:57 -0700508 "util_test.cpp",
509 ],
Bart Van Assche1693f422022-10-19 16:30:15 -0700510 static_libs: [
511 "libgmock",
512 "libinit",
513 ],
Tom Cherry17b2be02019-08-20 10:43:48 -0700514
515 test_suites: [
516 "cts",
517 "device-tests",
Tom Cherry17b2be02019-08-20 10:43:48 -0700518 ],
Tom Cherry14fc0132017-05-09 17:11:57 -0700519}
520
Tom Cherrycb0f9bb2017-09-12 15:58:47 -0700521cc_benchmark {
522 name: "init_benchmarks",
523 defaults: ["init_defaults"],
524 srcs: [
525 "subcontext_benchmark.cpp",
526 ],
Tom Cherry618d3102018-01-19 14:25:48 -0800527 static_libs: ["libinit"],
Tom Cherrycb0f9bb2017-09-12 15:58:47 -0700528}
529
Tom Cherrya2f91362020-02-20 10:50:00 -0800530cc_defaults {
531 name: "libinit_test_utils_libraries_defaults",
532 shared_libs: [
533 "libbase",
534 "libcutils",
535 "libselinux",
Tom Cherrya2f91362020-02-20 10:50:00 -0800536 "liblog",
537 "libprocessgroup",
538 "libprotobuf-cpp-lite",
539 ],
Steven Moreland973aade2023-03-15 19:39:15 +0000540 static_libs: [
541 "libhidl-gen-utils",
542 ],
Tom Cherrya2f91362020-02-20 10:50:00 -0800543}
544
545cc_library_static {
546 name: "libinit_test_utils",
547 defaults: ["libinit_test_utils_libraries_defaults"],
548 cflags: [
549 "-Wall",
550 "-Wextra",
551 "-Wno-unused-parameter",
552 "-Werror",
553 ],
554 srcs: init_common_sources + [
555 "test_utils/service_utils.cpp",
556 ],
557 whole_static_libs: [
558 "libcap",
559 ],
560 export_include_dirs: ["test_utils/include"], // for tests
Florian Mayerd705c2d2022-09-12 18:19:47 -0700561 header_libs: ["bionic_libc_platform_headers"],
Tom Cherrya2f91362020-02-20 10:50:00 -0800562}
563
Tom Cherryde6bd502018-02-13 16:50:08 -0800564// Host Verifier
565// ------------------------------------------------------------------------------
566
567genrule {
568 name: "generated_stub_builtin_function_map",
Tom Cherry4772f1d2019-07-30 09:34:41 -0700569 tool_files: ["host_builtin_map.py"],
Tom Cherryde6bd502018-02-13 16:50:08 -0800570 out: ["generated_stub_builtin_function_map.h"],
Daniel Normand2533c32019-08-02 15:13:50 -0700571 srcs: [
572 "builtins.cpp",
573 "check_builtins.cpp",
574 ],
Tom Cherry4772f1d2019-07-30 09:34:41 -0700575 cmd: "$(location host_builtin_map.py) --builtins $(location builtins.cpp) --check_builtins $(location check_builtins.cpp) > $(out)",
Tom Cherryde6bd502018-02-13 16:50:08 -0800576}
577
Daniel Normanf1200fb2022-03-09 10:49:26 -0800578cc_defaults {
579 name: "init_host_defaults",
Tom Cherryde6bd502018-02-13 16:50:08 -0800580 host_supported: true,
Tom Cherryde6bd502018-02-13 16:50:08 -0800581 cflags: [
582 "-Wall",
583 "-Wextra",
584 "-Wno-unused-parameter",
585 "-Werror",
586 ],
587 static_libs: [
588 "libbase",
589 "libselinux",
Tom Cherryb5f2ec02019-11-08 17:54:27 -0800590 "libpropertyinfoserializer",
591 "libpropertyinfoparser",
Tom Cherryde6bd502018-02-13 16:50:08 -0800592 ],
593 whole_static_libs: ["libcap"],
594 shared_libs: [
Tom Cherryde6bd502018-02-13 16:50:08 -0800595 "libcutils",
Daniel Norman3f42a762019-07-09 11:00:53 -0700596 "libhidl-gen-utils",
Steven Moreland422a7582019-10-15 14:53:19 -0700597 "libhidlmetadata",
Daniel Norman3f42a762019-07-09 11:00:53 -0700598 "liblog",
599 "libprocessgroup",
600 "libprotobuf-cpp-lite",
Tom Cherryde6bd502018-02-13 16:50:08 -0800601 ],
Tom Cherryde6bd502018-02-13 16:50:08 -0800602 proto: {
603 type: "lite",
604 },
Yifan Hong3c4aa112018-06-20 22:49:48 +0000605 generated_headers: [
606 "generated_stub_builtin_function_map",
Daniel Norman8082ba22019-07-23 10:26:15 -0700607 "generated_android_ids",
Yifan Hong3c4aa112018-06-20 22:49:48 +0000608 ],
Tom Cherry96ff0fe2018-02-28 17:20:27 -0800609 target: {
Tom Cherry547f7312018-02-28 21:40:46 -0800610 android: {
611 enabled: false,
612 },
Tom Cherry96ff0fe2018-02-28 17:20:27 -0800613 darwin: {
Yifan Hong3c4aa112018-06-20 22:49:48 +0000614 enabled: false,
Tom Cherry96ff0fe2018-02-28 17:20:27 -0800615 },
616 },
Tom Cherryde6bd502018-02-13 16:50:08 -0800617}
Suren Baghdasaryan642048d2021-06-15 12:28:24 -0700618
Daniel Normanf1200fb2022-03-09 10:49:26 -0800619cc_binary {
620 name: "host_init_verifier",
621 defaults: ["init_host_defaults"],
622 srcs: init_common_sources + init_host_sources,
623}
624
625cc_library_host_static {
626 name: "libinit_host",
627 defaults: ["init_host_defaults"],
628 srcs: init_common_sources,
629 export_include_dirs: ["."],
630 proto: {
631 export_proto_headers: true,
632 },
633 visibility: [
634 // host_apex_verifier performs a subset of init.rc validation
635 "//system/apex/tools",
636 ],
637}
638
Suren Baghdasaryan642048d2021-06-15 12:28:24 -0700639sh_binary {
Cole Faust7e279e92022-09-05 18:12:42 -0700640 name: "extra_free_kbytes",
Suren Baghdasaryan642048d2021-06-15 12:28:24 -0700641 src: "extra_free_kbytes.sh",
Cole Faust7e279e92022-09-05 18:12:42 -0700642 filename_from_src: true,
Suren Baghdasaryan642048d2021-06-15 12:28:24 -0700643}