blob: d5f485b6e1057d271f955b7104305e27c54e95d0 [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",
Seungjae Yooe85831e2022-12-12 09:34:58 +09007 "microdroid_bootconfig_debuggable",
Andrew Sculld6267ae2022-06-13 13:47:59 +00008 "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",
David Brazdil1f530702022-10-03 12:18:10 +010076 "virtmgr",
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",
David Brazdil1f530702022-10-03 12:18:10 +010084 "virtmgr",
Andrew Walbrandfc953d2021-06-10 13:59:56 +000085 "virtualizationservice",
Jiyong Park2199f202020-12-07 15:58:47 +090086 ],
Victor Hsieh384bf6a2021-11-11 13:28:09 -080087 filesystems: microdroid_filesystem_images,
Jiyong Park2199f202020-12-07 15:58:47 +090088 },
89 },
Jiyong Park8d1eb7e2021-02-16 13:23:00 +090090 binaries: [
Victor Hsieh573c6492021-03-11 14:19:18 -080091 "fd_server",
Andrew Walbranea9fa482021-03-04 16:11:12 +000092 "vm",
Jiyong Park8d1eb7e2021-02-16 13:23:00 +090093 ],
Inseob Kim72f06a32021-04-12 14:48:42 +090094 prebuilts: [
95 "com.android.virt.init.rc",
Nikita Ioffeab1754c2022-10-13 20:28:54 +010096 "features_com.android.virt.xml",
Seungjae Yooe85831e2022-12-12 09:34:58 +090097 "microdroid_initrd_debuggable",
Shikha Panwarf46f96b2022-08-22 14:11:14 +000098 "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}