Bob Badour | 2efc476 | 2021-02-03 18:36:27 -0800 | [diff] [blame] | 1 | package { |
| 2 | default_applicable_licenses: ["Android-Apache-2.0"], |
| 3 | } |
| 4 | |
Victor Hsieh | 384bf6a | 2021-11-11 13:28:09 -0800 | [diff] [blame] | 5 | microdroid_filesystem_images = [ |
Andrew Scull | d6267ae | 2022-06-13 13:47:59 +0000 | [diff] [blame] | 6 | "microdroid_super", |
Victor Hsieh | 384bf6a | 2021-11-11 13:28:09 -0800 | [diff] [blame] | 7 | "microdroid_vbmeta", |
Victor Hsieh | 384bf6a | 2021-11-11 13:28:09 -0800 | [diff] [blame] | 8 | ] |
| 9 | |
Nikita Ioffe | 50e2ebe | 2022-10-24 17:16:25 +0100 | [diff] [blame] | 10 | soong_config_module_type { |
| 11 | name: "virt_apex", |
| 12 | module_type: "apex", |
| 13 | config_namespace: "ANDROID", |
Nikita Ioffe | adb3393 | 2023-06-07 14:33:56 +0100 | [diff] [blame] | 14 | bool_variables: [ |
| 15 | "avf_enabled", |
Nikita Ioffe | adb3393 | 2023-06-07 14:33:56 +0100 | [diff] [blame] | 16 | ], |
| 17 | properties: [ |
| 18 | "defaults", |
| 19 | "prebuilts", |
| 20 | ], |
Nikita Ioffe | 50e2ebe | 2022-10-24 17:16:25 +0100 | [diff] [blame] | 21 | } |
Jiyong Park | da119cb | 2020-12-07 15:58:23 +0900 | [diff] [blame] | 22 | |
Nikita Ioffe | 50e2ebe | 2022-10-24 17:16:25 +0100 | [diff] [blame] | 23 | virt_apex { |
| 24 | name: "com.android.virt", |
| 25 | soong_config_variables: { |
| 26 | avf_enabled: { |
| 27 | defaults: ["com.android.virt_avf_enabled"], |
| 28 | conditions_default: { |
| 29 | defaults: ["com.android.virt_avf_disabled"], |
| 30 | }, |
| 31 | }, |
| 32 | }, |
| 33 | } |
| 34 | |
| 35 | apex_defaults { |
| 36 | name: "com.android.virt_common", |
Jiyong Park | da119cb | 2020-12-07 15:58:23 +0900 | [diff] [blame] | 37 | // TODO(jiyong): make it updatable |
Mathew Inwood | 9af36dd | 2021-02-16 14:43:40 +0000 | [diff] [blame] | 38 | updatable: false, |
Nikita Ioffe | c0b0961 | 2023-01-27 01:49:39 +0000 | [diff] [blame] | 39 | future_updatable: false, |
Jiyong Park | b6c45e7 | 2021-06-22 20:24:56 +0900 | [diff] [blame] | 40 | platform_apis: true, |
Jiyong Park | da119cb | 2020-12-07 15:58:23 +0900 | [diff] [blame] | 41 | |
| 42 | manifest: "manifest.json", |
| 43 | |
| 44 | key: "com.android.virt.key", |
| 45 | certificate: ":com.android.virt.certificate", |
Nikita Ioffe | 50e2ebe | 2022-10-24 17:16:25 +0100 | [diff] [blame] | 46 | |
| 47 | apps: [ |
| 48 | "android.system.virtualmachine.res", |
| 49 | ], |
| 50 | |
| 51 | file_contexts: ":com.android.virt-file_contexts", |
| 52 | canned_fs_config: "canned_fs_config", |
Nikita Ioffe | f28eec2 | 2022-10-18 23:17:34 +0100 | [diff] [blame] | 53 | |
| 54 | bootclasspath_fragments: [ |
| 55 | "com.android.virt-bootclasspath-fragment", |
| 56 | ], |
Nikita Ioffe | b78c620 | 2022-11-18 17:01:36 +0000 | [diff] [blame] | 57 | jni_libs: [ |
David Brazdil | 7958839 | 2022-10-20 17:04:46 +0100 | [diff] [blame] | 58 | "libvirtualizationservice_jni", |
Nikita Ioffe | b78c620 | 2022-11-18 17:01:36 +0000 | [diff] [blame] | 59 | "libvirtualmachine_jni", |
| 60 | ], |
Jooyung Han | 3b980eb | 2023-11-03 14:48:00 +0900 | [diff] [blame] | 61 | // TODO(b/295593640) Unfortunately these are added to the apex even though they are unused. |
| 62 | // Once the build system is fixed, remove this. |
| 63 | unwanted_transitive_deps: [ |
| 64 | "libdrm", |
| 65 | "libsso", |
| 66 | "libutils", |
| 67 | ], |
Nikita Ioffe | 50e2ebe | 2022-10-24 17:16:25 +0100 | [diff] [blame] | 68 | } |
| 69 | |
Inseob Kim | 77c7f71 | 2023-11-06 17:01:02 +0900 | [diff] [blame] | 70 | soong_config_module_type { |
| 71 | name: "avf_flag_aware_apex_defaults", |
| 72 | module_type: "apex_defaults", |
| 73 | config_namespace: "ANDROID", |
Nikita Ioffe | 94a8a18 | 2023-11-16 16:37:48 +0000 | [diff] [blame] | 74 | bool_variables: [ |
| 75 | "release_avf_enable_device_assignment", |
Alice Wang | b5b9032 | 2023-11-14 07:38:18 +0000 | [diff] [blame] | 76 | "release_avf_enable_remote_attestation", |
Nikita Ioffe | 94a8a18 | 2023-11-16 16:37:48 +0000 | [diff] [blame] | 77 | "release_avf_enable_vendor_modules", |
| 78 | ], |
| 79 | properties: [ |
| 80 | "arch", |
| 81 | "prebuilts", |
Alice Wang | b5b9032 | 2023-11-14 07:38:18 +0000 | [diff] [blame] | 82 | "vintf_fragments", |
Nikita Ioffe | 94a8a18 | 2023-11-16 16:37:48 +0000 | [diff] [blame] | 83 | ], |
Inseob Kim | 77c7f71 | 2023-11-06 17:01:02 +0900 | [diff] [blame] | 84 | } |
| 85 | |
| 86 | avf_flag_aware_apex_defaults { |
Nikita Ioffe | 50e2ebe | 2022-10-24 17:16:25 +0100 | [diff] [blame] | 87 | name: "com.android.virt_avf_enabled", |
| 88 | |
| 89 | defaults: ["com.android.virt_common"], |
| 90 | |
Jooyung Han | 05063d1 | 2021-10-27 01:50:51 +0900 | [diff] [blame] | 91 | custom_sign_tool: "sign_virt_apex", |
Jiyong Park | da119cb | 2020-12-07 15:58:23 +0900 | [diff] [blame] | 92 | |
Andrew Walbran | dfc953d | 2021-06-10 13:59:56 +0000 | [diff] [blame] | 93 | // crosvm and virtualizationservice are only enabled for 64-bit targets on device |
Jiyong Park | 2199f20 | 2020-12-07 15:58:47 +0900 | [diff] [blame] | 94 | arch: { |
| 95 | arm64: { |
| 96 | binaries: [ |
Jiyong Park | 69b3937 | 2021-01-05 23:14:46 +0900 | [diff] [blame] | 97 | "crosvm", |
David Brazdil | 1f53070 | 2022-10-03 12:18:10 +0100 | [diff] [blame] | 98 | "virtmgr", |
Andrew Walbran | dfc953d | 2021-06-10 13:59:56 +0000 | [diff] [blame] | 99 | "virtualizationservice", |
Jiyong Park | 69b3937 | 2021-01-05 23:14:46 +0900 | [diff] [blame] | 100 | ], |
Victor Hsieh | 384bf6a | 2021-11-11 13:28:09 -0800 | [diff] [blame] | 101 | filesystems: microdroid_filesystem_images, |
Alice Wang | be8330c | 2023-10-19 08:55:07 +0000 | [diff] [blame] | 102 | prebuilts: [ |
| 103 | "rialto_bin", |
| 104 | ], |
Jiyong Park | 69b3937 | 2021-01-05 23:14:46 +0900 | [diff] [blame] | 105 | }, |
| 106 | x86_64: { |
| 107 | binaries: [ |
Jiyong Park | 2199f20 | 2020-12-07 15:58:47 +0900 | [diff] [blame] | 108 | "crosvm", |
David Brazdil | 1f53070 | 2022-10-03 12:18:10 +0100 | [diff] [blame] | 109 | "virtmgr", |
Andrew Walbran | dfc953d | 2021-06-10 13:59:56 +0000 | [diff] [blame] | 110 | "virtualizationservice", |
Jiyong Park | 2199f20 | 2020-12-07 15:58:47 +0900 | [diff] [blame] | 111 | ], |
Victor Hsieh | 384bf6a | 2021-11-11 13:28:09 -0800 | [diff] [blame] | 112 | filesystems: microdroid_filesystem_images, |
Jiyong Park | 2199f20 | 2020-12-07 15:58:47 +0900 | [diff] [blame] | 113 | }, |
| 114 | }, |
Jiyong Park | 8d1eb7e | 2021-02-16 13:23:00 +0900 | [diff] [blame] | 115 | binaries: [ |
Victor Hsieh | 573c649 | 2021-03-11 14:19:18 -0800 | [diff] [blame] | 116 | "fd_server", |
Andrew Walbran | ea9fa48 | 2021-03-04 16:11:12 +0000 | [diff] [blame] | 117 | "vm", |
Jiyong Park | 8d1eb7e | 2021-02-16 13:23:00 +0900 | [diff] [blame] | 118 | ], |
Inseob Kim | 72f06a3 | 2021-04-12 14:48:42 +0900 | [diff] [blame] | 119 | prebuilts: [ |
Nikita Ioffe | ab1754c | 2022-10-13 20:28:54 +0100 | [diff] [blame] | 120 | "features_com.android.virt.xml", |
Seungjae Yoo | e85831e | 2022-12-12 09:34:58 +0900 | [diff] [blame] | 121 | "microdroid_initrd_debuggable", |
Shikha Panwar | f46f96b | 2022-08-22 14:11:14 +0000 | [diff] [blame] | 122 | "microdroid_initrd_normal", |
Jiyong Park | e9b74d0 | 2021-06-21 14:39:12 +0900 | [diff] [blame] | 123 | "microdroid.json", |
Shikha Panwar | ed8ace4 | 2022-09-28 12:52:16 +0000 | [diff] [blame] | 124 | "microdroid_kernel", |
Inseob Kim | 72f06a3 | 2021-04-12 14:48:42 +0900 | [diff] [blame] | 125 | ], |
Jiyong Park | 17e3ed4 | 2022-08-29 17:27:00 +0900 | [diff] [blame] | 126 | host_required: [ |
| 127 | "vm_shell", |
| 128 | ], |
Nikita Ioffe | b0b6756 | 2022-11-22 15:48:06 +0000 | [diff] [blame] | 129 | apps: [ |
| 130 | "EmptyPayloadApp", |
| 131 | ], |
Inseob Kim | 77c7f71 | 2023-11-06 17:01:02 +0900 | [diff] [blame] | 132 | soong_config_variables: { |
Nikita Ioffe | 94a8a18 | 2023-11-16 16:37:48 +0000 | [diff] [blame] | 133 | release_avf_enable_device_assignment: { |
| 134 | prebuilts: [ |
| 135 | "com.android.virt.vfio_handler.rc", |
| 136 | ], |
| 137 | arch: { |
| 138 | arm64: { |
| 139 | binaries: ["vfio_handler"], |
| 140 | }, |
| 141 | x86_64: { |
| 142 | binaries: ["vfio_handler"], |
| 143 | }, |
| 144 | }, |
| 145 | }, |
Inseob Kim | 77c7f71 | 2023-11-06 17:01:02 +0900 | [diff] [blame] | 146 | release_avf_enable_vendor_modules: { |
| 147 | prebuilts: [ |
Inseob Kim | 0276f61 | 2023-12-07 17:25:18 +0900 | [diff] [blame] | 148 | "microdroid_gki-android14-6.1_initrd_debuggable", |
| 149 | "microdroid_gki-android14-6.1_initrd_normal", |
| 150 | "microdroid_gki-android14-6.1_kernel", |
| 151 | "microdroid_gki-android14-6.1.json", |
Inseob Kim | 77c7f71 | 2023-11-06 17:01:02 +0900 | [diff] [blame] | 152 | ], |
| 153 | }, |
Alice Wang | b5b9032 | 2023-11-14 07:38:18 +0000 | [diff] [blame] | 154 | release_avf_enable_remote_attestation: { |
| 155 | prebuilts: ["com.android.virt.init_attestation_enabled.rc"], |
| 156 | vintf_fragments: [ |
| 157 | "virtualizationservice.xml", |
| 158 | ], |
| 159 | conditions_default: { |
| 160 | prebuilts: ["com.android.virt.init.rc"], |
| 161 | }, |
| 162 | }, |
Inseob Kim | 77c7f71 | 2023-11-06 17:01:02 +0900 | [diff] [blame] | 163 | }, |
Jiyong Park | da119cb | 2020-12-07 15:58:23 +0900 | [diff] [blame] | 164 | } |
| 165 | |
Nikita Ioffe | 50e2ebe | 2022-10-24 17:16:25 +0100 | [diff] [blame] | 166 | apex_defaults { |
| 167 | name: "com.android.virt_avf_disabled", |
| 168 | |
| 169 | defaults: ["com.android.virt_common"], |
| 170 | } |
| 171 | |
Jiyong Park | da119cb | 2020-12-07 15:58:23 +0900 | [diff] [blame] | 172 | apex_key { |
| 173 | name: "com.android.virt.key", |
| 174 | public_key: "com.android.virt.avbpubkey", |
| 175 | private_key: "com.android.virt.pem", |
| 176 | } |
| 177 | |
| 178 | android_app_certificate { |
| 179 | name: "com.android.virt.certificate", |
| 180 | certificate: "com.android.virt", |
| 181 | } |
Jeff Vander Stoep | 63ab238 | 2021-03-25 22:18:53 +0100 | [diff] [blame] | 182 | |
| 183 | prebuilt_etc { |
| 184 | name: "com.android.virt.init.rc", |
Andrew Walbran | f6bf686 | 2021-05-21 12:41:13 +0000 | [diff] [blame] | 185 | src: "virtualizationservice.rc", |
Alice Wang | b5b9032 | 2023-11-14 07:38:18 +0000 | [diff] [blame] | 186 | filename: "virtualizationservice.rc", |
| 187 | installable: false, |
| 188 | } |
| 189 | |
| 190 | prebuilt_etc { |
| 191 | name: "com.android.virt.init_attestation_enabled.rc", |
| 192 | src: "virtualizationservice_attestation_enabled.rc", |
| 193 | filename: "virtualizationservice.rc", |
Alan Stokes | 3ef78d9 | 2021-09-08 11:51:06 +0100 | [diff] [blame] | 194 | installable: false, |
Jeff Vander Stoep | 63ab238 | 2021-03-25 22:18:53 +0100 | [diff] [blame] | 195 | } |
Jooyung Han | 504105f | 2021-10-26 15:54:50 +0900 | [diff] [blame] | 196 | |
Nikita Ioffe | 94a8a18 | 2023-11-16 16:37:48 +0000 | [diff] [blame] | 197 | prebuilt_etc { |
| 198 | name: "com.android.virt.vfio_handler.rc", |
| 199 | src: "vfio_handler.rc", |
| 200 | filename: "vfio_handler.rc", |
| 201 | installable: false, |
| 202 | } |
| 203 | |
Jooyung Han | 504105f | 2021-10-26 15:54:50 +0900 | [diff] [blame] | 204 | // Virt apex needs a custom signer for its payload |
| 205 | python_binary_host { |
| 206 | name: "sign_virt_apex", |
| 207 | srcs: [ |
| 208 | "sign_virt_apex.py", |
| 209 | ], |
| 210 | version: { |
Jooyung Han | 504105f | 2021-10-26 15:54:50 +0900 | [diff] [blame] | 211 | py3: { |
Jooyung Han | 504105f | 2021-10-26 15:54:50 +0900 | [diff] [blame] | 212 | embedded_launcher: true, |
| 213 | }, |
| 214 | }, |
Jooyung Han | 05063d1 | 2021-10-27 01:50:51 +0900 | [diff] [blame] | 215 | required: [ |
Shikha Panwar | a7605cf | 2023-01-12 09:29:39 +0000 | [diff] [blame] | 216 | // sign_virt_apex should be runnable from outside the source tree, |
| 217 | // therefore, any required tool should be listed in build/make/core/Makefile as well. |
Jooyung Han | 05063d1 | 2021-10-27 01:50:51 +0900 | [diff] [blame] | 218 | "img2simg", |
Shikha Panwar | a7605cf | 2023-01-12 09:29:39 +0000 | [diff] [blame] | 219 | "initrd_bootconfig", |
Jooyung Han | 05063d1 | 2021-10-27 01:50:51 +0900 | [diff] [blame] | 220 | "lpmake", |
| 221 | "lpunpack", |
| 222 | "simg2img", |
| 223 | ], |
Jooyung Han | 504105f | 2021-10-26 15:54:50 +0900 | [diff] [blame] | 224 | } |
Jooyung Han | d35952e | 2021-11-08 17:53:47 +0900 | [diff] [blame] | 225 | |
Jooyung Han | 02dceed | 2021-11-08 17:50:22 +0900 | [diff] [blame] | 226 | sh_test_host { |
| 227 | name: "sign_virt_apex_test", |
| 228 | src: "sign_virt_apex_test.sh", |
| 229 | test_config: "sign_virt_apex_test.xml", |
| 230 | data_bins: [ |
| 231 | // deapexer |
| 232 | "deapexer", |
| 233 | "debugfs_static", |
Dennis Shen | 28c7944 | 2022-11-08 14:26:13 +0000 | [diff] [blame] | 234 | "fsck.erofs", |
Jooyung Han | 02dceed | 2021-11-08 17:50:22 +0900 | [diff] [blame] | 235 | |
| 236 | // sign_virt_apex |
| 237 | "avbtool", |
| 238 | "img2simg", |
Shikha Panwar | a7605cf | 2023-01-12 09:29:39 +0000 | [diff] [blame] | 239 | "initrd_bootconfig", |
Jooyung Han | 02dceed | 2021-11-08 17:50:22 +0900 | [diff] [blame] | 240 | "lpmake", |
| 241 | "lpunpack", |
| 242 | "sign_virt_apex", |
| 243 | "simg2img", |
| 244 | ], |
| 245 | data_libs: [ |
| 246 | "libbase", |
| 247 | "libc++", |
| 248 | "libcrypto_utils", |
| 249 | "libcrypto", |
| 250 | "libext4_utils", |
| 251 | "liblog", |
| 252 | "liblp", |
| 253 | "libsparse", |
| 254 | "libz", |
| 255 | ], |
| 256 | data: [ |
| 257 | ":com.android.virt", |
Jooyung Han | 6afd667 | 2022-02-22 05:22:23 +0900 | [diff] [blame] | 258 | ":test.com.android.virt.pem", |
Jooyung Han | 02dceed | 2021-11-08 17:50:22 +0900 | [diff] [blame] | 259 | ], |
| 260 | test_suites: ["general-tests"], |
| 261 | } |
| 262 | |
Jooyung Han | 6afd667 | 2022-02-22 05:22:23 +0900 | [diff] [blame] | 263 | filegroup { |
| 264 | name: "test.com.android.virt.pem", |
| 265 | srcs: ["test.com.android.virt.pem"], |
| 266 | } |
| 267 | |
Jooyung Han | 1c3d2fa | 2022-02-24 02:35:59 +0900 | [diff] [blame] | 268 | filegroup { |
| 269 | name: "test2.com.android.virt.pem", |
| 270 | srcs: ["test2.com.android.virt.pem"], |
| 271 | } |
| 272 | |
Jooyung Han | d35952e | 2021-11-08 17:53:47 +0900 | [diff] [blame] | 273 | // custom tool to replace bytes in a file |
| 274 | python_binary_host { |
| 275 | name: "replace_bytes", |
| 276 | srcs: [ |
| 277 | "replace_bytes.py", |
| 278 | ], |
| 279 | version: { |
Jooyung Han | d35952e | 2021-11-08 17:53:47 +0900 | [diff] [blame] | 280 | py3: { |
Jooyung Han | d35952e | 2021-11-08 17:53:47 +0900 | [diff] [blame] | 281 | embedded_launcher: true, |
| 282 | }, |
| 283 | }, |
| 284 | } |
Nikita Ioffe | f28eec2 | 2022-10-18 23:17:34 +0100 | [diff] [blame] | 285 | |
| 286 | // Encapsulate the contributions made by the com.android.virt to the bootclasspath. |
| 287 | bootclasspath_fragment { |
| 288 | name: "com.android.virt-bootclasspath-fragment", |
| 289 | contents: ["framework-virtualization"], |
| 290 | apex_available: ["com.android.virt"], |
| 291 | |
| 292 | // The bootclasspath_fragments that provide APIs on which this depends. |
| 293 | fragments: [ |
| 294 | { |
| 295 | apex: "com.android.art", |
| 296 | module: "art-bootclasspath-fragment", |
| 297 | }, |
| 298 | ], |
| 299 | |
| 300 | // Additional stubs libraries that this fragment's contents use which are |
| 301 | // not provided by another bootclasspath_fragment. |
| 302 | additional_stubs: [ |
| 303 | "android-non-updatable", |
| 304 | ], |
| 305 | |
| 306 | hidden_api: { |
| 307 | |
| 308 | // This module does not contain any split packages. |
| 309 | split_packages: [], |
| 310 | |
| 311 | // The following packages and all their subpackages currently only |
| 312 | // contain classes from this bootclasspath_fragment. Listing a package |
| 313 | // here won't prevent other bootclasspath modules from adding classes in |
| 314 | // any of those packages but it will prevent them from adding those |
| 315 | // classes into an API surface, e.g. public, system, etc.. Doing so will |
| 316 | // result in a build failure due to inconsistent flags. |
| 317 | package_prefixes: [ |
| 318 | "android.system.virtualmachine", |
| 319 | "android.system.virtualizationservice", |
| 320 | // android.sysprop.*, renamed by jarjar |
| 321 | "com.android.system.virtualmachine.sysprop", |
| 322 | ], |
| 323 | }, |
| 324 | } |