blob: e580cc2da68b060b121a22aeb6610c5a8dc88234 [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 = [
Jiyong Park09a2bda2022-06-13 16:44:45 +09006 "microdroid_boot",
Andrew Sculld6267ae2022-06-13 13:47:59 +00007 "microdroid_bootconfig_full_debuggable",
8 "microdroid_bootconfig_normal",
Andrew Sculled0fd2d2022-06-13 13:22:41 +00009 "microdroid_init_boot",
Andrew Sculld6267ae2022-06-13 13:47:59 +000010 "microdroid_super",
11 "microdroid_uboot_env",
Victor Hsieh384bf6a2021-11-11 13:28:09 -080012 "microdroid_vbmeta",
13 "microdroid_vbmeta_bootconfig",
Andrew Sculld6267ae2022-06-13 13:47:59 +000014 "microdroid_vendor_boot",
Victor Hsieh384bf6a2021-11-11 13:28:09 -080015]
16
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +010017soong_config_module_type {
18 name: "virt_apex",
19 module_type: "apex",
20 config_namespace: "ANDROID",
21 bool_variables: ["avf_enabled"],
22 properties: ["defaults"],
23}
Jiyong Parkda119cb2020-12-07 15:58:23 +090024
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +010025virt_apex {
26 name: "com.android.virt",
27 soong_config_variables: {
28 avf_enabled: {
29 defaults: ["com.android.virt_avf_enabled"],
30 conditions_default: {
31 defaults: ["com.android.virt_avf_disabled"],
32 },
33 },
34 },
35}
36
37apex_defaults {
38 name: "com.android.virt_common",
Jiyong Parkda119cb2020-12-07 15:58:23 +090039 // TODO(jiyong): make it updatable
Mathew Inwood9af36dd2021-02-16 14:43:40 +000040 updatable: false,
Jiyong Park1c8f14c2021-11-29 11:29:16 +090041 future_updatable: true,
Jiyong Parkb6c45e72021-06-22 20:24:56 +090042 platform_apis: true,
Jiyong Parkda119cb2020-12-07 15:58:23 +090043
44 manifest: "manifest.json",
45
46 key: "com.android.virt.key",
47 certificate: ":com.android.virt.certificate",
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +010048
49 apps: [
50 "android.system.virtualmachine.res",
51 ],
52
53 file_contexts: ":com.android.virt-file_contexts",
54 canned_fs_config: "canned_fs_config",
Nikita Ioffef28eec22022-10-18 23:17:34 +010055
56 bootclasspath_fragments: [
57 "com.android.virt-bootclasspath-fragment",
58 ],
Nikita Ioffeb78c6202022-11-18 17:01:36 +000059 jni_libs: [
60 "libvirtualmachine_jni",
61 ],
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +010062}
63
64apex_defaults {
65 name: "com.android.virt_avf_enabled",
66
67 defaults: ["com.android.virt_common"],
68
Jooyung Han05063d12021-10-27 01:50:51 +090069 custom_sign_tool: "sign_virt_apex",
Jiyong Parkda119cb2020-12-07 15:58:23 +090070
Andrew Walbrandfc953d2021-06-10 13:59:56 +000071 // crosvm and virtualizationservice are only enabled for 64-bit targets on device
Jiyong Park2199f202020-12-07 15:58:47 +090072 arch: {
73 arm64: {
74 binaries: [
Jiyong Park69b39372021-01-05 23:14:46 +090075 "crosvm",
Andrew Walbrandfc953d2021-06-10 13:59:56 +000076 "virtualizationservice",
Jiyong Park69b39372021-01-05 23:14:46 +090077 ],
Victor Hsieh384bf6a2021-11-11 13:28:09 -080078 filesystems: microdroid_filesystem_images,
Jiyong Park69b39372021-01-05 23:14:46 +090079 },
80 x86_64: {
81 binaries: [
Jiyong Park2199f202020-12-07 15:58:47 +090082 "crosvm",
Andrew Walbrandfc953d2021-06-10 13:59:56 +000083 "virtualizationservice",
Jiyong Park2199f202020-12-07 15:58:47 +090084 ],
Victor Hsieh384bf6a2021-11-11 13:28:09 -080085 filesystems: microdroid_filesystem_images,
Jiyong Park2199f202020-12-07 15:58:47 +090086 },
87 },
Jiyong Park8d1eb7e2021-02-16 13:23:00 +090088 binaries: [
Victor Hsieh573c6492021-03-11 14:19:18 -080089 "fd_server",
Andrew Walbranea9fa482021-03-04 16:11:12 +000090 "vm",
Jiyong Park8d1eb7e2021-02-16 13:23:00 +090091 ],
Inseob Kim72f06a32021-04-12 14:48:42 +090092 prebuilts: [
93 "com.android.virt.init.rc",
Nikita Ioffeab1754c2022-10-13 20:28:54 +010094 "features_com.android.virt.xml",
Shikha Panwarf46f96b2022-08-22 14:11:14 +000095 "microdroid_initrd_full_debuggable",
96 "microdroid_initrd_normal",
Jiyong Parke9b74d02021-06-21 14:39:12 +090097 "microdroid.json",
Inseob Kim72f06a32021-04-12 14:48:42 +090098 "microdroid_bootloader",
Jooyung Han31b1c2b2021-10-27 03:35:42 +090099 "microdroid_bootloader.avbpubkey",
Shikha Panwared8ace42022-09-28 12:52:16 +0000100 "microdroid_kernel",
Inseob Kim72f06a32021-04-12 14:48:42 +0900101 ],
Jiyong Park17e3ed42022-08-29 17:27:00 +0900102 host_required: [
103 "vm_shell",
104 ],
Nikita Ioffeb0b67562022-11-22 15:48:06 +0000105 apps: [
106 "EmptyPayloadApp",
107 ],
Jiyong Parkda119cb2020-12-07 15:58:23 +0900108}
109
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +0100110apex_defaults {
111 name: "com.android.virt_avf_disabled",
112
113 defaults: ["com.android.virt_common"],
114}
115
Jiyong Parkda119cb2020-12-07 15:58:23 +0900116apex_key {
117 name: "com.android.virt.key",
118 public_key: "com.android.virt.avbpubkey",
119 private_key: "com.android.virt.pem",
120}
121
122android_app_certificate {
123 name: "com.android.virt.certificate",
124 certificate: "com.android.virt",
125}
Jeff Vander Stoep63ab2382021-03-25 22:18:53 +0100126
127prebuilt_etc {
128 name: "com.android.virt.init.rc",
Andrew Walbranf6bf6862021-05-21 12:41:13 +0000129 src: "virtualizationservice.rc",
Jeff Vander Stoep63ab2382021-03-25 22:18:53 +0100130 filename: "init.rc",
Alan Stokes3ef78d92021-09-08 11:51:06 +0100131 installable: false,
Jeff Vander Stoep63ab2382021-03-25 22:18:53 +0100132}
Jooyung Han504105f2021-10-26 15:54:50 +0900133
134// Virt apex needs a custom signer for its payload
135python_binary_host {
136 name: "sign_virt_apex",
137 srcs: [
138 "sign_virt_apex.py",
139 ],
140 version: {
Jooyung Han504105f2021-10-26 15:54:50 +0900141 py3: {
Jooyung Han504105f2021-10-26 15:54:50 +0900142 embedded_launcher: true,
143 },
144 },
Jooyung Han05063d12021-10-27 01:50:51 +0900145 required: [
146 "img2simg",
147 "lpmake",
148 "lpunpack",
149 "simg2img",
150 ],
Jooyung Han504105f2021-10-26 15:54:50 +0900151}
Jooyung Hand35952e2021-11-08 17:53:47 +0900152
Jooyung Han02dceed2021-11-08 17:50:22 +0900153sh_test_host {
154 name: "sign_virt_apex_test",
155 src: "sign_virt_apex_test.sh",
156 test_config: "sign_virt_apex_test.xml",
157 data_bins: [
158 // deapexer
159 "deapexer",
160 "debugfs_static",
Dennis Shen28c79442022-11-08 14:26:13 +0000161 "blkid",
162 "fsck.erofs",
Jooyung Han02dceed2021-11-08 17:50:22 +0900163
164 // sign_virt_apex
165 "avbtool",
166 "img2simg",
167 "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}