blob: 765372a31b7f0f622b41b582923b2bb7d67b934f [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",
16 "avf_kernel_modules_enabled",
17 ],
18 properties: [
19 "defaults",
20 "prebuilts",
21 ],
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +010022}
Jiyong Parkda119cb2020-12-07 15:58:23 +090023
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +010024virt_apex {
25 name: "com.android.virt",
26 soong_config_variables: {
27 avf_enabled: {
28 defaults: ["com.android.virt_avf_enabled"],
29 conditions_default: {
30 defaults: ["com.android.virt_avf_disabled"],
31 },
32 },
Nikita Ioffeadb33932023-06-07 14:33:56 +010033 avf_kernel_modules_enabled: {
34 prebuilts: ["microdroid_kernel_with_modules"],
35 },
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +010036 },
37}
38
39apex_defaults {
40 name: "com.android.virt_common",
Jiyong Parkda119cb2020-12-07 15:58:23 +090041 // TODO(jiyong): make it updatable
Mathew Inwood9af36dd2021-02-16 14:43:40 +000042 updatable: false,
Nikita Ioffec0b09612023-01-27 01:49:39 +000043 future_updatable: false,
Jiyong Parkb6c45e72021-06-22 20:24:56 +090044 platform_apis: true,
Jiyong Parkda119cb2020-12-07 15:58:23 +090045
46 manifest: "manifest.json",
47
48 key: "com.android.virt.key",
49 certificate: ":com.android.virt.certificate",
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +010050
51 apps: [
52 "android.system.virtualmachine.res",
53 ],
54
55 file_contexts: ":com.android.virt-file_contexts",
56 canned_fs_config: "canned_fs_config",
Nikita Ioffef28eec22022-10-18 23:17:34 +010057
58 bootclasspath_fragments: [
59 "com.android.virt-bootclasspath-fragment",
60 ],
Nikita Ioffeb78c6202022-11-18 17:01:36 +000061 jni_libs: [
David Brazdil79588392022-10-20 17:04:46 +010062 "libvirtualizationservice_jni",
Nikita Ioffeb78c6202022-11-18 17:01:36 +000063 "libvirtualmachine_jni",
64 ],
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +010065}
66
67apex_defaults {
68 name: "com.android.virt_avf_enabled",
69
70 defaults: ["com.android.virt_common"],
71
Jooyung Han05063d12021-10-27 01:50:51 +090072 custom_sign_tool: "sign_virt_apex",
Jiyong Parkda119cb2020-12-07 15:58:23 +090073
Andrew Walbrandfc953d2021-06-10 13:59:56 +000074 // crosvm and virtualizationservice are only enabled for 64-bit targets on device
Jiyong Park2199f202020-12-07 15:58:47 +090075 arch: {
76 arm64: {
77 binaries: [
Jiyong Park69b39372021-01-05 23:14:46 +090078 "crosvm",
Inseob Kimbdca0472023-07-28 19:20:56 +090079 "vfio_handler",
David Brazdil1f530702022-10-03 12:18:10 +010080 "virtmgr",
Andrew Walbrandfc953d2021-06-10 13:59:56 +000081 "virtualizationservice",
Jiyong Park69b39372021-01-05 23:14:46 +090082 ],
Victor Hsieh384bf6a2021-11-11 13:28:09 -080083 filesystems: microdroid_filesystem_images,
Jiyong Park69b39372021-01-05 23:14:46 +090084 },
85 x86_64: {
86 binaries: [
Jiyong Park2199f202020-12-07 15:58:47 +090087 "crosvm",
Inseob Kimbdca0472023-07-28 19:20:56 +090088 "vfio_handler",
David Brazdil1f530702022-10-03 12:18:10 +010089 "virtmgr",
Andrew Walbrandfc953d2021-06-10 13:59:56 +000090 "virtualizationservice",
Jiyong Park2199f202020-12-07 15:58:47 +090091 ],
Victor Hsieh384bf6a2021-11-11 13:28:09 -080092 filesystems: microdroid_filesystem_images,
Jiyong Park2199f202020-12-07 15:58:47 +090093 },
94 },
Jiyong Park8d1eb7e2021-02-16 13:23:00 +090095 binaries: [
Victor Hsieh573c6492021-03-11 14:19:18 -080096 "fd_server",
Andrew Walbranea9fa482021-03-04 16:11:12 +000097 "vm",
Jiyong Park8d1eb7e2021-02-16 13:23:00 +090098 ],
Inseob Kim72f06a32021-04-12 14:48:42 +090099 prebuilts: [
100 "com.android.virt.init.rc",
Nikita Ioffeab1754c2022-10-13 20:28:54 +0100101 "features_com.android.virt.xml",
Seungjae Yooe85831e2022-12-12 09:34:58 +0900102 "microdroid_initrd_debuggable",
Shikha Panwarf46f96b2022-08-22 14:11:14 +0000103 "microdroid_initrd_normal",
Jiyong Parke9b74d02021-06-21 14:39:12 +0900104 "microdroid.json",
Shikha Panwared8ace42022-09-28 12:52:16 +0000105 "microdroid_kernel",
Alice Wangc2fec932023-02-23 16:24:02 +0000106 // rialto_bin is a prebuilt target wrapping the signed bare-metal service VM.
107 "rialto_bin",
Inseob Kim72f06a32021-04-12 14:48:42 +0900108 ],
Jiyong Park17e3ed42022-08-29 17:27:00 +0900109 host_required: [
110 "vm_shell",
Jakob Vukalovic70ba6332023-07-11 10:52:22 +0100111 "prepare_device_vfio",
Jiyong Park17e3ed42022-08-29 17:27:00 +0900112 ],
Nikita Ioffeb0b67562022-11-22 15:48:06 +0000113 apps: [
114 "EmptyPayloadApp",
115 ],
Jiyong Parkda119cb2020-12-07 15:58:23 +0900116}
117
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +0100118apex_defaults {
119 name: "com.android.virt_avf_disabled",
120
121 defaults: ["com.android.virt_common"],
122}
123
Jiyong Parkda119cb2020-12-07 15:58:23 +0900124apex_key {
125 name: "com.android.virt.key",
126 public_key: "com.android.virt.avbpubkey",
127 private_key: "com.android.virt.pem",
128}
129
130android_app_certificate {
131 name: "com.android.virt.certificate",
132 certificate: "com.android.virt",
133}
Jeff Vander Stoep63ab2382021-03-25 22:18:53 +0100134
135prebuilt_etc {
136 name: "com.android.virt.init.rc",
Andrew Walbranf6bf6862021-05-21 12:41:13 +0000137 src: "virtualizationservice.rc",
Jeff Vander Stoep63ab2382021-03-25 22:18:53 +0100138 filename: "init.rc",
Alan Stokes3ef78d92021-09-08 11:51:06 +0100139 installable: false,
Jeff Vander Stoep63ab2382021-03-25 22:18:53 +0100140}
Jooyung Han504105f2021-10-26 15:54:50 +0900141
Jakob Vukalovic70ba6332023-07-11 10:52:22 +0100142sh_binary_host {
143 name: "prepare_device_vfio",
144 src: "prepare_device_vfio.sh",
145 filename: "prepare_device_vfio.sh",
146}
147
Jooyung Han504105f2021-10-26 15:54:50 +0900148// Virt apex needs a custom signer for its payload
149python_binary_host {
150 name: "sign_virt_apex",
151 srcs: [
152 "sign_virt_apex.py",
153 ],
154 version: {
Jooyung Han504105f2021-10-26 15:54:50 +0900155 py3: {
Jooyung Han504105f2021-10-26 15:54:50 +0900156 embedded_launcher: true,
157 },
158 },
Jooyung Han05063d12021-10-27 01:50:51 +0900159 required: [
Shikha Panwara7605cf2023-01-12 09:29:39 +0000160 // sign_virt_apex should be runnable from outside the source tree,
161 // therefore, any required tool should be listed in build/make/core/Makefile as well.
Jooyung Han05063d12021-10-27 01:50:51 +0900162 "img2simg",
Shikha Panwara7605cf2023-01-12 09:29:39 +0000163 "initrd_bootconfig",
Jooyung Han05063d12021-10-27 01:50:51 +0900164 "lpmake",
165 "lpunpack",
166 "simg2img",
167 ],
Jooyung Han504105f2021-10-26 15:54:50 +0900168}
Jooyung Hand35952e2021-11-08 17:53:47 +0900169
Jooyung Han02dceed2021-11-08 17:50:22 +0900170sh_test_host {
171 name: "sign_virt_apex_test",
172 src: "sign_virt_apex_test.sh",
173 test_config: "sign_virt_apex_test.xml",
174 data_bins: [
175 // deapexer
176 "deapexer",
177 "debugfs_static",
Dennis Shen28c79442022-11-08 14:26:13 +0000178 "fsck.erofs",
Jooyung Han02dceed2021-11-08 17:50:22 +0900179
180 // sign_virt_apex
181 "avbtool",
182 "img2simg",
Shikha Panwara7605cf2023-01-12 09:29:39 +0000183 "initrd_bootconfig",
Jooyung Han02dceed2021-11-08 17:50:22 +0900184 "lpmake",
185 "lpunpack",
186 "sign_virt_apex",
187 "simg2img",
188 ],
189 data_libs: [
190 "libbase",
191 "libc++",
192 "libcrypto_utils",
193 "libcrypto",
194 "libext4_utils",
195 "liblog",
196 "liblp",
197 "libsparse",
198 "libz",
199 ],
200 data: [
201 ":com.android.virt",
Jooyung Han6afd6672022-02-22 05:22:23 +0900202 ":test.com.android.virt.pem",
Jooyung Han02dceed2021-11-08 17:50:22 +0900203 ],
204 test_suites: ["general-tests"],
205}
206
Jooyung Han6afd6672022-02-22 05:22:23 +0900207filegroup {
208 name: "test.com.android.virt.pem",
209 srcs: ["test.com.android.virt.pem"],
210}
211
Jooyung Han1c3d2fa2022-02-24 02:35:59 +0900212filegroup {
213 name: "test2.com.android.virt.pem",
214 srcs: ["test2.com.android.virt.pem"],
215}
216
Jooyung Hand35952e2021-11-08 17:53:47 +0900217// custom tool to replace bytes in a file
218python_binary_host {
219 name: "replace_bytes",
220 srcs: [
221 "replace_bytes.py",
222 ],
223 version: {
Jooyung Hand35952e2021-11-08 17:53:47 +0900224 py3: {
Jooyung Hand35952e2021-11-08 17:53:47 +0900225 embedded_launcher: true,
226 },
227 },
228}
Nikita Ioffef28eec22022-10-18 23:17:34 +0100229
230// Encapsulate the contributions made by the com.android.virt to the bootclasspath.
231bootclasspath_fragment {
232 name: "com.android.virt-bootclasspath-fragment",
233 contents: ["framework-virtualization"],
234 apex_available: ["com.android.virt"],
235
236 // The bootclasspath_fragments that provide APIs on which this depends.
237 fragments: [
238 {
239 apex: "com.android.art",
240 module: "art-bootclasspath-fragment",
241 },
242 ],
243
244 // Additional stubs libraries that this fragment's contents use which are
245 // not provided by another bootclasspath_fragment.
246 additional_stubs: [
247 "android-non-updatable",
248 ],
249
250 hidden_api: {
251
252 // This module does not contain any split packages.
253 split_packages: [],
254
255 // The following packages and all their subpackages currently only
256 // contain classes from this bootclasspath_fragment. Listing a package
257 // here won't prevent other bootclasspath modules from adding classes in
258 // any of those packages but it will prevent them from adding those
259 // classes into an API surface, e.g. public, system, etc.. Doing so will
260 // result in a build failure due to inconsistent flags.
261 package_prefixes: [
262 "android.system.virtualmachine",
263 "android.system.virtualizationservice",
264 // android.sysprop.*, renamed by jarjar
265 "com.android.system.virtualmachine.sysprop",
266 ],
267 },
268}