blob: e39b45967b45865fbdd74200268d2c6efecd425f [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",
Inseob Kim72f06a32021-04-12 14:48:42 +090095 ],
Jiyong Park17e3ed42022-08-29 17:27:00 +090096 host_required: [
97 "vm_shell",
98 ],
Nikita Ioffeb0b67562022-11-22 15:48:06 +000099 apps: [
100 "EmptyPayloadApp",
101 ],
Jiyong Parkda119cb2020-12-07 15:58:23 +0900102}
103
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +0100104apex_defaults {
105 name: "com.android.virt_avf_disabled",
106
107 defaults: ["com.android.virt_common"],
108}
109
Jiyong Parkda119cb2020-12-07 15:58:23 +0900110apex_key {
111 name: "com.android.virt.key",
112 public_key: "com.android.virt.avbpubkey",
113 private_key: "com.android.virt.pem",
114}
115
116android_app_certificate {
117 name: "com.android.virt.certificate",
118 certificate: "com.android.virt",
119}
Jeff Vander Stoep63ab2382021-03-25 22:18:53 +0100120
121prebuilt_etc {
122 name: "com.android.virt.init.rc",
Andrew Walbranf6bf6862021-05-21 12:41:13 +0000123 src: "virtualizationservice.rc",
Jeff Vander Stoep63ab2382021-03-25 22:18:53 +0100124 filename: "init.rc",
Alan Stokes3ef78d92021-09-08 11:51:06 +0100125 installable: false,
Jeff Vander Stoep63ab2382021-03-25 22:18:53 +0100126}
Jooyung Han504105f2021-10-26 15:54:50 +0900127
128// Virt apex needs a custom signer for its payload
129python_binary_host {
130 name: "sign_virt_apex",
131 srcs: [
132 "sign_virt_apex.py",
133 ],
134 version: {
Jooyung Han504105f2021-10-26 15:54:50 +0900135 py3: {
Jooyung Han504105f2021-10-26 15:54:50 +0900136 embedded_launcher: true,
137 },
138 },
Jooyung Han05063d12021-10-27 01:50:51 +0900139 required: [
Shikha Panwara7605cf2023-01-12 09:29:39 +0000140 // sign_virt_apex should be runnable from outside the source tree,
141 // therefore, any required tool should be listed in build/make/core/Makefile as well.
Jooyung Han05063d12021-10-27 01:50:51 +0900142 "img2simg",
Shikha Panwara7605cf2023-01-12 09:29:39 +0000143 "initrd_bootconfig",
Jooyung Han05063d12021-10-27 01:50:51 +0900144 "lpmake",
145 "lpunpack",
146 "simg2img",
147 ],
Jooyung Han504105f2021-10-26 15:54:50 +0900148}
Jooyung Hand35952e2021-11-08 17:53:47 +0900149
Jooyung Han02dceed2021-11-08 17:50:22 +0900150sh_test_host {
151 name: "sign_virt_apex_test",
152 src: "sign_virt_apex_test.sh",
153 test_config: "sign_virt_apex_test.xml",
154 data_bins: [
155 // deapexer
156 "deapexer",
157 "debugfs_static",
Dennis Shen28c79442022-11-08 14:26:13 +0000158 "blkid",
159 "fsck.erofs",
Jooyung Han02dceed2021-11-08 17:50:22 +0900160
161 // sign_virt_apex
162 "avbtool",
163 "img2simg",
Shikha Panwara7605cf2023-01-12 09:29:39 +0000164 "initrd_bootconfig",
Jooyung Han02dceed2021-11-08 17:50:22 +0900165 "lpmake",
166 "lpunpack",
167 "sign_virt_apex",
168 "simg2img",
169 ],
170 data_libs: [
171 "libbase",
172 "libc++",
173 "libcrypto_utils",
174 "libcrypto",
175 "libext4_utils",
176 "liblog",
177 "liblp",
178 "libsparse",
179 "libz",
180 ],
181 data: [
182 ":com.android.virt",
Jooyung Han6afd6672022-02-22 05:22:23 +0900183 ":test.com.android.virt.pem",
Jooyung Han02dceed2021-11-08 17:50:22 +0900184 ],
185 test_suites: ["general-tests"],
186}
187
Jooyung Han6afd6672022-02-22 05:22:23 +0900188filegroup {
189 name: "test.com.android.virt.pem",
190 srcs: ["test.com.android.virt.pem"],
191}
192
Jooyung Han1c3d2fa2022-02-24 02:35:59 +0900193filegroup {
194 name: "test2.com.android.virt.pem",
195 srcs: ["test2.com.android.virt.pem"],
196}
197
Jooyung Hand35952e2021-11-08 17:53:47 +0900198// custom tool to replace bytes in a file
199python_binary_host {
200 name: "replace_bytes",
201 srcs: [
202 "replace_bytes.py",
203 ],
204 version: {
Jooyung Hand35952e2021-11-08 17:53:47 +0900205 py3: {
Jooyung Hand35952e2021-11-08 17:53:47 +0900206 embedded_launcher: true,
207 },
208 },
209}
Nikita Ioffef28eec22022-10-18 23:17:34 +0100210
211// Encapsulate the contributions made by the com.android.virt to the bootclasspath.
212bootclasspath_fragment {
213 name: "com.android.virt-bootclasspath-fragment",
214 contents: ["framework-virtualization"],
215 apex_available: ["com.android.virt"],
216
217 // The bootclasspath_fragments that provide APIs on which this depends.
218 fragments: [
219 {
220 apex: "com.android.art",
221 module: "art-bootclasspath-fragment",
222 },
223 ],
224
225 // Additional stubs libraries that this fragment's contents use which are
226 // not provided by another bootclasspath_fragment.
227 additional_stubs: [
228 "android-non-updatable",
229 ],
230
231 hidden_api: {
232
233 // This module does not contain any split packages.
234 split_packages: [],
235
236 // The following packages and all their subpackages currently only
237 // contain classes from this bootclasspath_fragment. Listing a package
238 // here won't prevent other bootclasspath modules from adding classes in
239 // any of those packages but it will prevent them from adding those
240 // classes into an API surface, e.g. public, system, etc.. Doing so will
241 // result in a build failure due to inconsistent flags.
242 package_prefixes: [
243 "android.system.virtualmachine",
244 "android.system.virtualizationservice",
245 // android.sysprop.*, renamed by jarjar
246 "com.android.system.virtualmachine.sysprop",
247 ],
248 },
249}