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