blob: dce8edd7da9d5d4a75752b4224632030dcea6191 [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: [
David Brazdil79588392022-10-20 17:04:46 +010060 "libvirtualizationservice_jni",
Nikita Ioffeb78c6202022-11-18 17:01:36 +000061 "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",
David Brazdil1f530702022-10-03 12:18:10 +010077 "virtmgr",
Andrew Walbrandfc953d2021-06-10 13:59:56 +000078 "virtualizationservice",
Jiyong Park69b39372021-01-05 23:14:46 +090079 ],
Victor Hsieh384bf6a2021-11-11 13:28:09 -080080 filesystems: microdroid_filesystem_images,
Jiyong Park69b39372021-01-05 23:14:46 +090081 },
82 x86_64: {
83 binaries: [
Jiyong Park2199f202020-12-07 15:58:47 +090084 "crosvm",
David Brazdil1f530702022-10-03 12:18:10 +010085 "virtmgr",
Andrew Walbrandfc953d2021-06-10 13:59:56 +000086 "virtualizationservice",
Jiyong Park2199f202020-12-07 15:58:47 +090087 ],
Victor Hsieh384bf6a2021-11-11 13:28:09 -080088 filesystems: microdroid_filesystem_images,
Jiyong Park2199f202020-12-07 15:58:47 +090089 },
90 },
Jiyong Park8d1eb7e2021-02-16 13:23:00 +090091 binaries: [
Victor Hsieh573c6492021-03-11 14:19:18 -080092 "fd_server",
Andrew Walbranea9fa482021-03-04 16:11:12 +000093 "vm",
Jiyong Park8d1eb7e2021-02-16 13:23:00 +090094 ],
Inseob Kim72f06a32021-04-12 14:48:42 +090095 prebuilts: [
96 "com.android.virt.init.rc",
Nikita Ioffeab1754c2022-10-13 20:28:54 +010097 "features_com.android.virt.xml",
Seungjae Yooe85831e2022-12-12 09:34:58 +090098 "microdroid_initrd_debuggable",
Shikha Panwarf46f96b2022-08-22 14:11:14 +000099 "microdroid_initrd_normal",
Jiyong Parke9b74d02021-06-21 14:39:12 +0900100 "microdroid.json",
Inseob Kim72f06a32021-04-12 14:48:42 +0900101 "microdroid_bootloader",
Jooyung Han31b1c2b2021-10-27 03:35:42 +0900102 "microdroid_bootloader.avbpubkey",
Shikha Panwared8ace42022-09-28 12:52:16 +0000103 "microdroid_kernel",
Inseob Kim72f06a32021-04-12 14:48:42 +0900104 ],
Jiyong Park17e3ed42022-08-29 17:27:00 +0900105 host_required: [
106 "vm_shell",
107 ],
Nikita Ioffeb0b67562022-11-22 15:48:06 +0000108 apps: [
109 "EmptyPayloadApp",
110 ],
Jiyong Parkda119cb2020-12-07 15:58:23 +0900111}
112
Nikita Ioffe50e2ebe2022-10-24 17:16:25 +0100113apex_defaults {
114 name: "com.android.virt_avf_disabled",
115
116 defaults: ["com.android.virt_common"],
117}
118
Jiyong Parkda119cb2020-12-07 15:58:23 +0900119apex_key {
120 name: "com.android.virt.key",
121 public_key: "com.android.virt.avbpubkey",
122 private_key: "com.android.virt.pem",
123}
124
125android_app_certificate {
126 name: "com.android.virt.certificate",
127 certificate: "com.android.virt",
128}
Jeff Vander Stoep63ab2382021-03-25 22:18:53 +0100129
130prebuilt_etc {
131 name: "com.android.virt.init.rc",
Andrew Walbranf6bf6862021-05-21 12:41:13 +0000132 src: "virtualizationservice.rc",
Jeff Vander Stoep63ab2382021-03-25 22:18:53 +0100133 filename: "init.rc",
Alan Stokes3ef78d92021-09-08 11:51:06 +0100134 installable: false,
Jeff Vander Stoep63ab2382021-03-25 22:18:53 +0100135}
Jooyung Han504105f2021-10-26 15:54:50 +0900136
137// Virt apex needs a custom signer for its payload
138python_binary_host {
139 name: "sign_virt_apex",
140 srcs: [
141 "sign_virt_apex.py",
142 ],
143 version: {
Jooyung Han504105f2021-10-26 15:54:50 +0900144 py3: {
Jooyung Han504105f2021-10-26 15:54:50 +0900145 embedded_launcher: true,
146 },
147 },
Jooyung Han05063d12021-10-27 01:50:51 +0900148 required: [
149 "img2simg",
150 "lpmake",
151 "lpunpack",
152 "simg2img",
153 ],
Jooyung Han504105f2021-10-26 15:54:50 +0900154}
Jooyung Hand35952e2021-11-08 17:53:47 +0900155
Jooyung Han02dceed2021-11-08 17:50:22 +0900156sh_test_host {
157 name: "sign_virt_apex_test",
158 src: "sign_virt_apex_test.sh",
159 test_config: "sign_virt_apex_test.xml",
160 data_bins: [
161 // deapexer
162 "deapexer",
163 "debugfs_static",
Dennis Shen28c79442022-11-08 14:26:13 +0000164 "blkid",
165 "fsck.erofs",
Jooyung Han02dceed2021-11-08 17:50:22 +0900166
167 // sign_virt_apex
168 "avbtool",
169 "img2simg",
170 "lpmake",
171 "lpunpack",
172 "sign_virt_apex",
173 "simg2img",
174 ],
175 data_libs: [
176 "libbase",
177 "libc++",
178 "libcrypto_utils",
179 "libcrypto",
180 "libext4_utils",
181 "liblog",
182 "liblp",
183 "libsparse",
184 "libz",
185 ],
186 data: [
187 ":com.android.virt",
Jooyung Han6afd6672022-02-22 05:22:23 +0900188 ":test.com.android.virt.pem",
Jooyung Han02dceed2021-11-08 17:50:22 +0900189 ],
190 test_suites: ["general-tests"],
191}
192
Jooyung Han6afd6672022-02-22 05:22:23 +0900193filegroup {
194 name: "test.com.android.virt.pem",
195 srcs: ["test.com.android.virt.pem"],
196}
197
Jooyung Han1c3d2fa2022-02-24 02:35:59 +0900198filegroup {
199 name: "test2.com.android.virt.pem",
200 srcs: ["test2.com.android.virt.pem"],
201}
202
Jooyung Hand35952e2021-11-08 17:53:47 +0900203// custom tool to replace bytes in a file
204python_binary_host {
205 name: "replace_bytes",
206 srcs: [
207 "replace_bytes.py",
208 ],
209 version: {
Jooyung Hand35952e2021-11-08 17:53:47 +0900210 py3: {
Jooyung Hand35952e2021-11-08 17:53:47 +0900211 embedded_launcher: true,
212 },
213 },
214}
Nikita Ioffef28eec22022-10-18 23:17:34 +0100215
216// Encapsulate the contributions made by the com.android.virt to the bootclasspath.
217bootclasspath_fragment {
218 name: "com.android.virt-bootclasspath-fragment",
219 contents: ["framework-virtualization"],
220 apex_available: ["com.android.virt"],
221
222 // The bootclasspath_fragments that provide APIs on which this depends.
223 fragments: [
224 {
225 apex: "com.android.art",
226 module: "art-bootclasspath-fragment",
227 },
228 ],
229
230 // Additional stubs libraries that this fragment's contents use which are
231 // not provided by another bootclasspath_fragment.
232 additional_stubs: [
233 "android-non-updatable",
234 ],
235
236 hidden_api: {
237
238 // This module does not contain any split packages.
239 split_packages: [],
240
241 // The following packages and all their subpackages currently only
242 // contain classes from this bootclasspath_fragment. Listing a package
243 // here won't prevent other bootclasspath modules from adding classes in
244 // any of those packages but it will prevent them from adding those
245 // classes into an API surface, e.g. public, system, etc.. Doing so will
246 // result in a build failure due to inconsistent flags.
247 package_prefixes: [
248 "android.system.virtualmachine",
249 "android.system.virtualizationservice",
250 // android.sysprop.*, renamed by jarjar
251 "com.android.system.virtualmachine.sysprop",
252 ],
253 },
254}