blob: cc59b163051d3385103bf4620b68df5a0a885854 [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",
David Dai351b9cf2024-02-14 18:42:09 -080044 "release_avf_enable_virt_cpufreq",
Nikita Ioffead4c7192024-02-02 13:07:00 +000045 ],
46 properties: [
47 "androidManifest",
48 "arch",
David Dai351b9cf2024-02-14 18:42:09 -080049 "canned_fs_config",
Nikita Ioffead4c7192024-02-02 13:07:00 +000050 "prebuilts",
51 "systemserverclasspath_fragments",
52 "vintf_fragments",
53 ],
54}
55
56avf_flag_aware_apex_defaults {
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +010057 name: "com.android.virt_common",
Jiyong Parkda119cb2020-12-07 15:58:23 +090058 // TODO(jiyong): make it updatable
Mathew Inwood9af36dd2021-02-16 14:43:40 +000059 updatable: false,
Nikita Ioffec0b09612023-01-27 01:49:39 +000060 future_updatable: false,
Jiyong Parkb6c45e72021-06-22 20:24:56 +090061 platform_apis: true,
Jiyong Parkda119cb2020-12-07 15:58:23 +090062
63 manifest: "manifest.json",
64
65 key: "com.android.virt.key",
66 certificate: ":com.android.virt.certificate",
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +010067
68 apps: [
69 "android.system.virtualmachine.res",
70 ],
71
72 file_contexts: ":com.android.virt-file_contexts",
Nikita Ioffef28eec22022-10-18 23:17:34 +010073
74 bootclasspath_fragments: [
75 "com.android.virt-bootclasspath-fragment",
76 ],
Nikita Ioffeb78c6202022-11-18 17:01:36 +000077 jni_libs: [
David Brazdil79588392022-10-20 17:04:46 +010078 "libvirtualizationservice_jni",
Nikita Ioffeb78c6202022-11-18 17:01:36 +000079 "libvirtualmachine_jni",
80 ],
Jooyung Han3b980eb2023-11-03 14:48:00 +090081 // 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 Ioffead4c7192024-02-02 13:07:00 +000088 soong_config_variables: {
89 release_avf_enable_llpvm_changes: {
90 systemserverclasspath_fragments: [
91 "com.android.virt-systemserver-fragment",
92 ],
93 },
David Dai351b9cf2024-02-14 18:42:09 -080094 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 Ioffead4c7192024-02-02 13:07:00 +0000100 },
Inseob Kim77c7f712023-11-06 17:01:02 +0900101}
102
103avf_flag_aware_apex_defaults {
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +0100104 name: "com.android.virt_avf_enabled",
105
106 defaults: ["com.android.virt_common"],
107
Jooyung Han05063d12021-10-27 01:50:51 +0900108 custom_sign_tool: "sign_virt_apex",
Jiyong Parkda119cb2020-12-07 15:58:23 +0900109
Andrew Walbrandfc953d2021-06-10 13:59:56 +0000110 // crosvm and virtualizationservice are only enabled for 64-bit targets on device
Jiyong Park2199f202020-12-07 15:58:47 +0900111 arch: {
112 arm64: {
113 binaries: [
Jiyong Park69b39372021-01-05 23:14:46 +0900114 "crosvm",
David Brazdil1f530702022-10-03 12:18:10 +0100115 "virtmgr",
Andrew Walbrandfc953d2021-06-10 13:59:56 +0000116 "virtualizationservice",
Jiyong Park69b39372021-01-05 23:14:46 +0900117 ],
Victor Hsieh384bf6a2021-11-11 13:28:09 -0800118 filesystems: microdroid_filesystem_images,
Alice Wangbe8330c2023-10-19 08:55:07 +0000119 prebuilts: [
120 "rialto_bin",
121 ],
Jiyong Park69b39372021-01-05 23:14:46 +0900122 },
123 x86_64: {
124 binaries: [
Jiyong Park2199f202020-12-07 15:58:47 +0900125 "crosvm",
David Brazdil1f530702022-10-03 12:18:10 +0100126 "virtmgr",
Andrew Walbrandfc953d2021-06-10 13:59:56 +0000127 "virtualizationservice",
Jiyong Park2199f202020-12-07 15:58:47 +0900128 ],
Victor Hsieh384bf6a2021-11-11 13:28:09 -0800129 filesystems: microdroid_filesystem_images,
Jiyong Park2199f202020-12-07 15:58:47 +0900130 },
131 },
Jiyong Park8d1eb7e2021-02-16 13:23:00 +0900132 binaries: [
Victor Hsieh573c6492021-03-11 14:19:18 -0800133 "fd_server",
Andrew Walbranea9fa482021-03-04 16:11:12 +0000134 "vm",
Jiyong Park8d1eb7e2021-02-16 13:23:00 +0900135 ],
Inseob Kim72f06a32021-04-12 14:48:42 +0900136 prebuilts: [
Nikita Ioffeab1754c2022-10-13 20:28:54 +0100137 "features_com.android.virt.xml",
Seungjae Yooe85831e2022-12-12 09:34:58 +0900138 "microdroid_initrd_debuggable",
Shikha Panwarf46f96b2022-08-22 14:11:14 +0000139 "microdroid_initrd_normal",
Jiyong Parke9b74d02021-06-21 14:39:12 +0900140 "microdroid.json",
Shikha Panwared8ace42022-09-28 12:52:16 +0000141 "microdroid_kernel",
Inseob Kim72f06a32021-04-12 14:48:42 +0900142 ],
Jiyong Park17e3ed42022-08-29 17:27:00 +0900143 host_required: [
144 "vm_shell",
145 ],
Nikita Ioffeb0b67562022-11-22 15:48:06 +0000146 apps: [
147 "EmptyPayloadApp",
148 ],
Inseob Kim77c7f712023-11-06 17:01:02 +0900149 soong_config_variables: {
Nikita Ioffe94a8a182023-11-16 16:37:48 +0000150 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 Ioffead4c7192024-02-02 13:07:00 +0000163 release_avf_enable_llpvm_changes: {
164 androidManifest: "AndroidManifest.xml",
165 },
Inseob Kim77c7f712023-11-06 17:01:02 +0900166 release_avf_enable_vendor_modules: {
167 prebuilts: [
Inseob Kim0276f612023-12-07 17:25:18 +0900168 "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 Kim77c7f712023-11-06 17:01:02 +0900172 ],
173 },
Alice Wangb5b90322023-11-14 07:38:18 +0000174 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 Kim77c7f712023-11-06 17:01:02 +0900183 },
Jiyong Parkda119cb2020-12-07 15:58:23 +0900184}
185
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +0100186apex_defaults {
187 name: "com.android.virt_avf_disabled",
188
189 defaults: ["com.android.virt_common"],
190}
191
Jiyong Parkda119cb2020-12-07 15:58:23 +0900192apex_key {
193 name: "com.android.virt.key",
194 public_key: "com.android.virt.avbpubkey",
195 private_key: "com.android.virt.pem",
196}
197
198android_app_certificate {
199 name: "com.android.virt.certificate",
200 certificate: "com.android.virt",
201}
Jeff Vander Stoep63ab2382021-03-25 22:18:53 +0100202
203prebuilt_etc {
204 name: "com.android.virt.init.rc",
Andrew Walbranf6bf6862021-05-21 12:41:13 +0000205 src: "virtualizationservice.rc",
Alice Wangb5b90322023-11-14 07:38:18 +0000206 filename: "virtualizationservice.rc",
207 installable: false,
208}
209
210prebuilt_etc {
211 name: "com.android.virt.init_attestation_enabled.rc",
212 src: "virtualizationservice_attestation_enabled.rc",
213 filename: "virtualizationservice.rc",
Alan Stokes3ef78d92021-09-08 11:51:06 +0100214 installable: false,
Jeff Vander Stoep63ab2382021-03-25 22:18:53 +0100215}
Jooyung Han504105f2021-10-26 15:54:50 +0900216
Nikita Ioffe94a8a182023-11-16 16:37:48 +0000217prebuilt_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 Han504105f2021-10-26 15:54:50 +0900224// Virt apex needs a custom signer for its payload
225python_binary_host {
226 name: "sign_virt_apex",
227 srcs: [
228 "sign_virt_apex.py",
229 ],
230 version: {
Jooyung Han504105f2021-10-26 15:54:50 +0900231 py3: {
Jooyung Han504105f2021-10-26 15:54:50 +0900232 embedded_launcher: true,
233 },
234 },
Jooyung Han05063d12021-10-27 01:50:51 +0900235 required: [
Shikha Panwara7605cf2023-01-12 09:29:39 +0000236 // 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 Han05063d12021-10-27 01:50:51 +0900238 "img2simg",
Shikha Panwara7605cf2023-01-12 09:29:39 +0000239 "initrd_bootconfig",
Jooyung Han05063d12021-10-27 01:50:51 +0900240 "lpmake",
241 "lpunpack",
242 "simg2img",
243 ],
Jooyung Han504105f2021-10-26 15:54:50 +0900244}
Jooyung Hand35952e2021-11-08 17:53:47 +0900245
Jooyung Han02dceed2021-11-08 17:50:22 +0900246sh_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 Shen28c79442022-11-08 14:26:13 +0000254 "fsck.erofs",
Jooyung Han02dceed2021-11-08 17:50:22 +0900255
256 // sign_virt_apex
257 "avbtool",
258 "img2simg",
Shikha Panwara7605cf2023-01-12 09:29:39 +0000259 "initrd_bootconfig",
Jooyung Han02dceed2021-11-08 17:50:22 +0900260 "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 Han6afd6672022-02-22 05:22:23 +0900278 ":test.com.android.virt.pem",
Jooyung Han02dceed2021-11-08 17:50:22 +0900279 ],
280 test_suites: ["general-tests"],
281}
282
Jooyung Han6afd6672022-02-22 05:22:23 +0900283filegroup {
284 name: "test.com.android.virt.pem",
285 srcs: ["test.com.android.virt.pem"],
286}
287
Jooyung Han1c3d2fa2022-02-24 02:35:59 +0900288filegroup {
289 name: "test2.com.android.virt.pem",
290 srcs: ["test2.com.android.virt.pem"],
291}
292
Jooyung Hand35952e2021-11-08 17:53:47 +0900293// custom tool to replace bytes in a file
294python_binary_host {
295 name: "replace_bytes",
296 srcs: [
297 "replace_bytes.py",
298 ],
299 version: {
Jooyung Hand35952e2021-11-08 17:53:47 +0900300 py3: {
Jooyung Hand35952e2021-11-08 17:53:47 +0900301 embedded_launcher: true,
302 },
303 },
304}
Nikita Ioffef28eec22022-10-18 23:17:34 +0100305
306// Encapsulate the contributions made by the com.android.virt to the bootclasspath.
307bootclasspath_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 Ioffead4c7192024-02-02 13:07:00 +0000345
346soong_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
358avf_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}