blob: 7cc04144d19cf6dc1ee995b86c054a5b59ab66fd [file] [log] [blame]
Bob Badour2efc4762021-02-03 18:36:27 -08001package {
2 default_applicable_licenses: ["Android-Apache-2.0"],
3}
4
Victor Hsieh384bf6a2021-11-11 13:28:09 -08005microdroid_filesystem_images = [
Andrew Sculld6267ae2022-06-13 13:47:59 +00006 "microdroid_super",
Victor Hsieh384bf6a2021-11-11 13:28:09 -08007 "microdroid_vbmeta",
Victor Hsieh384bf6a2021-11-11 13:28:09 -08008]
9
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +010010soong_config_module_type {
11 name: "virt_apex",
12 module_type: "apex",
13 config_namespace: "ANDROID",
Nikita Ioffeadb33932023-06-07 14:33:56 +010014 bool_variables: [
15 "avf_enabled",
Nikita Ioffeadb33932023-06-07 14:33:56 +010016 ],
17 properties: [
18 "defaults",
19 "prebuilts",
20 ],
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +010021}
Jiyong Parkda119cb2020-12-07 15:58:23 +090022
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +010023virt_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 Ioffead4c7192024-02-02 13:07:00 +000035soong_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",
44 ],
45 properties: [
46 "androidManifest",
47 "arch",
48 "prebuilts",
49 "systemserverclasspath_fragments",
50 "vintf_fragments",
51 ],
52}
53
54avf_flag_aware_apex_defaults {
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +010055 name: "com.android.virt_common",
Jiyong Parkda119cb2020-12-07 15:58:23 +090056 // TODO(jiyong): make it updatable
Mathew Inwood9af36dd2021-02-16 14:43:40 +000057 updatable: false,
Nikita Ioffec0b09612023-01-27 01:49:39 +000058 future_updatable: false,
Jiyong Parkb6c45e72021-06-22 20:24:56 +090059 platform_apis: true,
Jiyong Parkda119cb2020-12-07 15:58:23 +090060
61 manifest: "manifest.json",
62
63 key: "com.android.virt.key",
64 certificate: ":com.android.virt.certificate",
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +010065
66 apps: [
67 "android.system.virtualmachine.res",
68 ],
69
70 file_contexts: ":com.android.virt-file_contexts",
71 canned_fs_config: "canned_fs_config",
Nikita Ioffef28eec22022-10-18 23:17:34 +010072
73 bootclasspath_fragments: [
74 "com.android.virt-bootclasspath-fragment",
75 ],
Nikita Ioffeb78c6202022-11-18 17:01:36 +000076 jni_libs: [
David Brazdil79588392022-10-20 17:04:46 +010077 "libvirtualizationservice_jni",
Nikita Ioffeb78c6202022-11-18 17:01:36 +000078 "libvirtualmachine_jni",
79 ],
Jooyung Han3b980eb2023-11-03 14:48:00 +090080 // TODO(b/295593640) Unfortunately these are added to the apex even though they are unused.
81 // Once the build system is fixed, remove this.
82 unwanted_transitive_deps: [
83 "libdrm",
84 "libsso",
85 "libutils",
86 ],
Nikita Ioffead4c7192024-02-02 13:07:00 +000087 soong_config_variables: {
88 release_avf_enable_llpvm_changes: {
89 systemserverclasspath_fragments: [
90 "com.android.virt-systemserver-fragment",
91 ],
92 },
93 },
Inseob Kim77c7f712023-11-06 17:01:02 +090094}
95
96avf_flag_aware_apex_defaults {
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +010097 name: "com.android.virt_avf_enabled",
98
99 defaults: ["com.android.virt_common"],
100
Jooyung Han05063d12021-10-27 01:50:51 +0900101 custom_sign_tool: "sign_virt_apex",
Jiyong Parkda119cb2020-12-07 15:58:23 +0900102
Andrew Walbrandfc953d2021-06-10 13:59:56 +0000103 // crosvm and virtualizationservice are only enabled for 64-bit targets on device
Jiyong Park2199f202020-12-07 15:58:47 +0900104 arch: {
105 arm64: {
106 binaries: [
Jiyong Park69b39372021-01-05 23:14:46 +0900107 "crosvm",
David Brazdil1f530702022-10-03 12:18:10 +0100108 "virtmgr",
Andrew Walbrandfc953d2021-06-10 13:59:56 +0000109 "virtualizationservice",
Jiyong Park69b39372021-01-05 23:14:46 +0900110 ],
Victor Hsieh384bf6a2021-11-11 13:28:09 -0800111 filesystems: microdroid_filesystem_images,
Alice Wangbe8330c2023-10-19 08:55:07 +0000112 prebuilts: [
113 "rialto_bin",
114 ],
Jiyong Park69b39372021-01-05 23:14:46 +0900115 },
116 x86_64: {
117 binaries: [
Jiyong Park2199f202020-12-07 15:58:47 +0900118 "crosvm",
David Brazdil1f530702022-10-03 12:18:10 +0100119 "virtmgr",
Andrew Walbrandfc953d2021-06-10 13:59:56 +0000120 "virtualizationservice",
Jiyong Park2199f202020-12-07 15:58:47 +0900121 ],
Victor Hsieh384bf6a2021-11-11 13:28:09 -0800122 filesystems: microdroid_filesystem_images,
Jiyong Park2199f202020-12-07 15:58:47 +0900123 },
124 },
Jiyong Park8d1eb7e2021-02-16 13:23:00 +0900125 binaries: [
Victor Hsieh573c6492021-03-11 14:19:18 -0800126 "fd_server",
Andrew Walbranea9fa482021-03-04 16:11:12 +0000127 "vm",
Jiyong Park8d1eb7e2021-02-16 13:23:00 +0900128 ],
Inseob Kim72f06a32021-04-12 14:48:42 +0900129 prebuilts: [
Nikita Ioffeab1754c2022-10-13 20:28:54 +0100130 "features_com.android.virt.xml",
Seungjae Yooe85831e2022-12-12 09:34:58 +0900131 "microdroid_initrd_debuggable",
Shikha Panwarf46f96b2022-08-22 14:11:14 +0000132 "microdroid_initrd_normal",
Jiyong Parke9b74d02021-06-21 14:39:12 +0900133 "microdroid.json",
Shikha Panwared8ace42022-09-28 12:52:16 +0000134 "microdroid_kernel",
Inseob Kim72f06a32021-04-12 14:48:42 +0900135 ],
Jiyong Park17e3ed42022-08-29 17:27:00 +0900136 host_required: [
137 "vm_shell",
138 ],
Nikita Ioffeb0b67562022-11-22 15:48:06 +0000139 apps: [
140 "EmptyPayloadApp",
141 ],
Inseob Kim77c7f712023-11-06 17:01:02 +0900142 soong_config_variables: {
Nikita Ioffe94a8a182023-11-16 16:37:48 +0000143 release_avf_enable_device_assignment: {
144 prebuilts: [
145 "com.android.virt.vfio_handler.rc",
146 ],
147 arch: {
148 arm64: {
149 binaries: ["vfio_handler"],
150 },
151 x86_64: {
152 binaries: ["vfio_handler"],
153 },
154 },
155 },
Nikita Ioffead4c7192024-02-02 13:07:00 +0000156 release_avf_enable_llpvm_changes: {
157 androidManifest: "AndroidManifest.xml",
158 },
Inseob Kim77c7f712023-11-06 17:01:02 +0900159 release_avf_enable_vendor_modules: {
160 prebuilts: [
Inseob Kim0276f612023-12-07 17:25:18 +0900161 "microdroid_gki-android14-6.1_initrd_debuggable",
162 "microdroid_gki-android14-6.1_initrd_normal",
163 "microdroid_gki-android14-6.1_kernel",
164 "microdroid_gki-android14-6.1.json",
Inseob Kim77c7f712023-11-06 17:01:02 +0900165 ],
166 },
Alice Wangb5b90322023-11-14 07:38:18 +0000167 release_avf_enable_remote_attestation: {
168 prebuilts: ["com.android.virt.init_attestation_enabled.rc"],
169 vintf_fragments: [
170 "virtualizationservice.xml",
171 ],
172 conditions_default: {
173 prebuilts: ["com.android.virt.init.rc"],
174 },
175 },
Inseob Kim77c7f712023-11-06 17:01:02 +0900176 },
Jiyong Parkda119cb2020-12-07 15:58:23 +0900177}
178
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +0100179apex_defaults {
180 name: "com.android.virt_avf_disabled",
181
182 defaults: ["com.android.virt_common"],
183}
184
Jiyong Parkda119cb2020-12-07 15:58:23 +0900185apex_key {
186 name: "com.android.virt.key",
187 public_key: "com.android.virt.avbpubkey",
188 private_key: "com.android.virt.pem",
189}
190
191android_app_certificate {
192 name: "com.android.virt.certificate",
193 certificate: "com.android.virt",
194}
Jeff Vander Stoep63ab2382021-03-25 22:18:53 +0100195
196prebuilt_etc {
197 name: "com.android.virt.init.rc",
Andrew Walbranf6bf6862021-05-21 12:41:13 +0000198 src: "virtualizationservice.rc",
Alice Wangb5b90322023-11-14 07:38:18 +0000199 filename: "virtualizationservice.rc",
200 installable: false,
201}
202
203prebuilt_etc {
204 name: "com.android.virt.init_attestation_enabled.rc",
205 src: "virtualizationservice_attestation_enabled.rc",
206 filename: "virtualizationservice.rc",
Alan Stokes3ef78d92021-09-08 11:51:06 +0100207 installable: false,
Jeff Vander Stoep63ab2382021-03-25 22:18:53 +0100208}
Jooyung Han504105f2021-10-26 15:54:50 +0900209
Nikita Ioffe94a8a182023-11-16 16:37:48 +0000210prebuilt_etc {
211 name: "com.android.virt.vfio_handler.rc",
212 src: "vfio_handler.rc",
213 filename: "vfio_handler.rc",
214 installable: false,
215}
216
Jooyung Han504105f2021-10-26 15:54:50 +0900217// Virt apex needs a custom signer for its payload
218python_binary_host {
219 name: "sign_virt_apex",
220 srcs: [
221 "sign_virt_apex.py",
222 ],
223 version: {
Jooyung Han504105f2021-10-26 15:54:50 +0900224 py3: {
Jooyung Han504105f2021-10-26 15:54:50 +0900225 embedded_launcher: true,
226 },
227 },
Jooyung Han05063d12021-10-27 01:50:51 +0900228 required: [
Shikha Panwara7605cf2023-01-12 09:29:39 +0000229 // sign_virt_apex should be runnable from outside the source tree,
230 // therefore, any required tool should be listed in build/make/core/Makefile as well.
Jooyung Han05063d12021-10-27 01:50:51 +0900231 "img2simg",
Shikha Panwara7605cf2023-01-12 09:29:39 +0000232 "initrd_bootconfig",
Jooyung Han05063d12021-10-27 01:50:51 +0900233 "lpmake",
234 "lpunpack",
235 "simg2img",
236 ],
Jooyung Han504105f2021-10-26 15:54:50 +0900237}
Jooyung Hand35952e2021-11-08 17:53:47 +0900238
Jooyung Han02dceed2021-11-08 17:50:22 +0900239sh_test_host {
240 name: "sign_virt_apex_test",
241 src: "sign_virt_apex_test.sh",
242 test_config: "sign_virt_apex_test.xml",
243 data_bins: [
244 // deapexer
245 "deapexer",
246 "debugfs_static",
Dennis Shen28c79442022-11-08 14:26:13 +0000247 "fsck.erofs",
Jooyung Han02dceed2021-11-08 17:50:22 +0900248
249 // sign_virt_apex
250 "avbtool",
251 "img2simg",
Shikha Panwara7605cf2023-01-12 09:29:39 +0000252 "initrd_bootconfig",
Jooyung Han02dceed2021-11-08 17:50:22 +0900253 "lpmake",
254 "lpunpack",
255 "sign_virt_apex",
256 "simg2img",
257 ],
258 data_libs: [
259 "libbase",
260 "libc++",
261 "libcrypto_utils",
262 "libcrypto",
263 "libext4_utils",
264 "liblog",
265 "liblp",
266 "libsparse",
267 "libz",
268 ],
269 data: [
270 ":com.android.virt",
Jooyung Han6afd6672022-02-22 05:22:23 +0900271 ":test.com.android.virt.pem",
Jooyung Han02dceed2021-11-08 17:50:22 +0900272 ],
273 test_suites: ["general-tests"],
274}
275
Jooyung Han6afd6672022-02-22 05:22:23 +0900276filegroup {
277 name: "test.com.android.virt.pem",
278 srcs: ["test.com.android.virt.pem"],
279}
280
Jooyung Han1c3d2fa2022-02-24 02:35:59 +0900281filegroup {
282 name: "test2.com.android.virt.pem",
283 srcs: ["test2.com.android.virt.pem"],
284}
285
Jooyung Hand35952e2021-11-08 17:53:47 +0900286// custom tool to replace bytes in a file
287python_binary_host {
288 name: "replace_bytes",
289 srcs: [
290 "replace_bytes.py",
291 ],
292 version: {
Jooyung Hand35952e2021-11-08 17:53:47 +0900293 py3: {
Jooyung Hand35952e2021-11-08 17:53:47 +0900294 embedded_launcher: true,
295 },
296 },
297}
Nikita Ioffef28eec22022-10-18 23:17:34 +0100298
299// Encapsulate the contributions made by the com.android.virt to the bootclasspath.
300bootclasspath_fragment {
301 name: "com.android.virt-bootclasspath-fragment",
302 contents: ["framework-virtualization"],
303 apex_available: ["com.android.virt"],
304
305 // The bootclasspath_fragments that provide APIs on which this depends.
306 fragments: [
307 {
308 apex: "com.android.art",
309 module: "art-bootclasspath-fragment",
310 },
311 ],
312
313 // Additional stubs libraries that this fragment's contents use which are
314 // not provided by another bootclasspath_fragment.
315 additional_stubs: [
316 "android-non-updatable",
317 ],
318
319 hidden_api: {
320
321 // This module does not contain any split packages.
322 split_packages: [],
323
324 // The following packages and all their subpackages currently only
325 // contain classes from this bootclasspath_fragment. Listing a package
326 // here won't prevent other bootclasspath modules from adding classes in
327 // any of those packages but it will prevent them from adding those
328 // classes into an API surface, e.g. public, system, etc.. Doing so will
329 // result in a build failure due to inconsistent flags.
330 package_prefixes: [
331 "android.system.virtualmachine",
332 "android.system.virtualizationservice",
333 // android.sysprop.*, renamed by jarjar
334 "com.android.system.virtualmachine.sysprop",
335 ],
336 },
337}
Nikita Ioffead4c7192024-02-02 13:07:00 +0000338
339soong_config_module_type {
340 name: "avf_flag_aware_systemserverclasspath_fragment",
341 module_type: "systemserverclasspath_fragment",
342 config_namespace: "ANDROID",
343 bool_variables: [
344 "release_avf_enable_llpvm_changes",
345 ],
346 properties: [
347 "enabled",
348 ],
349}
350
351avf_flag_aware_systemserverclasspath_fragment {
352 name: "com.android.virt-systemserver-fragment",
353 contents: [
354 "service-virtualization",
355 ],
356 apex_available: ["com.android.virt"],
357 enabled: false,
358 soong_config_variables: {
359 release_avf_enable_llpvm_changes: {
360 enabled: true,
361 },
362 },
363}