blob: 1c4d357cf8525afb35b0520550f5355bd4c000bf [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",
14 bool_variables: ["avf_enabled"],
15 properties: ["defaults"],
16}
Jiyong Parkda119cb2020-12-07 15:58:23 +090017
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +010018virt_apex {
19 name: "com.android.virt",
20 soong_config_variables: {
21 avf_enabled: {
22 defaults: ["com.android.virt_avf_enabled"],
23 conditions_default: {
24 defaults: ["com.android.virt_avf_disabled"],
25 },
26 },
27 },
28}
29
30apex_defaults {
31 name: "com.android.virt_common",
Jiyong Parkda119cb2020-12-07 15:58:23 +090032 // TODO(jiyong): make it updatable
Mathew Inwood9af36dd2021-02-16 14:43:40 +000033 updatable: false,
Nikita Ioffec0b09612023-01-27 01:49:39 +000034 future_updatable: false,
Jiyong Parkb6c45e72021-06-22 20:24:56 +090035 platform_apis: true,
Jiyong Parkda119cb2020-12-07 15:58:23 +090036
37 manifest: "manifest.json",
38
39 key: "com.android.virt.key",
40 certificate: ":com.android.virt.certificate",
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +010041
42 apps: [
43 "android.system.virtualmachine.res",
44 ],
45
46 file_contexts: ":com.android.virt-file_contexts",
47 canned_fs_config: "canned_fs_config",
Nikita Ioffef28eec22022-10-18 23:17:34 +010048
49 bootclasspath_fragments: [
50 "com.android.virt-bootclasspath-fragment",
51 ],
Nikita Ioffeb78c6202022-11-18 17:01:36 +000052 jni_libs: [
David Brazdil79588392022-10-20 17:04:46 +010053 "libvirtualizationservice_jni",
Nikita Ioffeb78c6202022-11-18 17:01:36 +000054 "libvirtualmachine_jni",
55 ],
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +010056}
57
58apex_defaults {
59 name: "com.android.virt_avf_enabled",
60
61 defaults: ["com.android.virt_common"],
62
Jooyung Han05063d12021-10-27 01:50:51 +090063 custom_sign_tool: "sign_virt_apex",
Jiyong Parkda119cb2020-12-07 15:58:23 +090064
Andrew Walbrandfc953d2021-06-10 13:59:56 +000065 // crosvm and virtualizationservice are only enabled for 64-bit targets on device
Jiyong Park2199f202020-12-07 15:58:47 +090066 arch: {
67 arm64: {
68 binaries: [
Jiyong Park69b39372021-01-05 23:14:46 +090069 "crosvm",
David Brazdil1f530702022-10-03 12:18:10 +010070 "virtmgr",
Andrew Walbrandfc953d2021-06-10 13:59:56 +000071 "virtualizationservice",
Jiyong Park69b39372021-01-05 23:14:46 +090072 ],
Victor Hsieh384bf6a2021-11-11 13:28:09 -080073 filesystems: microdroid_filesystem_images,
Jiyong Park69b39372021-01-05 23:14:46 +090074 },
75 x86_64: {
76 binaries: [
Jiyong Park2199f202020-12-07 15:58:47 +090077 "crosvm",
David Brazdil1f530702022-10-03 12:18:10 +010078 "virtmgr",
Andrew Walbrandfc953d2021-06-10 13:59:56 +000079 "virtualizationservice",
Jiyong Park2199f202020-12-07 15:58:47 +090080 ],
Victor Hsieh384bf6a2021-11-11 13:28:09 -080081 filesystems: microdroid_filesystem_images,
Jiyong Park2199f202020-12-07 15:58:47 +090082 },
83 },
Jiyong Park8d1eb7e2021-02-16 13:23:00 +090084 binaries: [
Victor Hsieh573c6492021-03-11 14:19:18 -080085 "fd_server",
Andrew Walbranea9fa482021-03-04 16:11:12 +000086 "vm",
Jiyong Park8d1eb7e2021-02-16 13:23:00 +090087 ],
Inseob Kim72f06a32021-04-12 14:48:42 +090088 prebuilts: [
89 "com.android.virt.init.rc",
Nikita Ioffeab1754c2022-10-13 20:28:54 +010090 "features_com.android.virt.xml",
Seungjae Yooe85831e2022-12-12 09:34:58 +090091 "microdroid_initrd_debuggable",
Shikha Panwarf46f96b2022-08-22 14:11:14 +000092 "microdroid_initrd_normal",
Jiyong Parke9b74d02021-06-21 14:39:12 +090093 "microdroid.json",
Shikha Panwared8ace42022-09-28 12:52:16 +000094 "microdroid_kernel",
Alice Wangc2fec932023-02-23 16:24:02 +000095 // rialto_bin is a prebuilt target wrapping the signed bare-metal service VM.
96 "rialto_bin",
Inseob Kim72f06a32021-04-12 14:48:42 +090097 ],
Jiyong Park17e3ed42022-08-29 17:27:00 +090098 host_required: [
99 "vm_shell",
100 ],
Nikita Ioffeb0b67562022-11-22 15:48:06 +0000101 apps: [
102 "EmptyPayloadApp",
103 ],
Jiyong Parkda119cb2020-12-07 15:58:23 +0900104}
105
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +0100106apex_defaults {
107 name: "com.android.virt_avf_disabled",
108
109 defaults: ["com.android.virt_common"],
110}
111
Jiyong Parkda119cb2020-12-07 15:58:23 +0900112apex_key {
113 name: "com.android.virt.key",
114 public_key: "com.android.virt.avbpubkey",
115 private_key: "com.android.virt.pem",
116}
117
118android_app_certificate {
119 name: "com.android.virt.certificate",
120 certificate: "com.android.virt",
121}
Jeff Vander Stoep63ab2382021-03-25 22:18:53 +0100122
123prebuilt_etc {
124 name: "com.android.virt.init.rc",
Andrew Walbranf6bf6862021-05-21 12:41:13 +0000125 src: "virtualizationservice.rc",
Jeff Vander Stoep63ab2382021-03-25 22:18:53 +0100126 filename: "init.rc",
Alan Stokes3ef78d92021-09-08 11:51:06 +0100127 installable: false,
Jeff Vander Stoep63ab2382021-03-25 22:18:53 +0100128}
Jooyung Han504105f2021-10-26 15:54:50 +0900129
130// Virt apex needs a custom signer for its payload
131python_binary_host {
132 name: "sign_virt_apex",
133 srcs: [
134 "sign_virt_apex.py",
135 ],
136 version: {
Jooyung Han504105f2021-10-26 15:54:50 +0900137 py3: {
Jooyung Han504105f2021-10-26 15:54:50 +0900138 embedded_launcher: true,
139 },
140 },
Jooyung Han05063d12021-10-27 01:50:51 +0900141 required: [
Shikha Panwara7605cf2023-01-12 09:29:39 +0000142 // sign_virt_apex should be runnable from outside the source tree,
143 // therefore, any required tool should be listed in build/make/core/Makefile as well.
Jooyung Han05063d12021-10-27 01:50:51 +0900144 "img2simg",
Shikha Panwara7605cf2023-01-12 09:29:39 +0000145 "initrd_bootconfig",
Jooyung Han05063d12021-10-27 01:50:51 +0900146 "lpmake",
147 "lpunpack",
148 "simg2img",
149 ],
Jooyung Han504105f2021-10-26 15:54:50 +0900150}
Jooyung Hand35952e2021-11-08 17:53:47 +0900151
Jooyung Han02dceed2021-11-08 17:50:22 +0900152sh_test_host {
153 name: "sign_virt_apex_test",
154 src: "sign_virt_apex_test.sh",
155 test_config: "sign_virt_apex_test.xml",
156 data_bins: [
157 // deapexer
158 "deapexer",
159 "debugfs_static",
Dennis Shen28c79442022-11-08 14:26:13 +0000160 "blkid",
161 "fsck.erofs",
Jooyung Han02dceed2021-11-08 17:50:22 +0900162
163 // sign_virt_apex
164 "avbtool",
165 "img2simg",
Shikha Panwara7605cf2023-01-12 09:29:39 +0000166 "initrd_bootconfig",
Jooyung Han02dceed2021-11-08 17:50:22 +0900167 "lpmake",
168 "lpunpack",
169 "sign_virt_apex",
170 "simg2img",
171 ],
172 data_libs: [
173 "libbase",
174 "libc++",
175 "libcrypto_utils",
176 "libcrypto",
177 "libext4_utils",
178 "liblog",
179 "liblp",
180 "libsparse",
181 "libz",
182 ],
183 data: [
184 ":com.android.virt",
Jooyung Han6afd6672022-02-22 05:22:23 +0900185 ":test.com.android.virt.pem",
Jooyung Han02dceed2021-11-08 17:50:22 +0900186 ],
187 test_suites: ["general-tests"],
188}
189
Jooyung Han6afd6672022-02-22 05:22:23 +0900190filegroup {
191 name: "test.com.android.virt.pem",
192 srcs: ["test.com.android.virt.pem"],
193}
194
Jooyung Han1c3d2fa2022-02-24 02:35:59 +0900195filegroup {
196 name: "test2.com.android.virt.pem",
197 srcs: ["test2.com.android.virt.pem"],
198}
199
Jooyung Hand35952e2021-11-08 17:53:47 +0900200// custom tool to replace bytes in a file
201python_binary_host {
202 name: "replace_bytes",
203 srcs: [
204 "replace_bytes.py",
205 ],
206 version: {
Jooyung Hand35952e2021-11-08 17:53:47 +0900207 py3: {
Jooyung Hand35952e2021-11-08 17:53:47 +0900208 embedded_launcher: true,
209 },
210 },
211}
Nikita Ioffef28eec22022-10-18 23:17:34 +0100212
213// Encapsulate the contributions made by the com.android.virt to the bootclasspath.
214bootclasspath_fragment {
215 name: "com.android.virt-bootclasspath-fragment",
216 contents: ["framework-virtualization"],
217 apex_available: ["com.android.virt"],
218
219 // The bootclasspath_fragments that provide APIs on which this depends.
220 fragments: [
221 {
222 apex: "com.android.art",
223 module: "art-bootclasspath-fragment",
224 },
225 ],
226
227 // Additional stubs libraries that this fragment's contents use which are
228 // not provided by another bootclasspath_fragment.
229 additional_stubs: [
230 "android-non-updatable",
231 ],
232
233 hidden_api: {
234
235 // This module does not contain any split packages.
236 split_packages: [],
237
238 // The following packages and all their subpackages currently only
239 // contain classes from this bootclasspath_fragment. Listing a package
240 // here won't prevent other bootclasspath modules from adding classes in
241 // any of those packages but it will prevent them from adding those
242 // classes into an API surface, e.g. public, system, etc.. Doing so will
243 // result in a build failure due to inconsistent flags.
244 package_prefixes: [
245 "android.system.virtualmachine",
246 "android.system.virtualizationservice",
247 // android.sysprop.*, renamed by jarjar
248 "com.android.system.virtualmachine.sysprop",
249 ],
250 },
251}