Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 1 | // |
| 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 Badour | d69ad69 | 2021-02-16 19:02:14 -0800 | [diff] [blame] | 17 | package { |
| 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 |
| 23 | license { |
| 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 Cherry | 6619649 | 2020-02-06 11:56:58 -0800 | [diff] [blame] | 34 | init_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 Assche | 1693f42 | 2022-10-19 16:30:15 -0700 | [diff] [blame] | 42 | "interprocess_fifo.cpp", |
Tom Cherry | 6619649 | 2020-02-06 11:56:58 -0800 | [diff] [blame] | 43 | "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 | ] |
| 56 | init_device_sources = [ |
Deyao Ren | 238e909 | 2022-07-21 23:05:13 +0000 | [diff] [blame] | 57 | "apex_init_util.cpp", |
David Anderson | 4117559 | 2020-03-20 19:38:28 -0700 | [diff] [blame] | 58 | "block_dev_initializer.cpp", |
Tom Cherry | 6619649 | 2020-02-06 11:56:58 -0800 | [diff] [blame] | 59 | "bootchart.cpp", |
| 60 | "builtins.cpp", |
| 61 | "devices.cpp", |
| 62 | "firmware_handler.cpp", |
Steve Muckle | a4bf2ce | 2019-11-01 13:58:02 -0700 | [diff] [blame] | 63 | "first_stage_console.cpp", |
Tom Cherry | 6619649 | 2020-02-06 11:56:58 -0800 | [diff] [blame] | 64 | "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 Anderson | 491e4da | 2020-12-08 00:21:20 -0800 | [diff] [blame] | 82 | "snapuserd_transition.cpp", |
Tom Cherry | 6619649 | 2020-02-06 11:56:58 -0800 | [diff] [blame] | 83 | "switch_root.cpp", |
| 84 | "uevent_listener.cpp", |
| 85 | "ueventd.cpp", |
| 86 | "ueventd_parser.cpp", |
| 87 | ] |
| 88 | init_host_sources = [ |
| 89 | "check_builtins.cpp", |
| 90 | "host_import_parser.cpp", |
Tom Cherry | 6619649 | 2020-02-06 11:56:58 -0800 | [diff] [blame] | 91 | ] |
| 92 | |
Yi-Yo Chiang | bb77c54 | 2021-09-23 14:14:16 +0000 | [diff] [blame] | 93 | soong_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 | |
| 105 | libinit_cc_defaults { |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 106 | name: "init_defaults", |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 107 | sanitize: { |
Tom Cherry | 2ffd65e | 2017-07-26 14:17:09 -0700 | [diff] [blame] | 108 | misc_undefined: ["signed-integer-overflow"], |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 109 | }, |
Chih-Hung Hsieh | 122352d | 2017-10-02 15:20:07 -0700 | [diff] [blame] | 110 | cflags: [ |
Steve Muckle | d75f30a | 2019-05-21 15:50:39 -0700 | [diff] [blame] | 111 | "-DALLOW_FIRST_STAGE_CONSOLE=0", |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 112 | "-DALLOW_LOCAL_PROP_OVERRIDE=0", |
| 113 | "-DALLOW_PERMISSIVE_SELINUX=0", |
Bart Van Assche | aee2ec8 | 2022-12-02 18:48:15 -0800 | [diff] [blame] | 114 | "-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION", |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 115 | "-DDUMP_ON_UMOUNT_FAILURE=0", |
Tom Cherry | a2f9136 | 2020-02-20 10:50:00 -0800 | [diff] [blame] | 116 | "-DINIT_FULL_SOURCES", |
Yi-Yo Chiang | bb77c54 | 2021-09-23 14:14:16 +0000 | [diff] [blame] | 117 | "-DINSTALL_DEBUG_POLICY_TO_SYSTEM_EXT=0", |
Bart Van Assche | 91ba219 | 2022-12-02 18:48:48 -0800 | [diff] [blame] | 118 | "-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 Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 127 | ], |
| 128 | product_variables: { |
| 129 | debuggable: { |
| 130 | cppflags: [ |
Steve Muckle | d75f30a | 2019-05-21 15:50:39 -0700 | [diff] [blame] | 131 | "-UALLOW_FIRST_STAGE_CONSOLE", |
| 132 | "-DALLOW_FIRST_STAGE_CONSOLE=1", |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 133 | "-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 Shmidt | c3bc509 | 2017-08-23 14:57:07 -0700 | [diff] [blame] | 151 | uml: { |
| 152 | cppflags: ["-DUSER_MODE_LINUX"], |
Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 153 | }, |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 154 | }, |
Yi-Yo Chiang | bb77c54 | 2021-09-23 14:14:16 +0000 | [diff] [blame] | 155 | 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 Cherry | 618d310 | 2018-01-19 14:25:48 -0800 | [diff] [blame] | 163 | static_libs: [ |
Tom Cherry | 618d310 | 2018-01-19 14:25:48 -0800 | [diff] [blame] | 164 | "libavb", |
Nikita Ioffe | 2384e8a | 2024-03-12 15:34:11 +0000 | [diff] [blame^] | 165 | "libavf_cc_flags", |
David Anderson | 12e53bc | 2022-10-03 21:37:12 -0700 | [diff] [blame] | 166 | "libbootloader_message", |
Bowgo Tsai | 30afda7 | 2019-04-11 23:57:24 +0800 | [diff] [blame] | 167 | "libc++fs", |
Yifan Hong | d8ce1fb | 2019-03-22 17:21:58 -0700 | [diff] [blame] | 168 | "libcgrouprc_format", |
Suren Baghdasaryan | c29c2ba | 2019-10-22 17:18:42 -0700 | [diff] [blame] | 169 | "liblmkd_utils", |
Kelvin Zhang | 5cb1b02 | 2022-04-11 17:29:27 -0700 | [diff] [blame] | 170 | "liblz4", |
Kelvin Zhang | 32dcac7 | 2023-02-15 16:23:46 -0800 | [diff] [blame] | 171 | "libzstd", |
Steve Muckle | 18b981e | 2019-04-15 17:43:02 -0700 | [diff] [blame] | 172 | "libmodprobe", |
David Anderson | 9fd8862 | 2021-03-05 14:10:55 -0800 | [diff] [blame] | 173 | "libprocinfo", |
Tom Cherry | 618d310 | 2018-01-19 14:25:48 -0800 | [diff] [blame] | 174 | "libprotobuf-cpp-lite", |
| 175 | "libpropertyinfoserializer", |
| 176 | "libpropertyinfoparser", |
David Anderson | aca0bea | 2020-09-21 16:34:25 -0700 | [diff] [blame] | 177 | "libsnapshot_cow", |
David Anderson | dfe6d07 | 2019-10-09 16:24:03 -0700 | [diff] [blame] | 178 | "libsnapshot_init", |
Jooyung Han | 1d951b7 | 2020-07-05 03:33:36 +0900 | [diff] [blame] | 179 | "libxml2", |
Jiyong Park | 648ae3a | 2019-12-08 00:25:15 +0900 | [diff] [blame] | 180 | "lib_apex_manifest_proto_lite", |
Yifan Hong | 66f0115 | 2020-04-16 11:05:16 -0700 | [diff] [blame] | 181 | "update_metadata-protos", |
Jiyong Park | 787322c | 2018-06-01 19:26:42 +0900 | [diff] [blame] | 182 | ], |
| 183 | shared_libs: [ |
Jiyong Park | 787322c | 2018-06-01 19:26:42 +0900 | [diff] [blame] | 184 | "libbase", |
Tao Bao | 66209ca | 2018-07-25 22:35:45 -0700 | [diff] [blame] | 185 | "libcutils", |
Jiyong Park | 787322c | 2018-06-01 19:26:42 +0900 | [diff] [blame] | 186 | "libdl", |
Tao Bao | 66209ca | 2018-07-25 22:35:45 -0700 | [diff] [blame] | 187 | "libext4_utils", |
| 188 | "libfs_mgr", |
David Anderson | 0e330f1 | 2019-01-03 18:16:56 -0800 | [diff] [blame] | 189 | "libgsi", |
Tao Bao | 66209ca | 2018-07-25 22:35:45 -0700 | [diff] [blame] | 190 | "libhidl-gen-utils", |
Tao Bao | 66209ca | 2018-07-25 22:35:45 -0700 | [diff] [blame] | 191 | "liblog", |
| 192 | "liblogwrap", |
Tom Cherry | 7bfea3d | 2018-11-06 14:12:05 -0800 | [diff] [blame] | 193 | "liblp", |
Suren Baghdasaryan | 82b72a5 | 2018-12-21 11:41:50 -0800 | [diff] [blame] | 194 | "libprocessgroup", |
Yifan Hong | 6f9ce2e | 2019-03-05 15:47:16 -0800 | [diff] [blame] | 195 | "libprocessgroup_setup", |
Jiyong Park | 012171d | 2018-06-19 16:55:05 +0900 | [diff] [blame] | 196 | "libselinux", |
Christopher Ferris | d2bd6c5 | 2022-05-11 14:42:38 -0700 | [diff] [blame] | 197 | "libunwindstack", |
Martijn Coenen | 62e985a | 2018-09-04 06:29:14 +0200 | [diff] [blame] | 198 | "libutils", |
Justin Yun | 6bc1bfe | 2024-01-10 13:47:02 +0900 | [diff] [blame] | 199 | "libvendorsupport", |
Tom Cherry | 618d310 | 2018-01-19 14:25:48 -0800 | [diff] [blame] | 200 | ], |
Florian Mayer | d705c2d | 2022-09-12 18:19:47 -0700 | [diff] [blame] | 201 | header_libs: ["bionic_libc_platform_headers"], |
Jiyong Park | 93318d4 | 2018-12-26 17:34:39 +0900 | [diff] [blame] | 202 | bootstrap: true, |
Daniel Norman | 8082ba2 | 2019-07-23 10:26:15 -0700 | [diff] [blame] | 203 | visibility: [":__subpackages__"], |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 204 | } |
| 205 | |
Devendra Singhi | 1df957b | 2022-02-15 21:52:55 +0530 | [diff] [blame] | 206 | cc_library_headers { |
| 207 | name: "libinit_headers", |
| 208 | export_include_dirs: ["."], |
| 209 | visibility: [":__subpackages__"], |
| 210 | } |
| 211 | |
Nikita Ioffe | a66adf4 | 2023-06-26 14:55:31 +0100 | [diff] [blame] | 212 | cc_defaults { |
| 213 | name: "libinit_defaults", |
Tom Cherry | 3143848 | 2018-07-20 14:57:00 -0700 | [diff] [blame] | 214 | recovery_available: true, |
Daniel Norman | 8082ba2 | 2019-07-23 10:26:15 -0700 | [diff] [blame] | 215 | defaults: [ |
| 216 | "init_defaults", |
| 217 | "selinux_policy_version", |
| 218 | ], |
Tom Cherry | 6619649 | 2020-02-06 11:56:58 -0800 | [diff] [blame] | 219 | srcs: init_common_sources + init_device_sources, |
Deyao Ren | 07595e1 | 2022-07-15 22:02:14 +0000 | [diff] [blame] | 220 | export_include_dirs: ["."], |
Jooyung Han | 1d951b7 | 2020-07-05 03:33:36 +0900 | [diff] [blame] | 221 | generated_sources: [ |
| 222 | "apex-info-list", |
| 223 | ], |
Daniel Norman | 8082ba2 | 2019-07-23 10:26:15 -0700 | [diff] [blame] | 224 | whole_static_libs: [ |
| 225 | "libcap", |
Trevor Radcliffe | fcfd725 | 2022-06-08 14:19:45 +0000 | [diff] [blame] | 226 | "libcom.android.sysprop.init", |
Daniel Norman | 8082ba2 | 2019-07-23 10:26:15 -0700 | [diff] [blame] | 227 | ], |
Jayant Chowdhary | 478c7c1 | 2018-03-28 18:45:35 -0700 | [diff] [blame] | 228 | header_libs: ["bootimg_headers"], |
Tom Cherry | a97faba | 2017-09-15 15:44:04 -0700 | [diff] [blame] | 229 | proto: { |
| 230 | type: "lite", |
| 231 | export_proto_headers: true, |
| 232 | }, |
Martijn Coenen | 62e985a | 2018-09-04 06:29:14 +0200 | [diff] [blame] | 233 | |
| 234 | target: { |
| 235 | recovery: { |
| 236 | cflags: ["-DRECOVERY"], |
Jooyung Han | 1d951b7 | 2020-07-05 03:33:36 +0900 | [diff] [blame] | 237 | exclude_static_libs: [ |
| 238 | "libxml2", |
| 239 | ], |
| 240 | exclude_generated_sources: [ |
| 241 | "apex-info-list", |
| 242 | ], |
Daniel Norman | 8082ba2 | 2019-07-23 10:26:15 -0700 | [diff] [blame] | 243 | exclude_shared_libs: [ |
| 244 | "libbinder", |
| 245 | "libutils", |
| 246 | ], |
Martijn Coenen | 62e985a | 2018-09-04 06:29:14 +0200 | [diff] [blame] | 247 | }, |
| 248 | }, |
Nikita Ioffe | a66adf4 | 2023-06-26 14:55:31 +0100 | [diff] [blame] | 249 | } |
| 250 | |
| 251 | cc_library_static { |
| 252 | name: "libinit", |
| 253 | defaults: ["libinit_defaults"], |
| 254 | } |
| 255 | |
| 256 | cc_library_static { |
| 257 | name: "libinit.microdroid", |
| 258 | defaults: ["libinit_defaults"], |
| 259 | cflags: ["-DMICRODROID=1"], |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 260 | } |
| 261 | |
Steven Moreland | ceb36d0 | 2019-07-15 15:12:56 -0700 | [diff] [blame] | 262 | phony { |
| 263 | name: "init", |
| 264 | required: [ |
| 265 | "init_second_stage", |
| 266 | ], |
| 267 | } |
| 268 | |
Nikita Ioffe | 55dd325 | 2023-06-21 16:44:40 +0100 | [diff] [blame] | 269 | cc_defaults { |
| 270 | name: "init_second_stage_defaults", |
Tom Cherry | 3143848 | 2018-07-20 14:57:00 -0700 | [diff] [blame] | 271 | recovery_available: true, |
| 272 | stem: "init", |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 273 | defaults: ["init_defaults"], |
Tom Cherry | 618d310 | 2018-01-19 14:25:48 -0800 | [diff] [blame] | 274 | srcs: ["main.cpp"], |
Tom Cherry | 3143848 | 2018-07-20 14:57:00 -0700 | [diff] [blame] | 275 | symlinks: ["ueventd"], |
Martijn Coenen | 62e985a | 2018-09-04 06:29:14 +0200 | [diff] [blame] | 276 | target: { |
Yi-Yo Chiang | 9ba6a5b | 2021-07-24 22:50:17 +0800 | [diff] [blame] | 277 | platform: { |
| 278 | required: [ |
| 279 | "init.rc", |
| 280 | "ueventd.rc", |
| 281 | "e2fsdroid", |
Cole Faust | 7e279e9 | 2022-09-05 18:12:42 -0700 | [diff] [blame] | 282 | "extra_free_kbytes", |
Yi-Yo Chiang | 9ba6a5b | 2021-07-24 22:50:17 +0800 | [diff] [blame] | 283 | "make_f2fs", |
| 284 | "mke2fs", |
| 285 | "sload_f2fs", |
| 286 | ], |
| 287 | }, |
Martijn Coenen | 62e985a | 2018-09-04 06:29:14 +0200 | [diff] [blame] | 288 | recovery: { |
| 289 | cflags: ["-DRECOVERY"], |
Jooyung Han | 1d951b7 | 2020-07-05 03:33:36 +0900 | [diff] [blame] | 290 | exclude_static_libs: [ |
| 291 | "libxml2", |
| 292 | ], |
Daniel Norman | 8082ba2 | 2019-07-23 10:26:15 -0700 | [diff] [blame] | 293 | exclude_shared_libs: [ |
| 294 | "libbinder", |
| 295 | "libutils", |
| 296 | ], |
Yi-Yo Chiang | 9ba6a5b | 2021-07-24 22:50:17 +0800 | [diff] [blame] | 297 | required: [ |
| 298 | "init_recovery.rc", |
| 299 | "ueventd.rc.recovery", |
| 300 | "e2fsdroid.recovery", |
| 301 | "make_f2fs.recovery", |
| 302 | "mke2fs.recovery", |
| 303 | "sload_f2fs.recovery", |
| 304 | ], |
Martijn Coenen | 62e985a | 2018-09-04 06:29:14 +0200 | [diff] [blame] | 305 | }, |
| 306 | }, |
Nikita Ioffe | 55dd325 | 2023-06-21 16:44:40 +0100 | [diff] [blame] | 307 | } |
| 308 | |
| 309 | cc_binary { |
| 310 | name: "init_second_stage", |
| 311 | defaults: ["init_second_stage_defaults"], |
Nikita Ioffe | a66adf4 | 2023-06-26 14:55:31 +0100 | [diff] [blame] | 312 | static_libs: ["libinit"], |
Nikita Ioffe | 55dd325 | 2023-06-21 16:44:40 +0100 | [diff] [blame] | 313 | } |
| 314 | |
| 315 | cc_binary { |
| 316 | name: "init_second_stage.microdroid", |
| 317 | defaults: ["init_second_stage_defaults"], |
Nikita Ioffe | a66adf4 | 2023-06-26 14:55:31 +0100 | [diff] [blame] | 318 | static_libs: ["libinit.microdroid"], |
| 319 | cflags: ["-DMICRODROID=1"], |
Nikita Ioffe | 55dd325 | 2023-06-21 16:44:40 +0100 | [diff] [blame] | 320 | installable: false, |
Jiyong Park | 9035378 | 2021-01-25 18:41:40 +0900 | [diff] [blame] | 321 | visibility: ["//packages/modules/Virtualization/microdroid"], |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 322 | } |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 323 | |
Inseob Kim | 7418252 | 2021-06-11 12:58:53 +0900 | [diff] [blame] | 324 | soong_config_module_type { |
| 325 | name: "init_first_stage_cc_defaults", |
| 326 | module_type: "cc_defaults", |
| 327 | config_namespace: "ANDROID", |
Yi-Yo Chiang | ddc9763 | 2022-10-07 21:15:03 +0800 | [diff] [blame] | 328 | bool_variables: ["BOARD_USES_RECOVERY_AS_BOOT"], |
Inseob Kim | 7418252 | 2021-06-11 12:58:53 +0900 | [diff] [blame] | 329 | properties: ["installable"], |
| 330 | } |
| 331 | |
| 332 | // Do not install init_first_stage even with mma if we're system-as-root. |
| 333 | // Otherwise, it will overwrite the symlink. |
| 334 | init_first_stage_cc_defaults { |
| 335 | name: "init_first_stage_defaults", |
| 336 | soong_config_variables: { |
Bowgo Tsai | ab079af | 2021-07-14 15:39:53 +0800 | [diff] [blame] | 337 | BOARD_USES_RECOVERY_AS_BOOT: { |
| 338 | installable: false, |
| 339 | }, |
Inseob Kim | 7418252 | 2021-06-11 12:58:53 +0900 | [diff] [blame] | 340 | }, |
Inseob Kim | 7418252 | 2021-06-11 12:58:53 +0900 | [diff] [blame] | 341 | |
Inseob Kim | 7418252 | 2021-06-11 12:58:53 +0900 | [diff] [blame] | 342 | stem: "init", |
Jiyong Park | 13eb053 | 2021-02-15 14:13:51 +0900 | [diff] [blame] | 343 | |
| 344 | srcs: [ |
| 345 | "block_dev_initializer.cpp", |
| 346 | "devices.cpp", |
| 347 | "first_stage_console.cpp", |
| 348 | "first_stage_init.cpp", |
| 349 | "first_stage_main.cpp", |
| 350 | "first_stage_mount.cpp", |
| 351 | "reboot_utils.cpp", |
| 352 | "selabel.cpp", |
Jiyong Park | 13eb053 | 2021-02-15 14:13:51 +0900 | [diff] [blame] | 353 | "service_utils.cpp", |
| 354 | "snapuserd_transition.cpp", |
| 355 | "switch_root.cpp", |
| 356 | "uevent_listener.cpp", |
| 357 | "util.cpp", |
| 358 | ], |
| 359 | |
| 360 | static_libs: [ |
| 361 | "libc++fs", |
| 362 | "libfs_avb", |
Nikita Ioffe | 2384e8a | 2024-03-12 15:34:11 +0000 | [diff] [blame^] | 363 | "libavf_cc_flags", |
Jiyong Park | 13eb053 | 2021-02-15 14:13:51 +0900 | [diff] [blame] | 364 | "libfs_mgr", |
| 365 | "libfec", |
| 366 | "libfec_rs", |
| 367 | "libsquashfs_utils", |
Jiyong Park | 13eb053 | 2021-02-15 14:13:51 +0900 | [diff] [blame] | 368 | "libcrypto_utils", |
Jiyong Park | 13eb053 | 2021-02-15 14:13:51 +0900 | [diff] [blame] | 369 | "libavb", |
Jiyong Park | 13eb053 | 2021-02-15 14:13:51 +0900 | [diff] [blame] | 370 | "liblp", |
| 371 | "libcutils", |
| 372 | "libbase", |
| 373 | "liblog", |
| 374 | "libcrypto_static", |
Jiyong Park | 13eb053 | 2021-02-15 14:13:51 +0900 | [diff] [blame] | 375 | "libselinux", |
| 376 | "libcap", |
| 377 | "libgsi", |
Jiyong Park | 13eb053 | 2021-02-15 14:13:51 +0900 | [diff] [blame] | 378 | "liblzma", |
| 379 | "libunwindstack_no_dex", |
Jiyong Park | 13eb053 | 2021-02-15 14:13:51 +0900 | [diff] [blame] | 380 | "libmodprobe", |
| 381 | "libext2_uuid", |
| 382 | "libprotobuf-cpp-lite", |
| 383 | "libsnapshot_cow", |
Kelvin Zhang | 5cb1b02 | 2022-04-11 17:29:27 -0700 | [diff] [blame] | 384 | "liblz4", |
Kelvin Zhang | 32dcac7 | 2023-02-15 16:23:46 -0800 | [diff] [blame] | 385 | "libzstd", |
Jiyong Park | 13eb053 | 2021-02-15 14:13:51 +0900 | [diff] [blame] | 386 | "libsnapshot_init", |
| 387 | "update_metadata-protos", |
David Anderson | 9fd8862 | 2021-03-05 14:10:55 -0800 | [diff] [blame] | 388 | "libprocinfo", |
Jiyong Park | 13eb053 | 2021-02-15 14:13:51 +0900 | [diff] [blame] | 389 | ], |
| 390 | |
| 391 | static_executable: true, |
Inseob Kim | 7418252 | 2021-06-11 12:58:53 +0900 | [diff] [blame] | 392 | system_shared_libs: [], |
Jiyong Park | 13eb053 | 2021-02-15 14:13:51 +0900 | [diff] [blame] | 393 | |
| 394 | cflags: [ |
| 395 | "-Wall", |
| 396 | "-Wextra", |
| 397 | "-Wno-unused-parameter", |
| 398 | "-Werror", |
| 399 | "-DALLOW_FIRST_STAGE_CONSOLE=0", |
| 400 | "-DALLOW_LOCAL_PROP_OVERRIDE=0", |
| 401 | "-DALLOW_PERMISSIVE_SELINUX=0", |
| 402 | "-DREBOOT_BOOTLOADER_ON_PANIC=0", |
| 403 | "-DWORLD_WRITABLE_KMSG=0", |
| 404 | "-DDUMP_ON_UMOUNT_FAILURE=0", |
| 405 | "-DSHUTDOWN_ZERO_TIMEOUT=0", |
| 406 | "-DLOG_UEVENTS=0", |
| 407 | "-DSEPOLICY_VERSION=30", // TODO(jiyong): externalize the version number |
| 408 | ], |
| 409 | |
| 410 | product_variables: { |
| 411 | debuggable: { |
| 412 | cflags: [ |
| 413 | "-UALLOW_FIRST_STAGE_CONSOLE", |
| 414 | "-DALLOW_FIRST_STAGE_CONSOLE=1", |
| 415 | |
| 416 | "-UALLOW_LOCAL_PROP_OVERRIDE", |
| 417 | "-DALLOW_LOCAL_PROP_OVERRIDE=1", |
| 418 | |
| 419 | "-UALLOW_PERMISSIVE_SELINUX", |
| 420 | "-DALLOW_PERMISSIVE_SELINUX=1", |
| 421 | |
| 422 | "-UREBOOT_BOOTLOADER_ON_PANIC", |
| 423 | "-DREBOOT_BOOTLOADER_ON_PANIC=1", |
| 424 | |
| 425 | "-UWORLD_WRITABLE_KMSG", |
| 426 | "-DWORLD_WRITABLE_KMSG=1", |
| 427 | |
| 428 | "-UDUMP_ON_UMOUNT_FAILURE", |
| 429 | "-DDUMP_ON_UMOUNT_FAILURE=1", |
| 430 | ], |
| 431 | }, |
| 432 | |
| 433 | eng: { |
| 434 | cflags: [ |
| 435 | "-USHUTDOWN_ZERO_TIMEOUT", |
| 436 | "-DSHUTDOWN_ZERO_TIMEOUT=1", |
| 437 | ], |
| 438 | }, |
| 439 | }, |
| 440 | |
| 441 | sanitize: { |
| 442 | misc_undefined: ["signed-integer-overflow"], |
Inseob Kim | 7418252 | 2021-06-11 12:58:53 +0900 | [diff] [blame] | 443 | |
| 444 | // First stage init is weird: it may start without stdout/stderr, and no /proc. |
Jiyong Park | 13eb053 | 2021-02-15 14:13:51 +0900 | [diff] [blame] | 445 | hwaddress: false, |
| 446 | }, |
Inseob Kim | 7418252 | 2021-06-11 12:58:53 +0900 | [diff] [blame] | 447 | |
| 448 | // Install adb_debug.prop into debug ramdisk. |
| 449 | // This allows adb root on a user build, when debug ramdisk is used. |
| 450 | required: ["adb_debug.prop"], |
| 451 | |
| 452 | ramdisk: true, |
| 453 | |
| 454 | install_in_root: true, |
| 455 | } |
| 456 | |
Nikita Ioffe | 55dd325 | 2023-06-21 16:44:40 +0100 | [diff] [blame] | 457 | cc_binary { |
| 458 | name: "init_first_stage", |
| 459 | defaults: ["init_first_stage_defaults"], |
| 460 | } |
| 461 | |
| 462 | cc_binary { |
| 463 | name: "init_first_stage.microdroid", |
Nikita Ioffe | 2384e8a | 2024-03-12 15:34:11 +0000 | [diff] [blame^] | 464 | defaults: [ |
| 465 | "avf_build_flags_cc", |
| 466 | "init_first_stage_defaults" |
| 467 | ], |
Nikita Ioffe | a66adf4 | 2023-06-26 14:55:31 +0100 | [diff] [blame] | 468 | cflags: ["-DMICRODROID=1"], |
Nikita Ioffe | 55dd325 | 2023-06-21 16:44:40 +0100 | [diff] [blame] | 469 | installable: false, |
| 470 | } |
| 471 | |
Inseob Kim | 7418252 | 2021-06-11 12:58:53 +0900 | [diff] [blame] | 472 | phony { |
| 473 | name: "init_system", |
| 474 | required: ["init_second_stage"], |
Jiyong Park | 13eb053 | 2021-02-15 14:13:51 +0900 | [diff] [blame] | 475 | } |
| 476 | |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 477 | // Tests |
| 478 | // ------------------------------------------------------------------------------ |
| 479 | |
| 480 | cc_test { |
Jiyong Park | 75070b3 | 2024-01-30 10:17:37 +0900 | [diff] [blame] | 481 | // Note: This is NOT a CTS test. See b/320800872 |
Tom Cherry | 17b2be0 | 2019-08-20 10:43:48 -0700 | [diff] [blame] | 482 | name: "CtsInitTestCases", |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 483 | defaults: ["init_defaults"], |
Josh Gao | 6cad139 | 2019-08-27 16:02:38 -0700 | [diff] [blame] | 484 | require_root: true, |
| 485 | |
David Anderson | cbd082d | 2022-12-06 20:11:40 -0800 | [diff] [blame] | 486 | compile_multilib: "first", |
Tom Cherry | 17b2be0 | 2019-08-20 10:43:48 -0700 | [diff] [blame] | 487 | |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 488 | srcs: [ |
| 489 | "devices_test.cpp", |
David Anderson | 1de7384 | 2021-05-13 20:18:14 -0700 | [diff] [blame] | 490 | "epoll_test.cpp", |
Tom Cherry | dcb3d15 | 2019-08-07 16:02:28 -0700 | [diff] [blame] | 491 | "firmware_handler_test.cpp", |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 492 | "init_test.cpp", |
Bart Van Assche | 1693f42 | 2022-10-19 16:30:15 -0700 | [diff] [blame] | 493 | "interprocess_fifo_test.cpp", |
Mark Salyzyn | 75b901d | 2018-05-15 11:19:43 -0700 | [diff] [blame] | 494 | "keychords_test.cpp", |
Tom Cherry | bdbf504 | 2020-03-04 10:52:08 -0800 | [diff] [blame] | 495 | "oneshot_on_test.cpp", |
Tom Cherry | 16fad42 | 2017-08-04 15:59:03 -0700 | [diff] [blame] | 496 | "persistent_properties_test.cpp", |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 497 | "property_service_test.cpp", |
Tom Cherry | 927c5d5 | 2017-12-11 01:40:07 -0800 | [diff] [blame] | 498 | "property_type_test.cpp", |
Nikita Ioffe | 660ffde | 2020-12-10 16:52:35 +0000 | [diff] [blame] | 499 | "reboot_test.cpp", |
Tom Cherry | 7ac013d | 2017-08-25 10:39:25 -0700 | [diff] [blame] | 500 | "rlimit_parser_test.cpp", |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 501 | "service_test.cpp", |
Tom Cherry | cb0f9bb | 2017-09-12 15:58:47 -0700 | [diff] [blame] | 502 | "subcontext_test.cpp", |
Tom Cherry | 2a5a4e7 | 2018-06-26 13:56:34 -0700 | [diff] [blame] | 503 | "tokenizer_test.cpp", |
Tom Cherry | 5f0198b | 2018-07-17 15:28:16 -0700 | [diff] [blame] | 504 | "ueventd_parser_test.cpp", |
Tom Cherry | c2e181c | 2017-07-14 16:29:23 -0700 | [diff] [blame] | 505 | "ueventd_test.cpp", |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 506 | "util_test.cpp", |
| 507 | ], |
Bart Van Assche | 1693f42 | 2022-10-19 16:30:15 -0700 | [diff] [blame] | 508 | static_libs: [ |
| 509 | "libgmock", |
| 510 | "libinit", |
| 511 | ], |
Tom Cherry | 17b2be0 | 2019-08-20 10:43:48 -0700 | [diff] [blame] | 512 | |
| 513 | test_suites: [ |
Tom Cherry | 17b2be0 | 2019-08-20 10:43:48 -0700 | [diff] [blame] | 514 | "device-tests", |
Tom Cherry | 17b2be0 | 2019-08-20 10:43:48 -0700 | [diff] [blame] | 515 | ], |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 516 | } |
| 517 | |
Tom Cherry | cb0f9bb | 2017-09-12 15:58:47 -0700 | [diff] [blame] | 518 | cc_benchmark { |
| 519 | name: "init_benchmarks", |
| 520 | defaults: ["init_defaults"], |
| 521 | srcs: [ |
| 522 | "subcontext_benchmark.cpp", |
| 523 | ], |
Tom Cherry | 618d310 | 2018-01-19 14:25:48 -0800 | [diff] [blame] | 524 | static_libs: ["libinit"], |
Tom Cherry | cb0f9bb | 2017-09-12 15:58:47 -0700 | [diff] [blame] | 525 | } |
| 526 | |
Tom Cherry | a2f9136 | 2020-02-20 10:50:00 -0800 | [diff] [blame] | 527 | cc_defaults { |
| 528 | name: "libinit_test_utils_libraries_defaults", |
| 529 | shared_libs: [ |
| 530 | "libbase", |
| 531 | "libcutils", |
| 532 | "libselinux", |
Tom Cherry | a2f9136 | 2020-02-20 10:50:00 -0800 | [diff] [blame] | 533 | "liblog", |
| 534 | "libprocessgroup", |
| 535 | "libprotobuf-cpp-lite", |
| 536 | ], |
Steven Moreland | 973aade | 2023-03-15 19:39:15 +0000 | [diff] [blame] | 537 | static_libs: [ |
Yi-Yo Chiang | b8c2325 | 2023-07-25 22:08:55 +0800 | [diff] [blame] | 538 | "libfs_mgr", |
Steven Moreland | 973aade | 2023-03-15 19:39:15 +0000 | [diff] [blame] | 539 | "libhidl-gen-utils", |
| 540 | ], |
Tom Cherry | a2f9136 | 2020-02-20 10:50:00 -0800 | [diff] [blame] | 541 | } |
| 542 | |
| 543 | cc_library_static { |
| 544 | name: "libinit_test_utils", |
| 545 | defaults: ["libinit_test_utils_libraries_defaults"], |
| 546 | cflags: [ |
| 547 | "-Wall", |
| 548 | "-Wextra", |
| 549 | "-Wno-unused-parameter", |
| 550 | "-Werror", |
| 551 | ], |
| 552 | srcs: init_common_sources + [ |
| 553 | "test_utils/service_utils.cpp", |
| 554 | ], |
| 555 | whole_static_libs: [ |
| 556 | "libcap", |
| 557 | ], |
| 558 | export_include_dirs: ["test_utils/include"], // for tests |
Florian Mayer | d705c2d | 2022-09-12 18:19:47 -0700 | [diff] [blame] | 559 | header_libs: ["bionic_libc_platform_headers"], |
Tom Cherry | a2f9136 | 2020-02-20 10:50:00 -0800 | [diff] [blame] | 560 | } |
| 561 | |
Tom Cherry | de6bd50 | 2018-02-13 16:50:08 -0800 | [diff] [blame] | 562 | // Host Verifier |
| 563 | // ------------------------------------------------------------------------------ |
| 564 | |
| 565 | genrule { |
| 566 | name: "generated_stub_builtin_function_map", |
Tom Cherry | 4772f1d | 2019-07-30 09:34:41 -0700 | [diff] [blame] | 567 | tool_files: ["host_builtin_map.py"], |
Tom Cherry | de6bd50 | 2018-02-13 16:50:08 -0800 | [diff] [blame] | 568 | out: ["generated_stub_builtin_function_map.h"], |
Daniel Norman | d2533c3 | 2019-08-02 15:13:50 -0700 | [diff] [blame] | 569 | srcs: [ |
| 570 | "builtins.cpp", |
| 571 | "check_builtins.cpp", |
| 572 | ], |
Tom Cherry | 4772f1d | 2019-07-30 09:34:41 -0700 | [diff] [blame] | 573 | cmd: "$(location host_builtin_map.py) --builtins $(location builtins.cpp) --check_builtins $(location check_builtins.cpp) > $(out)", |
Tom Cherry | de6bd50 | 2018-02-13 16:50:08 -0800 | [diff] [blame] | 574 | } |
| 575 | |
Daniel Norman | f1200fb | 2022-03-09 10:49:26 -0800 | [diff] [blame] | 576 | cc_defaults { |
| 577 | name: "init_host_defaults", |
Tom Cherry | de6bd50 | 2018-02-13 16:50:08 -0800 | [diff] [blame] | 578 | host_supported: true, |
Tom Cherry | de6bd50 | 2018-02-13 16:50:08 -0800 | [diff] [blame] | 579 | cflags: [ |
| 580 | "-Wall", |
| 581 | "-Wextra", |
| 582 | "-Wno-unused-parameter", |
| 583 | "-Werror", |
| 584 | ], |
| 585 | static_libs: [ |
| 586 | "libbase", |
| 587 | "libselinux", |
Tom Cherry | b5f2ec0 | 2019-11-08 17:54:27 -0800 | [diff] [blame] | 588 | "libpropertyinfoserializer", |
| 589 | "libpropertyinfoparser", |
Tom Cherry | de6bd50 | 2018-02-13 16:50:08 -0800 | [diff] [blame] | 590 | ], |
| 591 | whole_static_libs: ["libcap"], |
| 592 | shared_libs: [ |
Tom Cherry | de6bd50 | 2018-02-13 16:50:08 -0800 | [diff] [blame] | 593 | "libcutils", |
Daniel Norman | 3f42a76 | 2019-07-09 11:00:53 -0700 | [diff] [blame] | 594 | "libhidl-gen-utils", |
Steven Moreland | 422a758 | 2019-10-15 14:53:19 -0700 | [diff] [blame] | 595 | "libhidlmetadata", |
Daniel Norman | 3f42a76 | 2019-07-09 11:00:53 -0700 | [diff] [blame] | 596 | "liblog", |
| 597 | "libprocessgroup", |
| 598 | "libprotobuf-cpp-lite", |
Tom Cherry | de6bd50 | 2018-02-13 16:50:08 -0800 | [diff] [blame] | 599 | ], |
Tom Cherry | de6bd50 | 2018-02-13 16:50:08 -0800 | [diff] [blame] | 600 | proto: { |
| 601 | type: "lite", |
| 602 | }, |
Yifan Hong | 3c4aa11 | 2018-06-20 22:49:48 +0000 | [diff] [blame] | 603 | generated_headers: [ |
| 604 | "generated_stub_builtin_function_map", |
Yifan Hong | 3c4aa11 | 2018-06-20 22:49:48 +0000 | [diff] [blame] | 605 | ], |
Tom Cherry | 96ff0fe | 2018-02-28 17:20:27 -0800 | [diff] [blame] | 606 | target: { |
Tom Cherry | 547f731 | 2018-02-28 21:40:46 -0800 | [diff] [blame] | 607 | android: { |
| 608 | enabled: false, |
| 609 | }, |
Tom Cherry | 96ff0fe | 2018-02-28 17:20:27 -0800 | [diff] [blame] | 610 | darwin: { |
Yifan Hong | 3c4aa11 | 2018-06-20 22:49:48 +0000 | [diff] [blame] | 611 | enabled: false, |
Tom Cherry | 96ff0fe | 2018-02-28 17:20:27 -0800 | [diff] [blame] | 612 | }, |
| 613 | }, |
Tom Cherry | de6bd50 | 2018-02-13 16:50:08 -0800 | [diff] [blame] | 614 | } |
Suren Baghdasaryan | 642048d | 2021-06-15 12:28:24 -0700 | [diff] [blame] | 615 | |
Daniel Norman | f1200fb | 2022-03-09 10:49:26 -0800 | [diff] [blame] | 616 | cc_binary { |
| 617 | name: "host_init_verifier", |
| 618 | defaults: ["init_host_defaults"], |
Jooyung Han | 39e8be4 | 2024-02-16 17:23:34 +0900 | [diff] [blame] | 619 | srcs: ["host_init_verifier.cpp"] + init_common_sources + init_host_sources, |
Jooyung Han | 18407b7 | 2024-02-24 09:16:35 +0900 | [diff] [blame] | 620 | generated_headers: [ |
| 621 | "generated_android_ids", |
| 622 | ], |
Daniel Norman | f1200fb | 2022-03-09 10:49:26 -0800 | [diff] [blame] | 623 | } |
| 624 | |
| 625 | cc_library_host_static { |
| 626 | name: "libinit_host", |
| 627 | defaults: ["init_host_defaults"], |
Jooyung Han | 39e8be4 | 2024-02-16 17:23:34 +0900 | [diff] [blame] | 628 | srcs: init_common_sources + init_host_sources, |
Daniel Norman | f1200fb | 2022-03-09 10:49:26 -0800 | [diff] [blame] | 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 Baghdasaryan | 642048d | 2021-06-15 12:28:24 -0700 | [diff] [blame] | 639 | sh_binary { |
Cole Faust | 7e279e9 | 2022-09-05 18:12:42 -0700 | [diff] [blame] | 640 | name: "extra_free_kbytes", |
Suren Baghdasaryan | 642048d | 2021-06-15 12:28:24 -0700 | [diff] [blame] | 641 | src: "extra_free_kbytes.sh", |
Cole Faust | 7e279e9 | 2022-09-05 18:12:42 -0700 | [diff] [blame] | 642 | filename_from_src: true, |
Suren Baghdasaryan | 642048d | 2021-06-15 12:28:24 -0700 | [diff] [blame] | 643 | } |