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