blob: c4e74d068b0d673e4d8b3967ce487230521e341f [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",
Nate Myrenb9e05452024-05-28 23:40:59 +000099 "release_write_appcompat_override_system_properties",
Yi-Yo Chiangbb77c542021-09-23 14:14:16 +0000100 ],
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 },
Nate Myrenb9e05452024-05-28 23:40:59 +0000163 release_write_appcompat_override_system_properties: {
164 cflags: ["-DWRITE_APPCOMPAT_OVERRIDE_SYSTEM_PROPERTIES"],
165 }
Yi-Yo Chiangbb77c542021-09-23 14:14:16 +0000166 },
Tom Cherry618d3102018-01-19 14:25:48 -0800167 static_libs: [
Tom Cherry618d3102018-01-19 14:25:48 -0800168 "libavb",
Nikita Ioffe2384e8a2024-03-12 15:34:11 +0000169 "libavf_cc_flags",
David Anderson12e53bc2022-10-03 21:37:12 -0700170 "libbootloader_message",
Bowgo Tsai30afda72019-04-11 23:57:24 +0800171 "libc++fs",
Yifan Hongd8ce1fb2019-03-22 17:21:58 -0700172 "libcgrouprc_format",
Suren Baghdasaryanc29c2ba2019-10-22 17:18:42 -0700173 "liblmkd_utils",
Kelvin Zhang5cb1b022022-04-11 17:29:27 -0700174 "liblz4",
Kelvin Zhang32dcac72023-02-15 16:23:46 -0800175 "libzstd",
Steve Muckle18b981e2019-04-15 17:43:02 -0700176 "libmodprobe",
David Anderson9fd88622021-03-05 14:10:55 -0800177 "libprocinfo",
Tom Cherry618d3102018-01-19 14:25:48 -0800178 "libprotobuf-cpp-lite",
179 "libpropertyinfoserializer",
180 "libpropertyinfoparser",
David Andersonaca0bea2020-09-21 16:34:25 -0700181 "libsnapshot_cow",
David Andersondfe6d072019-10-09 16:24:03 -0700182 "libsnapshot_init",
Jooyung Han1d951b72020-07-05 03:33:36 +0900183 "libxml2",
Jiyong Park648ae3a2019-12-08 00:25:15 +0900184 "lib_apex_manifest_proto_lite",
Yifan Hong66f01152020-04-16 11:05:16 -0700185 "update_metadata-protos",
Jiyong Park787322c2018-06-01 19:26:42 +0900186 ],
187 shared_libs: [
Jiyong Park787322c2018-06-01 19:26:42 +0900188 "libbase",
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",
Tao Bao66209ca2018-07-25 22:35:45 -0700195 "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",
Justin Yun6bc1bfe2024-01-10 13:47:02 +0900203 "libvendorsupport",
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
Nikita Ioffea66adf42023-06-26 14:55:31 +0100216cc_defaults {
217 name: "libinit_defaults",
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.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 },
Nikita Ioffea66adf42023-06-26 14:55:31 +0100253}
254
255cc_library_static {
256 name: "libinit",
257 defaults: ["libinit_defaults"],
258}
259
260cc_library_static {
261 name: "libinit.microdroid",
Nikita Ioffefeb7e0e2024-03-28 00:32:36 +0000262 defaults: [
263 "avf_build_flags_cc",
264 "libinit_defaults",
265 ],
Jiyong Park12c64a72024-04-17 14:15:49 +0900266 recovery_available: false,
Nikita Ioffea66adf42023-06-26 14:55:31 +0100267 cflags: ["-DMICRODROID=1"],
Tom Cherry14fc0132017-05-09 17:11:57 -0700268}
269
Steven Morelandceb36d02019-07-15 15:12:56 -0700270phony {
271 name: "init",
272 required: [
273 "init_second_stage",
274 ],
275}
276
Nikita Ioffe55dd3252023-06-21 16:44:40 +0100277cc_defaults {
278 name: "init_second_stage_defaults",
Tom Cherry31438482018-07-20 14:57:00 -0700279 recovery_available: true,
280 stem: "init",
Tom Cherry14fc0132017-05-09 17:11:57 -0700281 defaults: ["init_defaults"],
Tom Cherry618d3102018-01-19 14:25:48 -0800282 srcs: ["main.cpp"],
Tom Cherry31438482018-07-20 14:57:00 -0700283 symlinks: ["ueventd"],
Jiyong Park12c64a72024-04-17 14:15:49 +0900284}
285
286cc_binary {
287 name: "init_second_stage",
288 defaults: ["init_second_stage_defaults"],
289 static_libs: ["libinit"],
290 visibility: ["//visibility:any_system_partition"],
Martijn Coenen62e985a2018-09-04 06:29:14 +0200291 target: {
Yi-Yo Chiang9ba6a5b2021-07-24 22:50:17 +0800292 platform: {
293 required: [
294 "init.rc",
295 "ueventd.rc",
296 "e2fsdroid",
Cole Faust7e279e92022-09-05 18:12:42 -0700297 "extra_free_kbytes",
Yi-Yo Chiang9ba6a5b2021-07-24 22:50:17 +0800298 "make_f2fs",
299 "mke2fs",
300 "sload_f2fs",
301 ],
302 },
Martijn Coenen62e985a2018-09-04 06:29:14 +0200303 recovery: {
304 cflags: ["-DRECOVERY"],
Jooyung Han1d951b72020-07-05 03:33:36 +0900305 exclude_static_libs: [
306 "libxml2",
307 ],
Daniel Norman8082ba22019-07-23 10:26:15 -0700308 exclude_shared_libs: [
309 "libbinder",
310 "libutils",
311 ],
Yi-Yo Chiang9ba6a5b2021-07-24 22:50:17 +0800312 required: [
313 "init_recovery.rc",
314 "ueventd.rc.recovery",
315 "e2fsdroid.recovery",
316 "make_f2fs.recovery",
317 "mke2fs.recovery",
318 "sload_f2fs.recovery",
319 ],
Martijn Coenen62e985a2018-09-04 06:29:14 +0200320 },
321 },
Nikita Ioffe55dd3252023-06-21 16:44:40 +0100322}
323
324cc_binary {
Nikita Ioffe55dd3252023-06-21 16:44:40 +0100325 name: "init_second_stage.microdroid",
Nikita Ioffefeb7e0e2024-03-28 00:32:36 +0000326 defaults: [
327 "avf_build_flags_cc",
328 "init_second_stage_defaults",
329 ],
Jiyong Park12c64a72024-04-17 14:15:49 +0900330 recovery_available: false,
Nikita Ioffea66adf42023-06-26 14:55:31 +0100331 static_libs: ["libinit.microdroid"],
332 cflags: ["-DMICRODROID=1"],
Nikita Ioffe55dd3252023-06-21 16:44:40 +0100333 installable: false,
Jiyong Park90353782021-01-25 18:41:40 +0900334 visibility: ["//packages/modules/Virtualization/microdroid"],
Tom Cherry14fc0132017-05-09 17:11:57 -0700335}
Tom Cherry14fc0132017-05-09 17:11:57 -0700336
Inseob Kim74182522021-06-11 12:58:53 +0900337soong_config_module_type {
338 name: "init_first_stage_cc_defaults",
339 module_type: "cc_defaults",
340 config_namespace: "ANDROID",
Yi-Yo Chiangddc97632022-10-07 21:15:03 +0800341 bool_variables: ["BOARD_USES_RECOVERY_AS_BOOT"],
Inseob Kim74182522021-06-11 12:58:53 +0900342 properties: ["installable"],
343}
344
345// Do not install init_first_stage even with mma if we're system-as-root.
346// Otherwise, it will overwrite the symlink.
347init_first_stage_cc_defaults {
348 name: "init_first_stage_defaults",
349 soong_config_variables: {
Bowgo Tsaiab079af2021-07-14 15:39:53 +0800350 BOARD_USES_RECOVERY_AS_BOOT: {
351 installable: false,
352 },
Inseob Kim74182522021-06-11 12:58:53 +0900353 },
Inseob Kim74182522021-06-11 12:58:53 +0900354
Inseob Kim74182522021-06-11 12:58:53 +0900355 stem: "init",
Jiyong Park13eb0532021-02-15 14:13:51 +0900356
357 srcs: [
358 "block_dev_initializer.cpp",
359 "devices.cpp",
360 "first_stage_console.cpp",
361 "first_stage_init.cpp",
362 "first_stage_main.cpp",
363 "first_stage_mount.cpp",
364 "reboot_utils.cpp",
365 "selabel.cpp",
Jiyong Park13eb0532021-02-15 14:13:51 +0900366 "service_utils.cpp",
367 "snapuserd_transition.cpp",
368 "switch_root.cpp",
369 "uevent_listener.cpp",
370 "util.cpp",
371 ],
372
373 static_libs: [
374 "libc++fs",
375 "libfs_avb",
Nikita Ioffe2384e8a2024-03-12 15:34:11 +0000376 "libavf_cc_flags",
Jiyong Park13eb0532021-02-15 14:13:51 +0900377 "libfs_mgr",
378 "libfec",
379 "libfec_rs",
380 "libsquashfs_utils",
Jiyong Park13eb0532021-02-15 14:13:51 +0900381 "libcrypto_utils",
Jiyong Park13eb0532021-02-15 14:13:51 +0900382 "libavb",
Jiyong Park13eb0532021-02-15 14:13:51 +0900383 "liblp",
384 "libcutils",
385 "libbase",
386 "liblog",
387 "libcrypto_static",
Jiyong Park13eb0532021-02-15 14:13:51 +0900388 "libselinux",
389 "libcap",
390 "libgsi",
Jiyong Park13eb0532021-02-15 14:13:51 +0900391 "liblzma",
392 "libunwindstack_no_dex",
Jiyong Park13eb0532021-02-15 14:13:51 +0900393 "libmodprobe",
394 "libext2_uuid",
395 "libprotobuf-cpp-lite",
396 "libsnapshot_cow",
Kelvin Zhang5cb1b022022-04-11 17:29:27 -0700397 "liblz4",
Kelvin Zhang32dcac72023-02-15 16:23:46 -0800398 "libzstd",
Jiyong Park13eb0532021-02-15 14:13:51 +0900399 "libsnapshot_init",
400 "update_metadata-protos",
David Anderson9fd88622021-03-05 14:10:55 -0800401 "libprocinfo",
Jiyong Park13eb0532021-02-15 14:13:51 +0900402 ],
403
404 static_executable: true,
Inseob Kim74182522021-06-11 12:58:53 +0900405 system_shared_libs: [],
Jiyong Park13eb0532021-02-15 14:13:51 +0900406
407 cflags: [
408 "-Wall",
409 "-Wextra",
410 "-Wno-unused-parameter",
411 "-Werror",
412 "-DALLOW_FIRST_STAGE_CONSOLE=0",
413 "-DALLOW_LOCAL_PROP_OVERRIDE=0",
414 "-DALLOW_PERMISSIVE_SELINUX=0",
415 "-DREBOOT_BOOTLOADER_ON_PANIC=0",
416 "-DWORLD_WRITABLE_KMSG=0",
417 "-DDUMP_ON_UMOUNT_FAILURE=0",
418 "-DSHUTDOWN_ZERO_TIMEOUT=0",
419 "-DLOG_UEVENTS=0",
420 "-DSEPOLICY_VERSION=30", // TODO(jiyong): externalize the version number
421 ],
422
423 product_variables: {
424 debuggable: {
425 cflags: [
426 "-UALLOW_FIRST_STAGE_CONSOLE",
427 "-DALLOW_FIRST_STAGE_CONSOLE=1",
428
429 "-UALLOW_LOCAL_PROP_OVERRIDE",
430 "-DALLOW_LOCAL_PROP_OVERRIDE=1",
431
432 "-UALLOW_PERMISSIVE_SELINUX",
433 "-DALLOW_PERMISSIVE_SELINUX=1",
434
435 "-UREBOOT_BOOTLOADER_ON_PANIC",
436 "-DREBOOT_BOOTLOADER_ON_PANIC=1",
437
438 "-UWORLD_WRITABLE_KMSG",
439 "-DWORLD_WRITABLE_KMSG=1",
440
441 "-UDUMP_ON_UMOUNT_FAILURE",
442 "-DDUMP_ON_UMOUNT_FAILURE=1",
443 ],
444 },
445
446 eng: {
447 cflags: [
448 "-USHUTDOWN_ZERO_TIMEOUT",
449 "-DSHUTDOWN_ZERO_TIMEOUT=1",
450 ],
451 },
452 },
453
454 sanitize: {
455 misc_undefined: ["signed-integer-overflow"],
Inseob Kim74182522021-06-11 12:58:53 +0900456
457 // First stage init is weird: it may start without stdout/stderr, and no /proc.
Jiyong Park13eb0532021-02-15 14:13:51 +0900458 hwaddress: false,
459 },
Inseob Kim74182522021-06-11 12:58:53 +0900460
461 // Install adb_debug.prop into debug ramdisk.
462 // This allows adb root on a user build, when debug ramdisk is used.
463 required: ["adb_debug.prop"],
464
465 ramdisk: true,
466
467 install_in_root: true,
468}
469
Nikita Ioffe55dd3252023-06-21 16:44:40 +0100470cc_binary {
471 name: "init_first_stage",
472 defaults: ["init_first_stage_defaults"],
473}
474
475cc_binary {
476 name: "init_first_stage.microdroid",
Nikita Ioffe2384e8a2024-03-12 15:34:11 +0000477 defaults: [
478 "avf_build_flags_cc",
Nikita Ioffe1e114e62024-03-05 00:23:31 +0000479 "init_first_stage_defaults",
Nikita Ioffe2384e8a2024-03-12 15:34:11 +0000480 ],
Nikita Ioffea66adf42023-06-26 14:55:31 +0100481 cflags: ["-DMICRODROID=1"],
Nikita Ioffe55dd3252023-06-21 16:44:40 +0100482 installable: false,
483}
484
Inseob Kim74182522021-06-11 12:58:53 +0900485phony {
486 name: "init_system",
487 required: ["init_second_stage"],
Jiyong Park13eb0532021-02-15 14:13:51 +0900488}
489
Tom Cherry14fc0132017-05-09 17:11:57 -0700490// Tests
491// ------------------------------------------------------------------------------
492
493cc_test {
Jiyong Park75070b32024-01-30 10:17:37 +0900494 // Note: This is NOT a CTS test. See b/320800872
Tom Cherry17b2be02019-08-20 10:43:48 -0700495 name: "CtsInitTestCases",
Tom Cherry14fc0132017-05-09 17:11:57 -0700496 defaults: ["init_defaults"],
Josh Gao6cad1392019-08-27 16:02:38 -0700497 require_root: true,
498
David Andersoncbd082d2022-12-06 20:11:40 -0800499 compile_multilib: "first",
Tom Cherry17b2be02019-08-20 10:43:48 -0700500
Tom Cherry14fc0132017-05-09 17:11:57 -0700501 srcs: [
502 "devices_test.cpp",
David Anderson1de73842021-05-13 20:18:14 -0700503 "epoll_test.cpp",
Tom Cherrydcb3d152019-08-07 16:02:28 -0700504 "firmware_handler_test.cpp",
Tom Cherry14fc0132017-05-09 17:11:57 -0700505 "init_test.cpp",
Bart Van Assche1693f422022-10-19 16:30:15 -0700506 "interprocess_fifo_test.cpp",
Mark Salyzyn75b901d2018-05-15 11:19:43 -0700507 "keychords_test.cpp",
Tom Cherrybdbf5042020-03-04 10:52:08 -0800508 "oneshot_on_test.cpp",
Tom Cherry16fad422017-08-04 15:59:03 -0700509 "persistent_properties_test.cpp",
Tom Cherry14fc0132017-05-09 17:11:57 -0700510 "property_service_test.cpp",
Tom Cherry927c5d52017-12-11 01:40:07 -0800511 "property_type_test.cpp",
Nikita Ioffe660ffde2020-12-10 16:52:35 +0000512 "reboot_test.cpp",
Tom Cherry7ac013d2017-08-25 10:39:25 -0700513 "rlimit_parser_test.cpp",
Tom Cherry14fc0132017-05-09 17:11:57 -0700514 "service_test.cpp",
Tom Cherrycb0f9bb2017-09-12 15:58:47 -0700515 "subcontext_test.cpp",
Tom Cherry2a5a4e72018-06-26 13:56:34 -0700516 "tokenizer_test.cpp",
Tom Cherry5f0198b2018-07-17 15:28:16 -0700517 "ueventd_parser_test.cpp",
Tom Cherryc2e181c2017-07-14 16:29:23 -0700518 "ueventd_test.cpp",
Tom Cherry14fc0132017-05-09 17:11:57 -0700519 "util_test.cpp",
520 ],
Bart Van Assche1693f422022-10-19 16:30:15 -0700521 static_libs: [
522 "libgmock",
523 "libinit",
524 ],
Tom Cherry17b2be02019-08-20 10:43:48 -0700525
526 test_suites: [
Tom Cherry17b2be02019-08-20 10:43:48 -0700527 "device-tests",
Tom Cherry17b2be02019-08-20 10:43:48 -0700528 ],
Tom Cherry14fc0132017-05-09 17:11:57 -0700529}
530
Tom Cherrycb0f9bb2017-09-12 15:58:47 -0700531cc_benchmark {
532 name: "init_benchmarks",
533 defaults: ["init_defaults"],
534 srcs: [
535 "subcontext_benchmark.cpp",
536 ],
Tom Cherry618d3102018-01-19 14:25:48 -0800537 static_libs: ["libinit"],
Tom Cherrycb0f9bb2017-09-12 15:58:47 -0700538}
539
Tom Cherrya2f91362020-02-20 10:50:00 -0800540cc_defaults {
541 name: "libinit_test_utils_libraries_defaults",
542 shared_libs: [
543 "libbase",
544 "libcutils",
545 "libselinux",
Tom Cherrya2f91362020-02-20 10:50:00 -0800546 "liblog",
547 "libprocessgroup",
548 "libprotobuf-cpp-lite",
549 ],
Steven Moreland973aade2023-03-15 19:39:15 +0000550 static_libs: [
Yi-Yo Chiangb8c23252023-07-25 22:08:55 +0800551 "libfs_mgr",
Steven Moreland973aade2023-03-15 19:39:15 +0000552 "libhidl-gen-utils",
553 ],
Tom Cherrya2f91362020-02-20 10:50:00 -0800554}
555
556cc_library_static {
557 name: "libinit_test_utils",
558 defaults: ["libinit_test_utils_libraries_defaults"],
559 cflags: [
560 "-Wall",
561 "-Wextra",
562 "-Wno-unused-parameter",
563 "-Werror",
564 ],
565 srcs: init_common_sources + [
566 "test_utils/service_utils.cpp",
567 ],
568 whole_static_libs: [
569 "libcap",
570 ],
571 export_include_dirs: ["test_utils/include"], // for tests
Florian Mayerd705c2d2022-09-12 18:19:47 -0700572 header_libs: ["bionic_libc_platform_headers"],
Tom Cherrya2f91362020-02-20 10:50:00 -0800573}
574
Tom Cherryde6bd502018-02-13 16:50:08 -0800575// Host Verifier
576// ------------------------------------------------------------------------------
577
578genrule {
579 name: "generated_stub_builtin_function_map",
Tom Cherry4772f1d2019-07-30 09:34:41 -0700580 tool_files: ["host_builtin_map.py"],
Tom Cherryde6bd502018-02-13 16:50:08 -0800581 out: ["generated_stub_builtin_function_map.h"],
Daniel Normand2533c32019-08-02 15:13:50 -0700582 srcs: [
583 "builtins.cpp",
584 "check_builtins.cpp",
585 ],
Tom Cherry4772f1d2019-07-30 09:34:41 -0700586 cmd: "$(location host_builtin_map.py) --builtins $(location builtins.cpp) --check_builtins $(location check_builtins.cpp) > $(out)",
Tom Cherryde6bd502018-02-13 16:50:08 -0800587}
588
Daniel Normanf1200fb2022-03-09 10:49:26 -0800589cc_defaults {
590 name: "init_host_defaults",
Tom Cherryde6bd502018-02-13 16:50:08 -0800591 host_supported: true,
Tom Cherryde6bd502018-02-13 16:50:08 -0800592 cflags: [
593 "-Wall",
594 "-Wextra",
595 "-Wno-unused-parameter",
596 "-Werror",
597 ],
598 static_libs: [
599 "libbase",
600 "libselinux",
Tom Cherryb5f2ec02019-11-08 17:54:27 -0800601 "libpropertyinfoserializer",
602 "libpropertyinfoparser",
Tom Cherryde6bd502018-02-13 16:50:08 -0800603 ],
604 whole_static_libs: ["libcap"],
605 shared_libs: [
Tom Cherryde6bd502018-02-13 16:50:08 -0800606 "libcutils",
Daniel Norman3f42a762019-07-09 11:00:53 -0700607 "libhidl-gen-utils",
Steven Moreland422a7582019-10-15 14:53:19 -0700608 "libhidlmetadata",
Daniel Norman3f42a762019-07-09 11:00:53 -0700609 "liblog",
610 "libprocessgroup",
611 "libprotobuf-cpp-lite",
Tom Cherryde6bd502018-02-13 16:50:08 -0800612 ],
Tom Cherryde6bd502018-02-13 16:50:08 -0800613 proto: {
614 type: "lite",
615 },
Yifan Hong3c4aa112018-06-20 22:49:48 +0000616 generated_headers: [
617 "generated_stub_builtin_function_map",
Yifan Hong3c4aa112018-06-20 22:49:48 +0000618 ],
Tom Cherry96ff0fe2018-02-28 17:20:27 -0800619 target: {
Tom Cherry547f7312018-02-28 21:40:46 -0800620 android: {
621 enabled: false,
622 },
Tom Cherry96ff0fe2018-02-28 17:20:27 -0800623 darwin: {
Yifan Hong3c4aa112018-06-20 22:49:48 +0000624 enabled: false,
Tom Cherry96ff0fe2018-02-28 17:20:27 -0800625 },
626 },
Tom Cherryde6bd502018-02-13 16:50:08 -0800627}
Suren Baghdasaryan642048d2021-06-15 12:28:24 -0700628
Daniel Normanf1200fb2022-03-09 10:49:26 -0800629cc_binary {
630 name: "host_init_verifier",
631 defaults: ["init_host_defaults"],
Jooyung Han39e8be42024-02-16 17:23:34 +0900632 srcs: ["host_init_verifier.cpp"] + init_common_sources + init_host_sources,
Jooyung Han18407b72024-02-24 09:16:35 +0900633 generated_headers: [
634 "generated_android_ids",
635 ],
Daniel Normanf1200fb2022-03-09 10:49:26 -0800636}
637
638cc_library_host_static {
639 name: "libinit_host",
640 defaults: ["init_host_defaults"],
Jooyung Han39e8be42024-02-16 17:23:34 +0900641 srcs: init_common_sources + init_host_sources,
Daniel Normanf1200fb2022-03-09 10:49:26 -0800642 export_include_dirs: ["."],
643 proto: {
644 export_proto_headers: true,
645 },
646 visibility: [
647 // host_apex_verifier performs a subset of init.rc validation
648 "//system/apex/tools",
649 ],
650}
651
Suren Baghdasaryan642048d2021-06-15 12:28:24 -0700652sh_binary {
Cole Faust7e279e92022-09-05 18:12:42 -0700653 name: "extra_free_kbytes",
Suren Baghdasaryan642048d2021-06-15 12:28:24 -0700654 src: "extra_free_kbytes.sh",
Cole Faust7e279e92022-09-05 18:12:42 -0700655 filename_from_src: true,
Suren Baghdasaryan642048d2021-06-15 12:28:24 -0700656}