blob: a05f7b0294bc53ea3d13b8c6006e437fd625f1fa [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 ],
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +010061}
62
Alice Wangaef79352023-10-31 15:01:15 +000063apex_defaults {
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +010064 name: "com.android.virt_avf_enabled",
65
66 defaults: ["com.android.virt_common"],
67
Jooyung Han05063d12021-10-27 01:50:51 +090068 custom_sign_tool: "sign_virt_apex",
Jiyong Parkda119cb2020-12-07 15:58:23 +090069
Andrew Walbrandfc953d2021-06-10 13:59:56 +000070 // crosvm and virtualizationservice are only enabled for 64-bit targets on device
Jiyong Park2199f202020-12-07 15:58:47 +090071 arch: {
72 arm64: {
73 binaries: [
Jiyong Park69b39372021-01-05 23:14:46 +090074 "crosvm",
Inseob Kimbdca0472023-07-28 19:20:56 +090075 "vfio_handler",
David Brazdil1f530702022-10-03 12:18:10 +010076 "virtmgr",
Andrew Walbrandfc953d2021-06-10 13:59:56 +000077 "virtualizationservice",
Jiyong Park69b39372021-01-05 23:14:46 +090078 ],
Victor Hsieh384bf6a2021-11-11 13:28:09 -080079 filesystems: microdroid_filesystem_images,
Jiyong Park69b39372021-01-05 23:14:46 +090080 },
81 x86_64: {
82 binaries: [
Jiyong Park2199f202020-12-07 15:58:47 +090083 "crosvm",
Inseob Kimbdca0472023-07-28 19:20:56 +090084 "vfio_handler",
David Brazdil1f530702022-10-03 12:18:10 +010085 "virtmgr",
Andrew Walbrandfc953d2021-06-10 13:59:56 +000086 "virtualizationservice",
Jiyong Park2199f202020-12-07 15:58:47 +090087 ],
Victor Hsieh384bf6a2021-11-11 13:28:09 -080088 filesystems: microdroid_filesystem_images,
Jiyong Park2199f202020-12-07 15:58:47 +090089 },
90 },
Jiyong Park8d1eb7e2021-02-16 13:23:00 +090091 binaries: [
Victor Hsieh573c6492021-03-11 14:19:18 -080092 "fd_server",
Andrew Walbranea9fa482021-03-04 16:11:12 +000093 "vm",
Jiyong Park8d1eb7e2021-02-16 13:23:00 +090094 ],
Inseob Kim72f06a32021-04-12 14:48:42 +090095 prebuilts: [
Alice Wangaef79352023-10-31 15:01:15 +000096 "com.android.virt.init.rc",
Nikita Ioffeab1754c2022-10-13 20:28:54 +010097 "features_com.android.virt.xml",
Seungjae Yooe85831e2022-12-12 09:34:58 +090098 "microdroid_initrd_debuggable",
Shikha Panwarf46f96b2022-08-22 14:11:14 +000099 "microdroid_initrd_normal",
Jiyong Parke9b74d02021-06-21 14:39:12 +0900100 "microdroid.json",
Shikha Panwared8ace42022-09-28 12:52:16 +0000101 "microdroid_kernel",
Alice Wangc2fec932023-02-23 16:24:02 +0000102 "rialto_bin",
Inseob Kim72f06a32021-04-12 14:48:42 +0900103 ],
Jiyong Park17e3ed42022-08-29 17:27:00 +0900104 host_required: [
105 "vm_shell",
Jakob Vukalovic70ba6332023-07-11 10:52:22 +0100106 "prepare_device_vfio",
Jiyong Park17e3ed42022-08-29 17:27:00 +0900107 ],
Nikita Ioffeb0b67562022-11-22 15:48:06 +0000108 apps: [
109 "EmptyPayloadApp",
110 ],
Jiyong Parkda119cb2020-12-07 15:58:23 +0900111}
112
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +0100113apex_defaults {
114 name: "com.android.virt_avf_disabled",
115
116 defaults: ["com.android.virt_common"],
117}
118
Jiyong Parkda119cb2020-12-07 15:58:23 +0900119apex_key {
120 name: "com.android.virt.key",
121 public_key: "com.android.virt.avbpubkey",
122 private_key: "com.android.virt.pem",
123}
124
125android_app_certificate {
126 name: "com.android.virt.certificate",
127 certificate: "com.android.virt",
128}
Jeff Vander Stoep63ab2382021-03-25 22:18:53 +0100129
130prebuilt_etc {
131 name: "com.android.virt.init.rc",
Andrew Walbranf6bf6862021-05-21 12:41:13 +0000132 src: "virtualizationservice.rc",
Alice Wangaef79352023-10-31 15:01:15 +0000133 filename: "init.rc",
Alan Stokes3ef78d92021-09-08 11:51:06 +0100134 installable: false,
Jeff Vander Stoep63ab2382021-03-25 22:18:53 +0100135}
Jooyung Han504105f2021-10-26 15:54:50 +0900136
Jakob Vukalovic70ba6332023-07-11 10:52:22 +0100137sh_binary_host {
138 name: "prepare_device_vfio",
139 src: "prepare_device_vfio.sh",
140 filename: "prepare_device_vfio.sh",
141}
142
Jooyung Han504105f2021-10-26 15:54:50 +0900143// Virt apex needs a custom signer for its payload
144python_binary_host {
145 name: "sign_virt_apex",
146 srcs: [
147 "sign_virt_apex.py",
148 ],
149 version: {
Jooyung Han504105f2021-10-26 15:54:50 +0900150 py3: {
Jooyung Han504105f2021-10-26 15:54:50 +0900151 embedded_launcher: true,
152 },
153 },
Jooyung Han05063d12021-10-27 01:50:51 +0900154 required: [
Shikha Panwara7605cf2023-01-12 09:29:39 +0000155 // sign_virt_apex should be runnable from outside the source tree,
156 // therefore, any required tool should be listed in build/make/core/Makefile as well.
Jooyung Han05063d12021-10-27 01:50:51 +0900157 "img2simg",
Shikha Panwara7605cf2023-01-12 09:29:39 +0000158 "initrd_bootconfig",
Jooyung Han05063d12021-10-27 01:50:51 +0900159 "lpmake",
160 "lpunpack",
161 "simg2img",
162 ],
Jooyung Han504105f2021-10-26 15:54:50 +0900163}
Jooyung Hand35952e2021-11-08 17:53:47 +0900164
Jooyung Han02dceed2021-11-08 17:50:22 +0900165sh_test_host {
166 name: "sign_virt_apex_test",
167 src: "sign_virt_apex_test.sh",
168 test_config: "sign_virt_apex_test.xml",
169 data_bins: [
170 // deapexer
171 "deapexer",
172 "debugfs_static",
Dennis Shen28c79442022-11-08 14:26:13 +0000173 "fsck.erofs",
Jooyung Han02dceed2021-11-08 17:50:22 +0900174
175 // sign_virt_apex
176 "avbtool",
177 "img2simg",
Shikha Panwara7605cf2023-01-12 09:29:39 +0000178 "initrd_bootconfig",
Jooyung Han02dceed2021-11-08 17:50:22 +0900179 "lpmake",
180 "lpunpack",
181 "sign_virt_apex",
182 "simg2img",
183 ],
184 data_libs: [
185 "libbase",
186 "libc++",
187 "libcrypto_utils",
188 "libcrypto",
189 "libext4_utils",
190 "liblog",
191 "liblp",
192 "libsparse",
193 "libz",
194 ],
195 data: [
196 ":com.android.virt",
Jooyung Han6afd6672022-02-22 05:22:23 +0900197 ":test.com.android.virt.pem",
Jooyung Han02dceed2021-11-08 17:50:22 +0900198 ],
199 test_suites: ["general-tests"],
200}
201
Jooyung Han6afd6672022-02-22 05:22:23 +0900202filegroup {
203 name: "test.com.android.virt.pem",
204 srcs: ["test.com.android.virt.pem"],
205}
206
Jooyung Han1c3d2fa2022-02-24 02:35:59 +0900207filegroup {
208 name: "test2.com.android.virt.pem",
209 srcs: ["test2.com.android.virt.pem"],
210}
211
Jooyung Hand35952e2021-11-08 17:53:47 +0900212// custom tool to replace bytes in a file
213python_binary_host {
214 name: "replace_bytes",
215 srcs: [
216 "replace_bytes.py",
217 ],
218 version: {
Jooyung Hand35952e2021-11-08 17:53:47 +0900219 py3: {
Jooyung Hand35952e2021-11-08 17:53:47 +0900220 embedded_launcher: true,
221 },
222 },
223}
Nikita Ioffef28eec22022-10-18 23:17:34 +0100224
225// Encapsulate the contributions made by the com.android.virt to the bootclasspath.
226bootclasspath_fragment {
227 name: "com.android.virt-bootclasspath-fragment",
228 contents: ["framework-virtualization"],
229 apex_available: ["com.android.virt"],
230
231 // The bootclasspath_fragments that provide APIs on which this depends.
232 fragments: [
233 {
234 apex: "com.android.art",
235 module: "art-bootclasspath-fragment",
236 },
237 ],
238
239 // Additional stubs libraries that this fragment's contents use which are
240 // not provided by another bootclasspath_fragment.
241 additional_stubs: [
242 "android-non-updatable",
243 ],
244
245 hidden_api: {
246
247 // This module does not contain any split packages.
248 split_packages: [],
249
250 // The following packages and all their subpackages currently only
251 // contain classes from this bootclasspath_fragment. Listing a package
252 // here won't prevent other bootclasspath modules from adding classes in
253 // any of those packages but it will prevent them from adding those
254 // classes into an API surface, e.g. public, system, etc.. Doing so will
255 // result in a build failure due to inconsistent flags.
256 package_prefixes: [
257 "android.system.virtualmachine",
258 "android.system.virtualizationservice",
259 // android.sysprop.*, renamed by jarjar
260 "com.android.system.virtualmachine.sysprop",
261 ],
262 },
263}