blob: f2a0d6463e1f1446c787f49b470ff8aa0418640a [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
35apex_defaults {
36 name: "com.android.virt_common",
Jiyong Parkda119cb2020-12-07 15:58:23 +090037 // TODO(jiyong): make it updatable
Mathew Inwood9af36dd2021-02-16 14:43:40 +000038 updatable: false,
Nikita Ioffec0b09612023-01-27 01:49:39 +000039 future_updatable: false,
Jiyong Parkb6c45e72021-06-22 20:24:56 +090040 platform_apis: true,
Jiyong Parkda119cb2020-12-07 15:58:23 +090041
42 manifest: "manifest.json",
43
44 key: "com.android.virt.key",
45 certificate: ":com.android.virt.certificate",
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +010046
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 Ioffef28eec22022-10-18 23:17:34 +010053
54 bootclasspath_fragments: [
55 "com.android.virt-bootclasspath-fragment",
56 ],
Nikita Ioffeb78c6202022-11-18 17:01:36 +000057 jni_libs: [
David Brazdil79588392022-10-20 17:04:46 +010058 "libvirtualizationservice_jni",
Nikita Ioffeb78c6202022-11-18 17:01:36 +000059 "libvirtualmachine_jni",
60 ],
Jooyung Han3b980eb2023-11-03 14:48:00 +090061 // 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 Ioffe50e2ebe2022-10-24 17:16:25 +010068}
69
Inseob Kim77c7f712023-11-06 17:01:02 +090070soong_config_module_type {
71 name: "avf_flag_aware_apex_defaults",
72 module_type: "apex_defaults",
73 config_namespace: "ANDROID",
Nikita Ioffe94a8a182023-11-16 16:37:48 +000074 bool_variables: [
75 "release_avf_enable_device_assignment",
76 "release_avf_enable_vendor_modules",
77 ],
78 properties: [
79 "arch",
80 "prebuilts",
81 ],
Inseob Kim77c7f712023-11-06 17:01:02 +090082}
83
84avf_flag_aware_apex_defaults {
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +010085 name: "com.android.virt_avf_enabled",
86
87 defaults: ["com.android.virt_common"],
88
Jooyung Han05063d12021-10-27 01:50:51 +090089 custom_sign_tool: "sign_virt_apex",
Jiyong Parkda119cb2020-12-07 15:58:23 +090090
Andrew Walbrandfc953d2021-06-10 13:59:56 +000091 // crosvm and virtualizationservice are only enabled for 64-bit targets on device
Jiyong Park2199f202020-12-07 15:58:47 +090092 arch: {
93 arm64: {
94 binaries: [
Jiyong Park69b39372021-01-05 23:14:46 +090095 "crosvm",
David Brazdil1f530702022-10-03 12:18:10 +010096 "virtmgr",
Andrew Walbrandfc953d2021-06-10 13:59:56 +000097 "virtualizationservice",
Jiyong Park69b39372021-01-05 23:14:46 +090098 ],
Victor Hsieh384bf6a2021-11-11 13:28:09 -080099 filesystems: microdroid_filesystem_images,
Jiyong Park69b39372021-01-05 23:14:46 +0900100 },
101 x86_64: {
102 binaries: [
Jiyong Park2199f202020-12-07 15:58:47 +0900103 "crosvm",
David Brazdil1f530702022-10-03 12:18:10 +0100104 "virtmgr",
Andrew Walbrandfc953d2021-06-10 13:59:56 +0000105 "virtualizationservice",
Jiyong Park2199f202020-12-07 15:58:47 +0900106 ],
Victor Hsieh384bf6a2021-11-11 13:28:09 -0800107 filesystems: microdroid_filesystem_images,
Jiyong Park2199f202020-12-07 15:58:47 +0900108 },
109 },
Jiyong Park8d1eb7e2021-02-16 13:23:00 +0900110 binaries: [
Victor Hsieh573c6492021-03-11 14:19:18 -0800111 "fd_server",
Andrew Walbranea9fa482021-03-04 16:11:12 +0000112 "vm",
Jiyong Park8d1eb7e2021-02-16 13:23:00 +0900113 ],
Inseob Kim72f06a32021-04-12 14:48:42 +0900114 prebuilts: [
Alan Stokes2bffe572023-11-14 01:40:45 +0000115 "com.android.virt.init.rc",
Nikita Ioffeab1754c2022-10-13 20:28:54 +0100116 "features_com.android.virt.xml",
Seungjae Yooe85831e2022-12-12 09:34:58 +0900117 "microdroid_initrd_debuggable",
Shikha Panwarf46f96b2022-08-22 14:11:14 +0000118 "microdroid_initrd_normal",
Jiyong Parke9b74d02021-06-21 14:39:12 +0900119 "microdroid.json",
Shikha Panwared8ace42022-09-28 12:52:16 +0000120 "microdroid_kernel",
Alice Wangc2fec932023-02-23 16:24:02 +0000121 "rialto_bin",
Inseob Kim72f06a32021-04-12 14:48:42 +0900122 ],
Jiyong Park17e3ed42022-08-29 17:27:00 +0900123 host_required: [
124 "vm_shell",
125 ],
Nikita Ioffeb0b67562022-11-22 15:48:06 +0000126 apps: [
127 "EmptyPayloadApp",
128 ],
Inseob Kim77c7f712023-11-06 17:01:02 +0900129 soong_config_variables: {
Nikita Ioffe94a8a182023-11-16 16:37:48 +0000130 release_avf_enable_device_assignment: {
131 prebuilts: [
132 "com.android.virt.vfio_handler.rc",
133 ],
134 arch: {
135 arm64: {
136 binaries: ["vfio_handler"],
137 },
138 x86_64: {
139 binaries: ["vfio_handler"],
140 },
141 },
142 },
Inseob Kim77c7f712023-11-06 17:01:02 +0900143 release_avf_enable_vendor_modules: {
144 prebuilts: [
145 "microdroid_gki_initrd_debuggable",
146 "microdroid_gki_initrd_normal",
147 "microdroid_gki_kernel",
Inseob Kim172f9eb2023-11-06 17:02:08 +0900148 "microdroid_gki.json",
Inseob Kim77c7f712023-11-06 17:01:02 +0900149 ],
150 },
151 },
Jiyong Parkda119cb2020-12-07 15:58:23 +0900152}
153
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +0100154apex_defaults {
155 name: "com.android.virt_avf_disabled",
156
157 defaults: ["com.android.virt_common"],
158}
159
Jiyong Parkda119cb2020-12-07 15:58:23 +0900160apex_key {
161 name: "com.android.virt.key",
162 public_key: "com.android.virt.avbpubkey",
163 private_key: "com.android.virt.pem",
164}
165
166android_app_certificate {
167 name: "com.android.virt.certificate",
168 certificate: "com.android.virt",
169}
Jeff Vander Stoep63ab2382021-03-25 22:18:53 +0100170
171prebuilt_etc {
172 name: "com.android.virt.init.rc",
Andrew Walbranf6bf6862021-05-21 12:41:13 +0000173 src: "virtualizationservice.rc",
Alan Stokes2bffe572023-11-14 01:40:45 +0000174 filename: "init.rc",
Alan Stokes3ef78d92021-09-08 11:51:06 +0100175 installable: false,
Jeff Vander Stoep63ab2382021-03-25 22:18:53 +0100176}
Jooyung Han504105f2021-10-26 15:54:50 +0900177
Nikita Ioffe94a8a182023-11-16 16:37:48 +0000178prebuilt_etc {
179 name: "com.android.virt.vfio_handler.rc",
180 src: "vfio_handler.rc",
181 filename: "vfio_handler.rc",
182 installable: false,
183}
184
Jooyung Han504105f2021-10-26 15:54:50 +0900185// Virt apex needs a custom signer for its payload
186python_binary_host {
187 name: "sign_virt_apex",
188 srcs: [
189 "sign_virt_apex.py",
190 ],
191 version: {
Jooyung Han504105f2021-10-26 15:54:50 +0900192 py3: {
Jooyung Han504105f2021-10-26 15:54:50 +0900193 embedded_launcher: true,
194 },
195 },
Jooyung Han05063d12021-10-27 01:50:51 +0900196 required: [
Shikha Panwara7605cf2023-01-12 09:29:39 +0000197 // sign_virt_apex should be runnable from outside the source tree,
198 // therefore, any required tool should be listed in build/make/core/Makefile as well.
Jooyung Han05063d12021-10-27 01:50:51 +0900199 "img2simg",
Shikha Panwara7605cf2023-01-12 09:29:39 +0000200 "initrd_bootconfig",
Jooyung Han05063d12021-10-27 01:50:51 +0900201 "lpmake",
202 "lpunpack",
203 "simg2img",
204 ],
Jooyung Han504105f2021-10-26 15:54:50 +0900205}
Jooyung Hand35952e2021-11-08 17:53:47 +0900206
Jooyung Han02dceed2021-11-08 17:50:22 +0900207sh_test_host {
208 name: "sign_virt_apex_test",
209 src: "sign_virt_apex_test.sh",
210 test_config: "sign_virt_apex_test.xml",
211 data_bins: [
212 // deapexer
213 "deapexer",
214 "debugfs_static",
Dennis Shen28c79442022-11-08 14:26:13 +0000215 "fsck.erofs",
Jooyung Han02dceed2021-11-08 17:50:22 +0900216
217 // sign_virt_apex
218 "avbtool",
219 "img2simg",
Shikha Panwara7605cf2023-01-12 09:29:39 +0000220 "initrd_bootconfig",
Jooyung Han02dceed2021-11-08 17:50:22 +0900221 "lpmake",
222 "lpunpack",
223 "sign_virt_apex",
224 "simg2img",
225 ],
226 data_libs: [
227 "libbase",
228 "libc++",
229 "libcrypto_utils",
230 "libcrypto",
231 "libext4_utils",
232 "liblog",
233 "liblp",
234 "libsparse",
235 "libz",
236 ],
237 data: [
238 ":com.android.virt",
Jooyung Han6afd6672022-02-22 05:22:23 +0900239 ":test.com.android.virt.pem",
Jooyung Han02dceed2021-11-08 17:50:22 +0900240 ],
241 test_suites: ["general-tests"],
242}
243
Jooyung Han6afd6672022-02-22 05:22:23 +0900244filegroup {
245 name: "test.com.android.virt.pem",
246 srcs: ["test.com.android.virt.pem"],
247}
248
Jooyung Han1c3d2fa2022-02-24 02:35:59 +0900249filegroup {
250 name: "test2.com.android.virt.pem",
251 srcs: ["test2.com.android.virt.pem"],
252}
253
Jooyung Hand35952e2021-11-08 17:53:47 +0900254// custom tool to replace bytes in a file
255python_binary_host {
256 name: "replace_bytes",
257 srcs: [
258 "replace_bytes.py",
259 ],
260 version: {
Jooyung Hand35952e2021-11-08 17:53:47 +0900261 py3: {
Jooyung Hand35952e2021-11-08 17:53:47 +0900262 embedded_launcher: true,
263 },
264 },
265}
Nikita Ioffef28eec22022-10-18 23:17:34 +0100266
267// Encapsulate the contributions made by the com.android.virt to the bootclasspath.
268bootclasspath_fragment {
269 name: "com.android.virt-bootclasspath-fragment",
270 contents: ["framework-virtualization"],
271 apex_available: ["com.android.virt"],
272
273 // The bootclasspath_fragments that provide APIs on which this depends.
274 fragments: [
275 {
276 apex: "com.android.art",
277 module: "art-bootclasspath-fragment",
278 },
279 ],
280
281 // Additional stubs libraries that this fragment's contents use which are
282 // not provided by another bootclasspath_fragment.
283 additional_stubs: [
284 "android-non-updatable",
285 ],
286
287 hidden_api: {
288
289 // This module does not contain any split packages.
290 split_packages: [],
291
292 // The following packages and all their subpackages currently only
293 // contain classes from this bootclasspath_fragment. Listing a package
294 // here won't prevent other bootclasspath modules from adding classes in
295 // any of those packages but it will prevent them from adding those
296 // classes into an API surface, e.g. public, system, etc.. Doing so will
297 // result in a build failure due to inconsistent flags.
298 package_prefixes: [
299 "android.system.virtualmachine",
300 "android.system.virtualizationservice",
301 // android.sysprop.*, renamed by jarjar
302 "com.android.system.virtualmachine.sysprop",
303 ],
304 },
305}