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", |
| 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 | ] |
| 55 | init_device_sources = [ |
David Anderson | 4117559 | 2020-03-20 19:38:28 -0700 | [diff] [blame] | 56 | "block_dev_initializer.cpp", |
Tom Cherry | 6619649 | 2020-02-06 11:56:58 -0800 | [diff] [blame] | 57 | "bootchart.cpp", |
| 58 | "builtins.cpp", |
| 59 | "devices.cpp", |
| 60 | "firmware_handler.cpp", |
Steve Muckle | a4bf2ce | 2019-11-01 13:58:02 -0700 | [diff] [blame] | 61 | "first_stage_console.cpp", |
Tom Cherry | 6619649 | 2020-02-06 11:56:58 -0800 | [diff] [blame] | 62 | "first_stage_init.cpp", |
| 63 | "first_stage_mount.cpp", |
| 64 | "fscrypt_init_extensions.cpp", |
| 65 | "init.cpp", |
| 66 | "lmkd_service.cpp", |
| 67 | "modalias_handler.cpp", |
| 68 | "mount_handler.cpp", |
| 69 | "mount_namespace.cpp", |
| 70 | "persistent_properties.cpp", |
| 71 | "persistent_properties.proto", |
| 72 | "property_service.cpp", |
| 73 | "property_service.proto", |
| 74 | "reboot.cpp", |
| 75 | "reboot_utils.cpp", |
| 76 | "security.cpp", |
| 77 | "selabel.cpp", |
| 78 | "selinux.cpp", |
| 79 | "sigchld_handler.cpp", |
David Anderson | 491e4da | 2020-12-08 00:21:20 -0800 | [diff] [blame] | 80 | "snapuserd_transition.cpp", |
Tom Cherry | 6619649 | 2020-02-06 11:56:58 -0800 | [diff] [blame] | 81 | "switch_root.cpp", |
| 82 | "uevent_listener.cpp", |
| 83 | "ueventd.cpp", |
| 84 | "ueventd_parser.cpp", |
| 85 | ] |
| 86 | init_host_sources = [ |
| 87 | "check_builtins.cpp", |
| 88 | "host_import_parser.cpp", |
| 89 | "host_init_verifier.cpp", |
| 90 | ] |
| 91 | |
Yi-Yo Chiang | bb77c54 | 2021-09-23 14:14:16 +0000 | [diff] [blame] | 92 | soong_config_module_type { |
| 93 | name: "libinit_cc_defaults", |
| 94 | module_type: "cc_defaults", |
| 95 | config_namespace: "ANDROID", |
| 96 | bool_variables: [ |
| 97 | "PRODUCT_INSTALL_DEBUG_POLICY_TO_SYSTEM_EXT", |
| 98 | ], |
| 99 | properties: [ |
| 100 | "cflags", |
| 101 | ], |
| 102 | } |
| 103 | |
| 104 | libinit_cc_defaults { |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 105 | name: "init_defaults", |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 106 | sanitize: { |
Tom Cherry | 2ffd65e | 2017-07-26 14:17:09 -0700 | [diff] [blame] | 107 | misc_undefined: ["signed-integer-overflow"], |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 108 | }, |
Chih-Hung Hsieh | 122352d | 2017-10-02 15:20:07 -0700 | [diff] [blame] | 109 | cflags: [ |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 110 | "-DLOG_UEVENTS=0", |
| 111 | "-Wall", |
| 112 | "-Wextra", |
| 113 | "-Wno-unused-parameter", |
| 114 | "-Werror", |
Tom Cherry | 802864c | 2020-03-12 14:29:25 -0700 | [diff] [blame] | 115 | "-Wthread-safety", |
Steve Muckle | d75f30a | 2019-05-21 15:50:39 -0700 | [diff] [blame] | 116 | "-DALLOW_FIRST_STAGE_CONSOLE=0", |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 117 | "-DALLOW_LOCAL_PROP_OVERRIDE=0", |
| 118 | "-DALLOW_PERMISSIVE_SELINUX=0", |
| 119 | "-DREBOOT_BOOTLOADER_ON_PANIC=0", |
| 120 | "-DWORLD_WRITABLE_KMSG=0", |
| 121 | "-DDUMP_ON_UMOUNT_FAILURE=0", |
| 122 | "-DSHUTDOWN_ZERO_TIMEOUT=0", |
Tom Cherry | a2f9136 | 2020-02-20 10:50:00 -0800 | [diff] [blame] | 123 | "-DINIT_FULL_SOURCES", |
Yi-Yo Chiang | bb77c54 | 2021-09-23 14:14:16 +0000 | [diff] [blame] | 124 | "-DINSTALL_DEBUG_POLICY_TO_SYSTEM_EXT=0", |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 125 | ], |
| 126 | product_variables: { |
| 127 | debuggable: { |
| 128 | cppflags: [ |
Steve Muckle | d75f30a | 2019-05-21 15:50:39 -0700 | [diff] [blame] | 129 | "-UALLOW_FIRST_STAGE_CONSOLE", |
| 130 | "-DALLOW_FIRST_STAGE_CONSOLE=1", |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 131 | "-UALLOW_LOCAL_PROP_OVERRIDE", |
| 132 | "-DALLOW_LOCAL_PROP_OVERRIDE=1", |
| 133 | "-UALLOW_PERMISSIVE_SELINUX", |
| 134 | "-DALLOW_PERMISSIVE_SELINUX=1", |
| 135 | "-UREBOOT_BOOTLOADER_ON_PANIC", |
| 136 | "-DREBOOT_BOOTLOADER_ON_PANIC=1", |
| 137 | "-UWORLD_WRITABLE_KMSG", |
| 138 | "-DWORLD_WRITABLE_KMSG=1", |
| 139 | "-UDUMP_ON_UMOUNT_FAILURE", |
| 140 | "-DDUMP_ON_UMOUNT_FAILURE=1", |
| 141 | ], |
| 142 | }, |
| 143 | eng: { |
| 144 | cppflags: [ |
| 145 | "-USHUTDOWN_ZERO_TIMEOUT", |
| 146 | "-DSHUTDOWN_ZERO_TIMEOUT=1", |
| 147 | ], |
| 148 | }, |
Dmitry Shmidt | c3bc509 | 2017-08-23 14:57:07 -0700 | [diff] [blame] | 149 | uml: { |
| 150 | cppflags: ["-DUSER_MODE_LINUX"], |
Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 151 | }, |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 152 | }, |
Yi-Yo Chiang | bb77c54 | 2021-09-23 14:14:16 +0000 | [diff] [blame] | 153 | soong_config_variables: { |
| 154 | PRODUCT_INSTALL_DEBUG_POLICY_TO_SYSTEM_EXT: { |
| 155 | cflags: [ |
| 156 | "-UINSTALL_DEBUG_POLICY_TO_SYSTEM_EXT", |
| 157 | "-DINSTALL_DEBUG_POLICY_TO_SYSTEM_EXT=1", |
| 158 | ], |
| 159 | }, |
| 160 | }, |
Tom Cherry | 618d310 | 2018-01-19 14:25:48 -0800 | [diff] [blame] | 161 | static_libs: [ |
Tom Cherry | 618d310 | 2018-01-19 14:25:48 -0800 | [diff] [blame] | 162 | "libavb", |
Bowgo Tsai | 30afda7 | 2019-04-11 23:57:24 +0800 | [diff] [blame] | 163 | "libc++fs", |
Yifan Hong | d8ce1fb | 2019-03-22 17:21:58 -0700 | [diff] [blame] | 164 | "libcgrouprc_format", |
Jeffrey Vander Stoep | baeece6 | 2022-02-08 12:42:33 +0000 | [diff] [blame] | 165 | "libfsverity_init", |
Suren Baghdasaryan | c29c2ba | 2019-10-22 17:18:42 -0700 | [diff] [blame] | 166 | "liblmkd_utils", |
Jeffrey Vander Stoep | baeece6 | 2022-02-08 12:42:33 +0000 | [diff] [blame] | 167 | "libmini_keyctl_static", |
Steve Muckle | 18b981e | 2019-04-15 17:43:02 -0700 | [diff] [blame] | 168 | "libmodprobe", |
David Anderson | 9fd8862 | 2021-03-05 14:10:55 -0800 | [diff] [blame] | 169 | "libprocinfo", |
Tom Cherry | 618d310 | 2018-01-19 14:25:48 -0800 | [diff] [blame] | 170 | "libprotobuf-cpp-lite", |
| 171 | "libpropertyinfoserializer", |
| 172 | "libpropertyinfoparser", |
Jeffrey Vander Stoep | baeece6 | 2022-02-08 12:42:33 +0000 | [diff] [blame] | 173 | "libsigningutils", |
David Anderson | aca0bea | 2020-09-21 16:34:25 -0700 | [diff] [blame] | 174 | "libsnapshot_cow", |
David Anderson | dfe6d07 | 2019-10-09 16:24:03 -0700 | [diff] [blame] | 175 | "libsnapshot_init", |
Jooyung Han | 1d951b7 | 2020-07-05 03:33:36 +0900 | [diff] [blame] | 176 | "libxml2", |
Jiyong Park | 648ae3a | 2019-12-08 00:25:15 +0900 | [diff] [blame] | 177 | "lib_apex_manifest_proto_lite", |
Yifan Hong | 66f0115 | 2020-04-16 11:05:16 -0700 | [diff] [blame] | 178 | "update_metadata-protos", |
Jiyong Park | 787322c | 2018-06-01 19:26:42 +0900 | [diff] [blame] | 179 | ], |
| 180 | shared_libs: [ |
Tom Cherry | 59656fb | 2019-05-28 10:19:44 -0700 | [diff] [blame] | 181 | "libbacktrace", |
Jiyong Park | 787322c | 2018-06-01 19:26:42 +0900 | [diff] [blame] | 182 | "libbase", |
Tao Bao | 66209ca | 2018-07-25 22:35:45 -0700 | [diff] [blame] | 183 | "libbootloader_message", |
Jeffrey Vander Stoep | baeece6 | 2022-02-08 12:42:33 +0000 | [diff] [blame] | 184 | "libcrypto", |
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", |
| 191 | "libkeyutils", |
| 192 | "liblog", |
| 193 | "liblogwrap", |
Tom Cherry | 7bfea3d | 2018-11-06 14:12:05 -0800 | [diff] [blame] | 194 | "liblp", |
Suren Baghdasaryan | 82b72a5 | 2018-12-21 11:41:50 -0800 | [diff] [blame] | 195 | "libprocessgroup", |
Yifan Hong | 6f9ce2e | 2019-03-05 15:47:16 -0800 | [diff] [blame] | 196 | "libprocessgroup_setup", |
Jiyong Park | 012171d | 2018-06-19 16:55:05 +0900 | [diff] [blame] | 197 | "libselinux", |
Martijn Coenen | 62e985a | 2018-09-04 06:29:14 +0200 | [diff] [blame] | 198 | "libutils", |
Jeffrey Vander Stoep | baeece6 | 2022-02-08 12:42:33 +0000 | [diff] [blame] | 199 | "libziparchive", |
Tom Cherry | 618d310 | 2018-01-19 14:25:48 -0800 | [diff] [blame] | 200 | ], |
Jiyong Park | 93318d4 | 2018-12-26 17:34:39 +0900 | [diff] [blame] | 201 | bootstrap: true, |
Daniel Norman | 8082ba2 | 2019-07-23 10:26:15 -0700 | [diff] [blame] | 202 | visibility: [":__subpackages__"], |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 203 | } |
| 204 | |
| 205 | cc_library_static { |
| 206 | name: "libinit", |
Tom Cherry | 3143848 | 2018-07-20 14:57:00 -0700 | [diff] [blame] | 207 | recovery_available: true, |
Daniel Norman | 8082ba2 | 2019-07-23 10:26:15 -0700 | [diff] [blame] | 208 | defaults: [ |
| 209 | "init_defaults", |
| 210 | "selinux_policy_version", |
| 211 | ], |
Tom Cherry | 6619649 | 2020-02-06 11:56:58 -0800 | [diff] [blame] | 212 | srcs: init_common_sources + init_device_sources, |
Jooyung Han | 1d951b7 | 2020-07-05 03:33:36 +0900 | [diff] [blame] | 213 | generated_sources: [ |
| 214 | "apex-info-list", |
| 215 | ], |
Daniel Norman | 8082ba2 | 2019-07-23 10:26:15 -0700 | [diff] [blame] | 216 | whole_static_libs: [ |
| 217 | "libcap", |
| 218 | "com.android.sysprop.apex", |
Nikita Ioffe | 23dbd6d | 2019-11-14 01:21:24 +0000 | [diff] [blame] | 219 | "com.android.sysprop.init", |
Daniel Norman | 8082ba2 | 2019-07-23 10:26:15 -0700 | [diff] [blame] | 220 | ], |
Jayant Chowdhary | 478c7c1 | 2018-03-28 18:45:35 -0700 | [diff] [blame] | 221 | header_libs: ["bootimg_headers"], |
Tom Cherry | a97faba | 2017-09-15 15:44:04 -0700 | [diff] [blame] | 222 | proto: { |
| 223 | type: "lite", |
| 224 | export_proto_headers: true, |
| 225 | }, |
Martijn Coenen | 62e985a | 2018-09-04 06:29:14 +0200 | [diff] [blame] | 226 | |
| 227 | target: { |
| 228 | recovery: { |
| 229 | cflags: ["-DRECOVERY"], |
Jooyung Han | 1d951b7 | 2020-07-05 03:33:36 +0900 | [diff] [blame] | 230 | exclude_static_libs: [ |
| 231 | "libxml2", |
| 232 | ], |
| 233 | exclude_generated_sources: [ |
| 234 | "apex-info-list", |
| 235 | ], |
Daniel Norman | 8082ba2 | 2019-07-23 10:26:15 -0700 | [diff] [blame] | 236 | exclude_shared_libs: [ |
| 237 | "libbinder", |
| 238 | "libutils", |
| 239 | ], |
Martijn Coenen | 62e985a | 2018-09-04 06:29:14 +0200 | [diff] [blame] | 240 | }, |
| 241 | }, |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 242 | } |
| 243 | |
Steven Moreland | ceb36d0 | 2019-07-15 15:12:56 -0700 | [diff] [blame] | 244 | phony { |
| 245 | name: "init", |
| 246 | required: [ |
| 247 | "init_second_stage", |
| 248 | ], |
| 249 | } |
| 250 | |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 251 | cc_binary { |
Tom Cherry | 3143848 | 2018-07-20 14:57:00 -0700 | [diff] [blame] | 252 | name: "init_second_stage", |
| 253 | recovery_available: true, |
| 254 | stem: "init", |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 255 | defaults: ["init_defaults"], |
Tom Cherry | 3143848 | 2018-07-20 14:57:00 -0700 | [diff] [blame] | 256 | static_libs: ["libinit"], |
Tom Cherry | 618d310 | 2018-01-19 14:25:48 -0800 | [diff] [blame] | 257 | srcs: ["main.cpp"], |
Tom Cherry | 3143848 | 2018-07-20 14:57:00 -0700 | [diff] [blame] | 258 | symlinks: ["ueventd"], |
Martijn Coenen | 62e985a | 2018-09-04 06:29:14 +0200 | [diff] [blame] | 259 | target: { |
Yi-Yo Chiang | 9ba6a5b | 2021-07-24 22:50:17 +0800 | [diff] [blame] | 260 | platform: { |
| 261 | required: [ |
| 262 | "init.rc", |
| 263 | "ueventd.rc", |
| 264 | "e2fsdroid", |
Suren Baghdasaryan | 642048d | 2021-06-15 12:28:24 -0700 | [diff] [blame] | 265 | "extra_free_kbytes.sh", |
Yi-Yo Chiang | 9ba6a5b | 2021-07-24 22:50:17 +0800 | [diff] [blame] | 266 | "make_f2fs", |
| 267 | "mke2fs", |
| 268 | "sload_f2fs", |
| 269 | ], |
| 270 | }, |
Martijn Coenen | 62e985a | 2018-09-04 06:29:14 +0200 | [diff] [blame] | 271 | recovery: { |
| 272 | cflags: ["-DRECOVERY"], |
Jooyung Han | 1d951b7 | 2020-07-05 03:33:36 +0900 | [diff] [blame] | 273 | exclude_static_libs: [ |
| 274 | "libxml2", |
| 275 | ], |
Daniel Norman | 8082ba2 | 2019-07-23 10:26:15 -0700 | [diff] [blame] | 276 | exclude_shared_libs: [ |
| 277 | "libbinder", |
| 278 | "libutils", |
| 279 | ], |
Yi-Yo Chiang | 9ba6a5b | 2021-07-24 22:50:17 +0800 | [diff] [blame] | 280 | required: [ |
| 281 | "init_recovery.rc", |
| 282 | "ueventd.rc.recovery", |
| 283 | "e2fsdroid.recovery", |
| 284 | "make_f2fs.recovery", |
| 285 | "mke2fs.recovery", |
| 286 | "sload_f2fs.recovery", |
| 287 | ], |
Martijn Coenen | 62e985a | 2018-09-04 06:29:14 +0200 | [diff] [blame] | 288 | }, |
| 289 | }, |
Jiyong Park | 9035378 | 2021-01-25 18:41:40 +0900 | [diff] [blame] | 290 | visibility: ["//packages/modules/Virtualization/microdroid"], |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 291 | } |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 292 | |
Inseob Kim | 7418252 | 2021-06-11 12:58:53 +0900 | [diff] [blame] | 293 | soong_config_module_type { |
| 294 | name: "init_first_stage_cc_defaults", |
| 295 | module_type: "cc_defaults", |
| 296 | config_namespace: "ANDROID", |
Bowgo Tsai | ab079af | 2021-07-14 15:39:53 +0800 | [diff] [blame] | 297 | bool_variables: ["BOARD_BUILD_SYSTEM_ROOT_IMAGE", "BOARD_USES_RECOVERY_AS_BOOT"], |
Inseob Kim | 7418252 | 2021-06-11 12:58:53 +0900 | [diff] [blame] | 298 | properties: ["installable"], |
| 299 | } |
| 300 | |
| 301 | // Do not install init_first_stage even with mma if we're system-as-root. |
| 302 | // Otherwise, it will overwrite the symlink. |
| 303 | init_first_stage_cc_defaults { |
| 304 | name: "init_first_stage_defaults", |
| 305 | soong_config_variables: { |
| 306 | BOARD_BUILD_SYSTEM_ROOT_IMAGE: { |
| 307 | installable: false, |
| 308 | }, |
Bowgo Tsai | ab079af | 2021-07-14 15:39:53 +0800 | [diff] [blame] | 309 | BOARD_USES_RECOVERY_AS_BOOT: { |
| 310 | installable: false, |
| 311 | }, |
Inseob Kim | 7418252 | 2021-06-11 12:58:53 +0900 | [diff] [blame] | 312 | }, |
| 313 | } |
| 314 | |
Jiyong Park | 13eb053 | 2021-02-15 14:13:51 +0900 | [diff] [blame] | 315 | cc_binary { |
Inseob Kim | 7418252 | 2021-06-11 12:58:53 +0900 | [diff] [blame] | 316 | name: "init_first_stage", |
| 317 | stem: "init", |
| 318 | defaults: ["init_first_stage_defaults"], |
Jiyong Park | 13eb053 | 2021-02-15 14:13:51 +0900 | [diff] [blame] | 319 | |
| 320 | srcs: [ |
| 321 | "block_dev_initializer.cpp", |
| 322 | "devices.cpp", |
| 323 | "first_stage_console.cpp", |
| 324 | "first_stage_init.cpp", |
| 325 | "first_stage_main.cpp", |
| 326 | "first_stage_mount.cpp", |
| 327 | "reboot_utils.cpp", |
| 328 | "selabel.cpp", |
Jiyong Park | 13eb053 | 2021-02-15 14:13:51 +0900 | [diff] [blame] | 329 | "service_utils.cpp", |
| 330 | "snapuserd_transition.cpp", |
| 331 | "switch_root.cpp", |
| 332 | "uevent_listener.cpp", |
| 333 | "util.cpp", |
| 334 | ], |
| 335 | |
| 336 | static_libs: [ |
| 337 | "libc++fs", |
| 338 | "libfs_avb", |
| 339 | "libfs_mgr", |
| 340 | "libfec", |
| 341 | "libfec_rs", |
| 342 | "libsquashfs_utils", |
Jiyong Park | 13eb053 | 2021-02-15 14:13:51 +0900 | [diff] [blame] | 343 | "libcrypto_utils", |
Jiyong Park | 13eb053 | 2021-02-15 14:13:51 +0900 | [diff] [blame] | 344 | "libavb", |
Jiyong Park | 13eb053 | 2021-02-15 14:13:51 +0900 | [diff] [blame] | 345 | "liblp", |
| 346 | "libcutils", |
| 347 | "libbase", |
| 348 | "liblog", |
| 349 | "libcrypto_static", |
Jiyong Park | 13eb053 | 2021-02-15 14:13:51 +0900 | [diff] [blame] | 350 | "libselinux", |
| 351 | "libcap", |
| 352 | "libgsi", |
Jiyong Park | 13eb053 | 2021-02-15 14:13:51 +0900 | [diff] [blame] | 353 | "liblzma", |
| 354 | "libunwindstack_no_dex", |
| 355 | "libbacktrace_no_dex", |
| 356 | "libmodprobe", |
| 357 | "libext2_uuid", |
| 358 | "libprotobuf-cpp-lite", |
| 359 | "libsnapshot_cow", |
| 360 | "libsnapshot_init", |
| 361 | "update_metadata-protos", |
David Anderson | 9fd8862 | 2021-03-05 14:10:55 -0800 | [diff] [blame] | 362 | "libprocinfo", |
Jiyong Park | 13eb053 | 2021-02-15 14:13:51 +0900 | [diff] [blame] | 363 | ], |
| 364 | |
| 365 | static_executable: true, |
Inseob Kim | 7418252 | 2021-06-11 12:58:53 +0900 | [diff] [blame] | 366 | system_shared_libs: [], |
Jiyong Park | 13eb053 | 2021-02-15 14:13:51 +0900 | [diff] [blame] | 367 | |
| 368 | cflags: [ |
| 369 | "-Wall", |
| 370 | "-Wextra", |
| 371 | "-Wno-unused-parameter", |
| 372 | "-Werror", |
| 373 | "-DALLOW_FIRST_STAGE_CONSOLE=0", |
| 374 | "-DALLOW_LOCAL_PROP_OVERRIDE=0", |
| 375 | "-DALLOW_PERMISSIVE_SELINUX=0", |
| 376 | "-DREBOOT_BOOTLOADER_ON_PANIC=0", |
| 377 | "-DWORLD_WRITABLE_KMSG=0", |
| 378 | "-DDUMP_ON_UMOUNT_FAILURE=0", |
| 379 | "-DSHUTDOWN_ZERO_TIMEOUT=0", |
| 380 | "-DLOG_UEVENTS=0", |
| 381 | "-DSEPOLICY_VERSION=30", // TODO(jiyong): externalize the version number |
| 382 | ], |
| 383 | |
| 384 | product_variables: { |
| 385 | debuggable: { |
| 386 | cflags: [ |
| 387 | "-UALLOW_FIRST_STAGE_CONSOLE", |
| 388 | "-DALLOW_FIRST_STAGE_CONSOLE=1", |
| 389 | |
| 390 | "-UALLOW_LOCAL_PROP_OVERRIDE", |
| 391 | "-DALLOW_LOCAL_PROP_OVERRIDE=1", |
| 392 | |
| 393 | "-UALLOW_PERMISSIVE_SELINUX", |
| 394 | "-DALLOW_PERMISSIVE_SELINUX=1", |
| 395 | |
| 396 | "-UREBOOT_BOOTLOADER_ON_PANIC", |
| 397 | "-DREBOOT_BOOTLOADER_ON_PANIC=1", |
| 398 | |
| 399 | "-UWORLD_WRITABLE_KMSG", |
| 400 | "-DWORLD_WRITABLE_KMSG=1", |
| 401 | |
| 402 | "-UDUMP_ON_UMOUNT_FAILURE", |
| 403 | "-DDUMP_ON_UMOUNT_FAILURE=1", |
| 404 | ], |
| 405 | }, |
| 406 | |
| 407 | eng: { |
| 408 | cflags: [ |
| 409 | "-USHUTDOWN_ZERO_TIMEOUT", |
| 410 | "-DSHUTDOWN_ZERO_TIMEOUT=1", |
| 411 | ], |
| 412 | }, |
| 413 | }, |
| 414 | |
| 415 | sanitize: { |
| 416 | misc_undefined: ["signed-integer-overflow"], |
Inseob Kim | 7418252 | 2021-06-11 12:58:53 +0900 | [diff] [blame] | 417 | |
| 418 | // 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] | 419 | hwaddress: false, |
| 420 | }, |
Inseob Kim | 7418252 | 2021-06-11 12:58:53 +0900 | [diff] [blame] | 421 | |
| 422 | // Install adb_debug.prop into debug ramdisk. |
| 423 | // This allows adb root on a user build, when debug ramdisk is used. |
| 424 | required: ["adb_debug.prop"], |
| 425 | |
| 426 | ramdisk: true, |
| 427 | |
| 428 | install_in_root: true, |
| 429 | } |
| 430 | |
| 431 | phony { |
| 432 | name: "init_system", |
| 433 | required: ["init_second_stage"], |
Jiyong Park | 13eb053 | 2021-02-15 14:13:51 +0900 | [diff] [blame] | 434 | } |
| 435 | |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 436 | // Tests |
| 437 | // ------------------------------------------------------------------------------ |
| 438 | |
| 439 | cc_test { |
Tom Cherry | 17b2be0 | 2019-08-20 10:43:48 -0700 | [diff] [blame] | 440 | name: "CtsInitTestCases", |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 441 | defaults: ["init_defaults"], |
Josh Gao | 6cad139 | 2019-08-27 16:02:38 -0700 | [diff] [blame] | 442 | require_root: true, |
| 443 | |
Tom Cherry | 17b2be0 | 2019-08-20 10:43:48 -0700 | [diff] [blame] | 444 | compile_multilib: "both", |
| 445 | multilib: { |
| 446 | lib32: { |
| 447 | suffix: "32", |
| 448 | }, |
| 449 | lib64: { |
| 450 | suffix: "64", |
| 451 | }, |
| 452 | }, |
| 453 | |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 454 | srcs: [ |
| 455 | "devices_test.cpp", |
David Anderson | 1de7384 | 2021-05-13 20:18:14 -0700 | [diff] [blame] | 456 | "epoll_test.cpp", |
Tom Cherry | dcb3d15 | 2019-08-07 16:02:28 -0700 | [diff] [blame] | 457 | "firmware_handler_test.cpp", |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 458 | "init_test.cpp", |
Mark Salyzyn | 75b901d | 2018-05-15 11:19:43 -0700 | [diff] [blame] | 459 | "keychords_test.cpp", |
Tom Cherry | bdbf504 | 2020-03-04 10:52:08 -0800 | [diff] [blame] | 460 | "oneshot_on_test.cpp", |
Tom Cherry | 16fad42 | 2017-08-04 15:59:03 -0700 | [diff] [blame] | 461 | "persistent_properties_test.cpp", |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 462 | "property_service_test.cpp", |
Tom Cherry | 927c5d5 | 2017-12-11 01:40:07 -0800 | [diff] [blame] | 463 | "property_type_test.cpp", |
Nikita Ioffe | 660ffde | 2020-12-10 16:52:35 +0000 | [diff] [blame] | 464 | "reboot_test.cpp", |
Tom Cherry | 7ac013d | 2017-08-25 10:39:25 -0700 | [diff] [blame] | 465 | "rlimit_parser_test.cpp", |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 466 | "service_test.cpp", |
Tom Cherry | cb0f9bb | 2017-09-12 15:58:47 -0700 | [diff] [blame] | 467 | "subcontext_test.cpp", |
Tom Cherry | 2a5a4e7 | 2018-06-26 13:56:34 -0700 | [diff] [blame] | 468 | "tokenizer_test.cpp", |
Tom Cherry | 5f0198b | 2018-07-17 15:28:16 -0700 | [diff] [blame] | 469 | "ueventd_parser_test.cpp", |
Tom Cherry | c2e181c | 2017-07-14 16:29:23 -0700 | [diff] [blame] | 470 | "ueventd_test.cpp", |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 471 | "util_test.cpp", |
| 472 | ], |
Tom Cherry | 618d310 | 2018-01-19 14:25:48 -0800 | [diff] [blame] | 473 | static_libs: ["libinit"], |
Tom Cherry | 17b2be0 | 2019-08-20 10:43:48 -0700 | [diff] [blame] | 474 | |
| 475 | test_suites: [ |
| 476 | "cts", |
| 477 | "device-tests", |
Tom Cherry | 17b2be0 | 2019-08-20 10:43:48 -0700 | [diff] [blame] | 478 | ], |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 479 | } |
| 480 | |
Tom Cherry | cb0f9bb | 2017-09-12 15:58:47 -0700 | [diff] [blame] | 481 | cc_benchmark { |
| 482 | name: "init_benchmarks", |
| 483 | defaults: ["init_defaults"], |
| 484 | srcs: [ |
| 485 | "subcontext_benchmark.cpp", |
| 486 | ], |
Tom Cherry | 618d310 | 2018-01-19 14:25:48 -0800 | [diff] [blame] | 487 | static_libs: ["libinit"], |
Tom Cherry | cb0f9bb | 2017-09-12 15:58:47 -0700 | [diff] [blame] | 488 | } |
| 489 | |
Tom Cherry | a2f9136 | 2020-02-20 10:50:00 -0800 | [diff] [blame] | 490 | cc_defaults { |
| 491 | name: "libinit_test_utils_libraries_defaults", |
| 492 | shared_libs: [ |
| 493 | "libbase", |
| 494 | "libcutils", |
| 495 | "libselinux", |
| 496 | "libhidl-gen-utils", |
| 497 | "liblog", |
| 498 | "libprocessgroup", |
| 499 | "libprotobuf-cpp-lite", |
| 500 | ], |
| 501 | } |
| 502 | |
| 503 | cc_library_static { |
| 504 | name: "libinit_test_utils", |
| 505 | defaults: ["libinit_test_utils_libraries_defaults"], |
| 506 | cflags: [ |
| 507 | "-Wall", |
| 508 | "-Wextra", |
| 509 | "-Wno-unused-parameter", |
| 510 | "-Werror", |
| 511 | ], |
| 512 | srcs: init_common_sources + [ |
| 513 | "test_utils/service_utils.cpp", |
| 514 | ], |
| 515 | whole_static_libs: [ |
| 516 | "libcap", |
| 517 | ], |
| 518 | export_include_dirs: ["test_utils/include"], // for tests |
| 519 | } |
| 520 | |
Tom Cherry | de6bd50 | 2018-02-13 16:50:08 -0800 | [diff] [blame] | 521 | // Host Verifier |
| 522 | // ------------------------------------------------------------------------------ |
| 523 | |
| 524 | genrule { |
| 525 | name: "generated_stub_builtin_function_map", |
Tom Cherry | 4772f1d | 2019-07-30 09:34:41 -0700 | [diff] [blame] | 526 | tool_files: ["host_builtin_map.py"], |
Tom Cherry | de6bd50 | 2018-02-13 16:50:08 -0800 | [diff] [blame] | 527 | out: ["generated_stub_builtin_function_map.h"], |
Daniel Norman | d2533c3 | 2019-08-02 15:13:50 -0700 | [diff] [blame] | 528 | srcs: [ |
| 529 | "builtins.cpp", |
| 530 | "check_builtins.cpp", |
| 531 | ], |
Tom Cherry | 4772f1d | 2019-07-30 09:34:41 -0700 | [diff] [blame] | 532 | 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] | 533 | } |
| 534 | |
Daniel Norman | f1200fb | 2022-03-09 10:49:26 -0800 | [diff] [blame] | 535 | cc_defaults { |
| 536 | name: "init_host_defaults", |
Tom Cherry | de6bd50 | 2018-02-13 16:50:08 -0800 | [diff] [blame] | 537 | host_supported: true, |
Tom Cherry | de6bd50 | 2018-02-13 16:50:08 -0800 | [diff] [blame] | 538 | cflags: [ |
| 539 | "-Wall", |
| 540 | "-Wextra", |
| 541 | "-Wno-unused-parameter", |
| 542 | "-Werror", |
| 543 | ], |
| 544 | static_libs: [ |
| 545 | "libbase", |
| 546 | "libselinux", |
Tom Cherry | b5f2ec0 | 2019-11-08 17:54:27 -0800 | [diff] [blame] | 547 | "libpropertyinfoserializer", |
| 548 | "libpropertyinfoparser", |
Tom Cherry | de6bd50 | 2018-02-13 16:50:08 -0800 | [diff] [blame] | 549 | ], |
| 550 | whole_static_libs: ["libcap"], |
| 551 | shared_libs: [ |
Tom Cherry | de6bd50 | 2018-02-13 16:50:08 -0800 | [diff] [blame] | 552 | "libcutils", |
Daniel Norman | 3f42a76 | 2019-07-09 11:00:53 -0700 | [diff] [blame] | 553 | "libhidl-gen-utils", |
Steven Moreland | 422a758 | 2019-10-15 14:53:19 -0700 | [diff] [blame] | 554 | "libhidlmetadata", |
Daniel Norman | 3f42a76 | 2019-07-09 11:00:53 -0700 | [diff] [blame] | 555 | "liblog", |
| 556 | "libprocessgroup", |
| 557 | "libprotobuf-cpp-lite", |
Tom Cherry | de6bd50 | 2018-02-13 16:50:08 -0800 | [diff] [blame] | 558 | ], |
Tom Cherry | de6bd50 | 2018-02-13 16:50:08 -0800 | [diff] [blame] | 559 | proto: { |
| 560 | type: "lite", |
| 561 | }, |
Yifan Hong | 3c4aa11 | 2018-06-20 22:49:48 +0000 | [diff] [blame] | 562 | generated_headers: [ |
| 563 | "generated_stub_builtin_function_map", |
Daniel Norman | 8082ba2 | 2019-07-23 10:26:15 -0700 | [diff] [blame] | 564 | "generated_android_ids", |
Yifan Hong | 3c4aa11 | 2018-06-20 22:49:48 +0000 | [diff] [blame] | 565 | ], |
Tom Cherry | 96ff0fe | 2018-02-28 17:20:27 -0800 | [diff] [blame] | 566 | target: { |
Tom Cherry | 547f731 | 2018-02-28 21:40:46 -0800 | [diff] [blame] | 567 | android: { |
| 568 | enabled: false, |
| 569 | }, |
Tom Cherry | 96ff0fe | 2018-02-28 17:20:27 -0800 | [diff] [blame] | 570 | darwin: { |
Yifan Hong | 3c4aa11 | 2018-06-20 22:49:48 +0000 | [diff] [blame] | 571 | enabled: false, |
Tom Cherry | 96ff0fe | 2018-02-28 17:20:27 -0800 | [diff] [blame] | 572 | }, |
| 573 | }, |
Tom Cherry | de6bd50 | 2018-02-13 16:50:08 -0800 | [diff] [blame] | 574 | } |
Suren Baghdasaryan | 642048d | 2021-06-15 12:28:24 -0700 | [diff] [blame] | 575 | |
Daniel Norman | f1200fb | 2022-03-09 10:49:26 -0800 | [diff] [blame] | 576 | cc_binary { |
| 577 | name: "host_init_verifier", |
| 578 | defaults: ["init_host_defaults"], |
| 579 | srcs: init_common_sources + init_host_sources, |
| 580 | } |
| 581 | |
| 582 | cc_library_host_static { |
| 583 | name: "libinit_host", |
| 584 | defaults: ["init_host_defaults"], |
| 585 | srcs: init_common_sources, |
| 586 | export_include_dirs: ["."], |
| 587 | proto: { |
| 588 | export_proto_headers: true, |
| 589 | }, |
| 590 | visibility: [ |
| 591 | // host_apex_verifier performs a subset of init.rc validation |
| 592 | "//system/apex/tools", |
| 593 | ], |
| 594 | } |
| 595 | |
Suren Baghdasaryan | 642048d | 2021-06-15 12:28:24 -0700 | [diff] [blame] | 596 | sh_binary { |
| 597 | name: "extra_free_kbytes.sh", |
| 598 | src: "extra_free_kbytes.sh", |
| 599 | } |