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