blob: 596493aa01be6acf42dd233359c261740516aa74 [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 Ioffeb78c6202022-11-18 17:01:36 +000060 jni_libs: [
61 "libvirtualmachine_jni",
62 ],
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +010063}
64
65apex_defaults {
66 name: "com.android.virt_avf_enabled",
67
68 defaults: ["com.android.virt_common"],
69
Jooyung Han05063d12021-10-27 01:50:51 +090070 custom_sign_tool: "sign_virt_apex",
Jiyong Parkda119cb2020-12-07 15:58:23 +090071
Andrew Walbrandfc953d2021-06-10 13:59:56 +000072 // crosvm and virtualizationservice are only enabled for 64-bit targets on device
Jiyong Park2199f202020-12-07 15:58:47 +090073 arch: {
74 arm64: {
75 binaries: [
Jiyong Park69b39372021-01-05 23:14:46 +090076 "crosvm",
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",
Andrew Walbrandfc953d2021-06-10 13:59:56 +000084 "virtualizationservice",
Jiyong Park2199f202020-12-07 15:58:47 +090085 ],
Victor Hsieh384bf6a2021-11-11 13:28:09 -080086 filesystems: microdroid_filesystem_images,
Jiyong Park2199f202020-12-07 15:58:47 +090087 },
88 },
Jiyong Park8d1eb7e2021-02-16 13:23:00 +090089 binaries: [
Victor Hsieh573c6492021-03-11 14:19:18 -080090 "fd_server",
Andrew Walbranea9fa482021-03-04 16:11:12 +000091 "vm",
Jiyong Park8d1eb7e2021-02-16 13:23:00 +090092 ],
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 ],
Nikita Ioffeb0b67562022-11-22 15:48:06 +0000107 apps: [
108 "EmptyPayloadApp",
109 ],
Jiyong Parkda119cb2020-12-07 15:58:23 +0900110}
111
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +0100112apex_defaults {
113 name: "com.android.virt_avf_disabled",
114
115 defaults: ["com.android.virt_common"],
116}
117
Jiyong Parkda119cb2020-12-07 15:58:23 +0900118apex_key {
119 name: "com.android.virt.key",
120 public_key: "com.android.virt.avbpubkey",
121 private_key: "com.android.virt.pem",
122}
123
124android_app_certificate {
125 name: "com.android.virt.certificate",
126 certificate: "com.android.virt",
127}
Jeff Vander Stoep63ab2382021-03-25 22:18:53 +0100128
129prebuilt_etc {
130 name: "com.android.virt.init.rc",
Andrew Walbranf6bf6862021-05-21 12:41:13 +0000131 src: "virtualizationservice.rc",
Jeff Vander Stoep63ab2382021-03-25 22:18:53 +0100132 filename: "init.rc",
Alan Stokes3ef78d92021-09-08 11:51:06 +0100133 installable: false,
Jeff Vander Stoep63ab2382021-03-25 22:18:53 +0100134}
Jooyung Han504105f2021-10-26 15:54:50 +0900135
136// Virt apex needs a custom signer for its payload
137python_binary_host {
138 name: "sign_virt_apex",
139 srcs: [
140 "sign_virt_apex.py",
141 ],
142 version: {
Jooyung Han504105f2021-10-26 15:54:50 +0900143 py3: {
Jooyung Han504105f2021-10-26 15:54:50 +0900144 embedded_launcher: true,
145 },
146 },
Jooyung Han05063d12021-10-27 01:50:51 +0900147 required: [
148 "img2simg",
149 "lpmake",
150 "lpunpack",
151 "simg2img",
152 ],
Jooyung Han504105f2021-10-26 15:54:50 +0900153}
Jooyung Hand35952e2021-11-08 17:53:47 +0900154
Jooyung Han02dceed2021-11-08 17:50:22 +0900155sh_test_host {
156 name: "sign_virt_apex_test",
157 src: "sign_virt_apex_test.sh",
158 test_config: "sign_virt_apex_test.xml",
159 data_bins: [
160 // deapexer
161 "deapexer",
162 "debugfs_static",
Dennis Shen28c79442022-11-08 14:26:13 +0000163 "blkid",
164 "fsck.erofs",
Jooyung Han02dceed2021-11-08 17:50:22 +0900165
166 // sign_virt_apex
167 "avbtool",
168 "img2simg",
169 "lpmake",
170 "lpunpack",
171 "sign_virt_apex",
172 "simg2img",
173 ],
174 data_libs: [
175 "libbase",
176 "libc++",
177 "libcrypto_utils",
178 "libcrypto",
179 "libext4_utils",
180 "liblog",
181 "liblp",
182 "libsparse",
183 "libz",
184 ],
185 data: [
186 ":com.android.virt",
Jooyung Han6afd6672022-02-22 05:22:23 +0900187 ":test.com.android.virt.pem",
Jooyung Han02dceed2021-11-08 17:50:22 +0900188 ],
189 test_suites: ["general-tests"],
190}
191
Jooyung Han6afd6672022-02-22 05:22:23 +0900192filegroup {
193 name: "test.com.android.virt.pem",
194 srcs: ["test.com.android.virt.pem"],
195}
196
Jooyung Han1c3d2fa2022-02-24 02:35:59 +0900197filegroup {
198 name: "test2.com.android.virt.pem",
199 srcs: ["test2.com.android.virt.pem"],
200}
201
Jooyung Hand35952e2021-11-08 17:53:47 +0900202// custom tool to replace bytes in a file
203python_binary_host {
204 name: "replace_bytes",
205 srcs: [
206 "replace_bytes.py",
207 ],
208 version: {
Jooyung Hand35952e2021-11-08 17:53:47 +0900209 py3: {
Jooyung Hand35952e2021-11-08 17:53:47 +0900210 embedded_launcher: true,
211 },
212 },
213}
Nikita Ioffef28eec22022-10-18 23:17:34 +0100214
215// Encapsulate the contributions made by the com.android.virt to the bootclasspath.
216bootclasspath_fragment {
217 name: "com.android.virt-bootclasspath-fragment",
218 contents: ["framework-virtualization"],
219 apex_available: ["com.android.virt"],
220
221 // The bootclasspath_fragments that provide APIs on which this depends.
222 fragments: [
223 {
224 apex: "com.android.art",
225 module: "art-bootclasspath-fragment",
226 },
227 ],
228
229 // Additional stubs libraries that this fragment's contents use which are
230 // not provided by another bootclasspath_fragment.
231 additional_stubs: [
232 "android-non-updatable",
233 ],
234
235 hidden_api: {
236
237 // This module does not contain any split packages.
238 split_packages: [],
239
240 // The following packages and all their subpackages currently only
241 // contain classes from this bootclasspath_fragment. Listing a package
242 // here won't prevent other bootclasspath modules from adding classes in
243 // any of those packages but it will prevent them from adding those
244 // classes into an API surface, e.g. public, system, etc.. Doing so will
245 // result in a build failure due to inconsistent flags.
246 package_prefixes: [
247 "android.system.virtualmachine",
248 "android.system.virtualizationservice",
249 // android.sysprop.*, renamed by jarjar
250 "com.android.system.virtualmachine.sysprop",
251 ],
252 },
253}