blob: 2d6c75716a69cda052950d857ab500e00930800e [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_app_debuggable",
8 "microdroid_bootconfig_full_debuggable",
9 "microdroid_bootconfig_normal",
Andrew Sculled0fd2d2022-06-13 13:22:41 +000010 "microdroid_init_boot",
Andrew Sculld6267ae2022-06-13 13:47:59 +000011 "microdroid_super",
12 "microdroid_uboot_env",
Victor Hsieh384bf6a2021-11-11 13:28:09 -080013 "microdroid_vbmeta",
14 "microdroid_vbmeta_bootconfig",
Andrew Sculld6267ae2022-06-13 13:47:59 +000015 "microdroid_vendor_boot",
Victor Hsieh384bf6a2021-11-11 13:28:09 -080016]
17
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +010018soong_config_module_type {
19 name: "virt_apex",
20 module_type: "apex",
21 config_namespace: "ANDROID",
22 bool_variables: ["avf_enabled"],
23 properties: ["defaults"],
24}
Jiyong Parkda119cb2020-12-07 15:58:23 +090025
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +010026virt_apex {
27 name: "com.android.virt",
28 soong_config_variables: {
29 avf_enabled: {
30 defaults: ["com.android.virt_avf_enabled"],
31 conditions_default: {
32 defaults: ["com.android.virt_avf_disabled"],
33 },
34 },
35 },
36}
37
38apex_defaults {
39 name: "com.android.virt_common",
Jiyong Parkda119cb2020-12-07 15:58:23 +090040 // TODO(jiyong): make it updatable
Mathew Inwood9af36dd2021-02-16 14:43:40 +000041 updatable: false,
Jiyong Park1c8f14c2021-11-29 11:29:16 +090042 future_updatable: true,
Jiyong Parkb6c45e72021-06-22 20:24:56 +090043 platform_apis: true,
Jiyong Parkda119cb2020-12-07 15:58:23 +090044
45 manifest: "manifest.json",
46
47 key: "com.android.virt.key",
48 certificate: ":com.android.virt.certificate",
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +010049
50 apps: [
51 "android.system.virtualmachine.res",
52 ],
53
54 file_contexts: ":com.android.virt-file_contexts",
55 canned_fs_config: "canned_fs_config",
Nikita Ioffef28eec22022-10-18 23:17:34 +010056
57 bootclasspath_fragments: [
58 "com.android.virt-bootclasspath-fragment",
59 ],
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +010060}
61
62apex_defaults {
63 name: "com.android.virt_avf_enabled",
64
65 defaults: ["com.android.virt_common"],
66
Jooyung Han05063d12021-10-27 01:50:51 +090067 custom_sign_tool: "sign_virt_apex",
Jiyong Parkda119cb2020-12-07 15:58:23 +090068
Andrew Walbrandfc953d2021-06-10 13:59:56 +000069 // crosvm and virtualizationservice are only enabled for 64-bit targets on device
Jiyong Park2199f202020-12-07 15:58:47 +090070 arch: {
71 arm64: {
72 binaries: [
Jiyong Park69b39372021-01-05 23:14:46 +090073 "crosvm",
Andrew Walbrandfc953d2021-06-10 13:59:56 +000074 "virtualizationservice",
Jiyong Park69b39372021-01-05 23:14:46 +090075 ],
Victor Hsieh384bf6a2021-11-11 13:28:09 -080076 filesystems: microdroid_filesystem_images,
Jiyong Park69b39372021-01-05 23:14:46 +090077 },
78 x86_64: {
79 binaries: [
Jiyong Park2199f202020-12-07 15:58:47 +090080 "crosvm",
Andrew Walbrandfc953d2021-06-10 13:59:56 +000081 "virtualizationservice",
Jiyong Park2199f202020-12-07 15:58:47 +090082 ],
Victor Hsieh384bf6a2021-11-11 13:28:09 -080083 filesystems: microdroid_filesystem_images,
Jiyong Park2199f202020-12-07 15:58:47 +090084 },
85 },
Jiyong Park8d1eb7e2021-02-16 13:23:00 +090086 binaries: [
Victor Hsieh573c6492021-03-11 14:19:18 -080087 "fd_server",
Andrew Walbranea9fa482021-03-04 16:11:12 +000088 "vm",
Jiyong Park8d1eb7e2021-02-16 13:23:00 +090089 ],
Inseob Kimaa41e0a2021-08-31 10:00:42 +090090 jni_libs: [
91 "libvirtualmachine_jni",
92 ],
Inseob Kim72f06a32021-04-12 14:48:42 +090093 prebuilts: [
94 "com.android.virt.init.rc",
Nikita Ioffeab1754c2022-10-13 20:28:54 +010095 "features_com.android.virt.xml",
Shikha Panwarf46f96b2022-08-22 14:11:14 +000096 "microdroid_initrd_app_debuggable",
97 "microdroid_initrd_full_debuggable",
98 "microdroid_initrd_normal",
Jiyong Parke9b74d02021-06-21 14:39:12 +090099 "microdroid.json",
Inseob Kim72f06a32021-04-12 14:48:42 +0900100 "microdroid_bootloader",
Jooyung Han31b1c2b2021-10-27 03:35:42 +0900101 "microdroid_bootloader.avbpubkey",
Shikha Panwared8ace42022-09-28 12:52:16 +0000102 "microdroid_kernel",
Inseob Kim72f06a32021-04-12 14:48:42 +0900103 ],
Jiyong Park17e3ed42022-08-29 17:27:00 +0900104 host_required: [
105 "vm_shell",
106 ],
Jiyong Parkda119cb2020-12-07 15:58:23 +0900107}
108
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +0100109apex_defaults {
110 name: "com.android.virt_avf_disabled",
111
112 defaults: ["com.android.virt_common"],
113}
114
Jiyong Parkda119cb2020-12-07 15:58:23 +0900115apex_key {
116 name: "com.android.virt.key",
117 public_key: "com.android.virt.avbpubkey",
118 private_key: "com.android.virt.pem",
119}
120
121android_app_certificate {
122 name: "com.android.virt.certificate",
123 certificate: "com.android.virt",
124}
Jeff Vander Stoep63ab2382021-03-25 22:18:53 +0100125
126prebuilt_etc {
127 name: "com.android.virt.init.rc",
Andrew Walbranf6bf6862021-05-21 12:41:13 +0000128 src: "virtualizationservice.rc",
Jeff Vander Stoep63ab2382021-03-25 22:18:53 +0100129 filename: "init.rc",
Alan Stokes3ef78d92021-09-08 11:51:06 +0100130 installable: false,
Jeff Vander Stoep63ab2382021-03-25 22:18:53 +0100131}
Jooyung Han504105f2021-10-26 15:54:50 +0900132
133// Virt apex needs a custom signer for its payload
134python_binary_host {
135 name: "sign_virt_apex",
136 srcs: [
137 "sign_virt_apex.py",
138 ],
139 version: {
Jooyung Han504105f2021-10-26 15:54:50 +0900140 py3: {
Jooyung Han504105f2021-10-26 15:54:50 +0900141 embedded_launcher: true,
142 },
143 },
Jooyung Han05063d12021-10-27 01:50:51 +0900144 required: [
145 "img2simg",
146 "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",
166 "lpmake",
167 "lpunpack",
168 "sign_virt_apex",
169 "simg2img",
170 ],
171 data_libs: [
172 "libbase",
173 "libc++",
174 "libcrypto_utils",
175 "libcrypto",
176 "libext4_utils",
177 "liblog",
178 "liblp",
179 "libsparse",
180 "libz",
181 ],
182 data: [
183 ":com.android.virt",
Jooyung Han6afd6672022-02-22 05:22:23 +0900184 ":test.com.android.virt.pem",
Jooyung Han02dceed2021-11-08 17:50:22 +0900185 ],
186 test_suites: ["general-tests"],
187}
188
Jooyung Han6afd6672022-02-22 05:22:23 +0900189filegroup {
190 name: "test.com.android.virt.pem",
191 srcs: ["test.com.android.virt.pem"],
192}
193
Jooyung Han1c3d2fa2022-02-24 02:35:59 +0900194filegroup {
195 name: "test2.com.android.virt.pem",
196 srcs: ["test2.com.android.virt.pem"],
197}
198
Jooyung Hand35952e2021-11-08 17:53:47 +0900199// custom tool to replace bytes in a file
200python_binary_host {
201 name: "replace_bytes",
202 srcs: [
203 "replace_bytes.py",
204 ],
205 version: {
Jooyung Hand35952e2021-11-08 17:53:47 +0900206 py3: {
Jooyung Hand35952e2021-11-08 17:53:47 +0900207 embedded_launcher: true,
208 },
209 },
210}
Nikita Ioffef28eec22022-10-18 23:17:34 +0100211
212// Encapsulate the contributions made by the com.android.virt to the bootclasspath.
213bootclasspath_fragment {
214 name: "com.android.virt-bootclasspath-fragment",
215 contents: ["framework-virtualization"],
216 apex_available: ["com.android.virt"],
217
218 // The bootclasspath_fragments that provide APIs on which this depends.
219 fragments: [
220 {
221 apex: "com.android.art",
222 module: "art-bootclasspath-fragment",
223 },
224 ],
225
226 // Additional stubs libraries that this fragment's contents use which are
227 // not provided by another bootclasspath_fragment.
228 additional_stubs: [
229 "android-non-updatable",
230 ],
231
232 hidden_api: {
233
234 // This module does not contain any split packages.
235 split_packages: [],
236
237 // The following packages and all their subpackages currently only
238 // contain classes from this bootclasspath_fragment. Listing a package
239 // here won't prevent other bootclasspath modules from adding classes in
240 // any of those packages but it will prevent them from adding those
241 // classes into an API surface, e.g. public, system, etc.. Doing so will
242 // result in a build failure due to inconsistent flags.
243 package_prefixes: [
244 "android.system.virtualmachine",
245 "android.system.virtualizationservice",
246 // android.sysprop.*, renamed by jarjar
247 "com.android.system.virtualmachine.sysprop",
248 ],
249 },
250}