Bob Badour | 2efc476 | 2021-02-03 18:36:27 -0800 | [diff] [blame] | 1 | package { |
| 2 | default_applicable_licenses: ["Android-Apache-2.0"], |
| 3 | } |
| 4 | |
Victor Hsieh | 384bf6a | 2021-11-11 13:28:09 -0800 | [diff] [blame] | 5 | microdroid_filesystem_images = [ |
Jiyong Park | 09a2bda | 2022-06-13 16:44:45 +0900 | [diff] [blame] | 6 | "microdroid_boot", |
Andrew Scull | d6267ae | 2022-06-13 13:47:59 +0000 | [diff] [blame] | 7 | "microdroid_bootconfig_full_debuggable", |
| 8 | "microdroid_bootconfig_normal", |
Andrew Scull | ed0fd2d | 2022-06-13 13:22:41 +0000 | [diff] [blame] | 9 | "microdroid_init_boot", |
Andrew Scull | d6267ae | 2022-06-13 13:47:59 +0000 | [diff] [blame] | 10 | "microdroid_super", |
| 11 | "microdroid_uboot_env", |
Victor Hsieh | 384bf6a | 2021-11-11 13:28:09 -0800 | [diff] [blame] | 12 | "microdroid_vbmeta", |
| 13 | "microdroid_vbmeta_bootconfig", |
Andrew Scull | d6267ae | 2022-06-13 13:47:59 +0000 | [diff] [blame] | 14 | "microdroid_vendor_boot", |
Victor Hsieh | 384bf6a | 2021-11-11 13:28:09 -0800 | [diff] [blame] | 15 | ] |
| 16 | |
Nikita Ioffe | 50e2ebe | 2022-10-24 17:16:25 +0100 | [diff] [blame] | 17 | soong_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 Park | da119cb | 2020-12-07 15:58:23 +0900 | [diff] [blame] | 24 | |
Nikita Ioffe | 50e2ebe | 2022-10-24 17:16:25 +0100 | [diff] [blame] | 25 | virt_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 | |
| 37 | apex_defaults { |
| 38 | name: "com.android.virt_common", |
Jiyong Park | da119cb | 2020-12-07 15:58:23 +0900 | [diff] [blame] | 39 | // TODO(jiyong): make it updatable |
Mathew Inwood | 9af36dd | 2021-02-16 14:43:40 +0000 | [diff] [blame] | 40 | updatable: false, |
Jiyong Park | 1c8f14c | 2021-11-29 11:29:16 +0900 | [diff] [blame] | 41 | future_updatable: true, |
Jiyong Park | b6c45e7 | 2021-06-22 20:24:56 +0900 | [diff] [blame] | 42 | platform_apis: true, |
Jiyong Park | da119cb | 2020-12-07 15:58:23 +0900 | [diff] [blame] | 43 | |
| 44 | manifest: "manifest.json", |
| 45 | |
| 46 | key: "com.android.virt.key", |
| 47 | certificate: ":com.android.virt.certificate", |
Nikita Ioffe | 50e2ebe | 2022-10-24 17:16:25 +0100 | [diff] [blame] | 48 | |
| 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 Ioffe | f28eec2 | 2022-10-18 23:17:34 +0100 | [diff] [blame] | 55 | |
| 56 | bootclasspath_fragments: [ |
| 57 | "com.android.virt-bootclasspath-fragment", |
| 58 | ], |
Nikita Ioffe | b78c620 | 2022-11-18 17:01:36 +0000 | [diff] [blame] | 59 | jni_libs: [ |
| 60 | "libvirtualmachine_jni", |
| 61 | ], |
Nikita Ioffe | 50e2ebe | 2022-10-24 17:16:25 +0100 | [diff] [blame] | 62 | } |
| 63 | |
| 64 | apex_defaults { |
| 65 | name: "com.android.virt_avf_enabled", |
| 66 | |
| 67 | defaults: ["com.android.virt_common"], |
| 68 | |
Jooyung Han | 05063d1 | 2021-10-27 01:50:51 +0900 | [diff] [blame] | 69 | custom_sign_tool: "sign_virt_apex", |
Jiyong Park | da119cb | 2020-12-07 15:58:23 +0900 | [diff] [blame] | 70 | |
Andrew Walbran | dfc953d | 2021-06-10 13:59:56 +0000 | [diff] [blame] | 71 | // crosvm and virtualizationservice are only enabled for 64-bit targets on device |
Jiyong Park | 2199f20 | 2020-12-07 15:58:47 +0900 | [diff] [blame] | 72 | arch: { |
| 73 | arm64: { |
| 74 | binaries: [ |
Jiyong Park | 69b3937 | 2021-01-05 23:14:46 +0900 | [diff] [blame] | 75 | "crosvm", |
Andrew Walbran | dfc953d | 2021-06-10 13:59:56 +0000 | [diff] [blame] | 76 | "virtualizationservice", |
Jiyong Park | 69b3937 | 2021-01-05 23:14:46 +0900 | [diff] [blame] | 77 | ], |
Victor Hsieh | 384bf6a | 2021-11-11 13:28:09 -0800 | [diff] [blame] | 78 | filesystems: microdroid_filesystem_images, |
Jiyong Park | 69b3937 | 2021-01-05 23:14:46 +0900 | [diff] [blame] | 79 | }, |
| 80 | x86_64: { |
| 81 | binaries: [ |
Jiyong Park | 2199f20 | 2020-12-07 15:58:47 +0900 | [diff] [blame] | 82 | "crosvm", |
Andrew Walbran | dfc953d | 2021-06-10 13:59:56 +0000 | [diff] [blame] | 83 | "virtualizationservice", |
Jiyong Park | 2199f20 | 2020-12-07 15:58:47 +0900 | [diff] [blame] | 84 | ], |
Victor Hsieh | 384bf6a | 2021-11-11 13:28:09 -0800 | [diff] [blame] | 85 | filesystems: microdroid_filesystem_images, |
Jiyong Park | 2199f20 | 2020-12-07 15:58:47 +0900 | [diff] [blame] | 86 | }, |
| 87 | }, |
Jiyong Park | 8d1eb7e | 2021-02-16 13:23:00 +0900 | [diff] [blame] | 88 | binaries: [ |
Victor Hsieh | 573c649 | 2021-03-11 14:19:18 -0800 | [diff] [blame] | 89 | "fd_server", |
Andrew Walbran | ea9fa48 | 2021-03-04 16:11:12 +0000 | [diff] [blame] | 90 | "vm", |
Jiyong Park | 8d1eb7e | 2021-02-16 13:23:00 +0900 | [diff] [blame] | 91 | ], |
Inseob Kim | 72f06a3 | 2021-04-12 14:48:42 +0900 | [diff] [blame] | 92 | prebuilts: [ |
| 93 | "com.android.virt.init.rc", |
Nikita Ioffe | ab1754c | 2022-10-13 20:28:54 +0100 | [diff] [blame] | 94 | "features_com.android.virt.xml", |
Shikha Panwar | f46f96b | 2022-08-22 14:11:14 +0000 | [diff] [blame] | 95 | "microdroid_initrd_full_debuggable", |
| 96 | "microdroid_initrd_normal", |
Jiyong Park | e9b74d0 | 2021-06-21 14:39:12 +0900 | [diff] [blame] | 97 | "microdroid.json", |
Inseob Kim | 72f06a3 | 2021-04-12 14:48:42 +0900 | [diff] [blame] | 98 | "microdroid_bootloader", |
Jooyung Han | 31b1c2b | 2021-10-27 03:35:42 +0900 | [diff] [blame] | 99 | "microdroid_bootloader.avbpubkey", |
Shikha Panwar | ed8ace4 | 2022-09-28 12:52:16 +0000 | [diff] [blame] | 100 | "microdroid_kernel", |
Inseob Kim | 72f06a3 | 2021-04-12 14:48:42 +0900 | [diff] [blame] | 101 | ], |
Jiyong Park | 17e3ed4 | 2022-08-29 17:27:00 +0900 | [diff] [blame] | 102 | host_required: [ |
| 103 | "vm_shell", |
| 104 | ], |
Nikita Ioffe | b0b6756 | 2022-11-22 15:48:06 +0000 | [diff] [blame] | 105 | apps: [ |
| 106 | "EmptyPayloadApp", |
| 107 | ], |
Jiyong Park | da119cb | 2020-12-07 15:58:23 +0900 | [diff] [blame] | 108 | } |
| 109 | |
Nikita Ioffe | 50e2ebe | 2022-10-24 17:16:25 +0100 | [diff] [blame] | 110 | apex_defaults { |
| 111 | name: "com.android.virt_avf_disabled", |
| 112 | |
| 113 | defaults: ["com.android.virt_common"], |
| 114 | } |
| 115 | |
Jiyong Park | da119cb | 2020-12-07 15:58:23 +0900 | [diff] [blame] | 116 | apex_key { |
| 117 | name: "com.android.virt.key", |
| 118 | public_key: "com.android.virt.avbpubkey", |
| 119 | private_key: "com.android.virt.pem", |
| 120 | } |
| 121 | |
| 122 | android_app_certificate { |
| 123 | name: "com.android.virt.certificate", |
| 124 | certificate: "com.android.virt", |
| 125 | } |
Jeff Vander Stoep | 63ab238 | 2021-03-25 22:18:53 +0100 | [diff] [blame] | 126 | |
| 127 | prebuilt_etc { |
| 128 | name: "com.android.virt.init.rc", |
Andrew Walbran | f6bf686 | 2021-05-21 12:41:13 +0000 | [diff] [blame] | 129 | src: "virtualizationservice.rc", |
Jeff Vander Stoep | 63ab238 | 2021-03-25 22:18:53 +0100 | [diff] [blame] | 130 | filename: "init.rc", |
Alan Stokes | 3ef78d9 | 2021-09-08 11:51:06 +0100 | [diff] [blame] | 131 | installable: false, |
Jeff Vander Stoep | 63ab238 | 2021-03-25 22:18:53 +0100 | [diff] [blame] | 132 | } |
Jooyung Han | 504105f | 2021-10-26 15:54:50 +0900 | [diff] [blame] | 133 | |
| 134 | // Virt apex needs a custom signer for its payload |
| 135 | python_binary_host { |
| 136 | name: "sign_virt_apex", |
| 137 | srcs: [ |
| 138 | "sign_virt_apex.py", |
| 139 | ], |
| 140 | version: { |
Jooyung Han | 504105f | 2021-10-26 15:54:50 +0900 | [diff] [blame] | 141 | py3: { |
Jooyung Han | 504105f | 2021-10-26 15:54:50 +0900 | [diff] [blame] | 142 | embedded_launcher: true, |
| 143 | }, |
| 144 | }, |
Jooyung Han | 05063d1 | 2021-10-27 01:50:51 +0900 | [diff] [blame] | 145 | required: [ |
| 146 | "img2simg", |
| 147 | "lpmake", |
| 148 | "lpunpack", |
| 149 | "simg2img", |
| 150 | ], |
Jooyung Han | 504105f | 2021-10-26 15:54:50 +0900 | [diff] [blame] | 151 | } |
Jooyung Han | d35952e | 2021-11-08 17:53:47 +0900 | [diff] [blame] | 152 | |
Jooyung Han | 02dceed | 2021-11-08 17:50:22 +0900 | [diff] [blame] | 153 | sh_test_host { |
| 154 | name: "sign_virt_apex_test", |
| 155 | src: "sign_virt_apex_test.sh", |
| 156 | test_config: "sign_virt_apex_test.xml", |
| 157 | data_bins: [ |
| 158 | // deapexer |
| 159 | "deapexer", |
| 160 | "debugfs_static", |
Dennis Shen | 28c7944 | 2022-11-08 14:26:13 +0000 | [diff] [blame] | 161 | "blkid", |
| 162 | "fsck.erofs", |
Jooyung Han | 02dceed | 2021-11-08 17:50:22 +0900 | [diff] [blame] | 163 | |
| 164 | // sign_virt_apex |
| 165 | "avbtool", |
| 166 | "img2simg", |
| 167 | "lpmake", |
| 168 | "lpunpack", |
| 169 | "sign_virt_apex", |
| 170 | "simg2img", |
| 171 | ], |
| 172 | data_libs: [ |
| 173 | "libbase", |
| 174 | "libc++", |
| 175 | "libcrypto_utils", |
| 176 | "libcrypto", |
| 177 | "libext4_utils", |
| 178 | "liblog", |
| 179 | "liblp", |
| 180 | "libsparse", |
| 181 | "libz", |
| 182 | ], |
| 183 | data: [ |
| 184 | ":com.android.virt", |
Jooyung Han | 6afd667 | 2022-02-22 05:22:23 +0900 | [diff] [blame] | 185 | ":test.com.android.virt.pem", |
Jooyung Han | 02dceed | 2021-11-08 17:50:22 +0900 | [diff] [blame] | 186 | ], |
| 187 | test_suites: ["general-tests"], |
| 188 | } |
| 189 | |
Jooyung Han | 6afd667 | 2022-02-22 05:22:23 +0900 | [diff] [blame] | 190 | filegroup { |
| 191 | name: "test.com.android.virt.pem", |
| 192 | srcs: ["test.com.android.virt.pem"], |
| 193 | } |
| 194 | |
Jooyung Han | 1c3d2fa | 2022-02-24 02:35:59 +0900 | [diff] [blame] | 195 | filegroup { |
| 196 | name: "test2.com.android.virt.pem", |
| 197 | srcs: ["test2.com.android.virt.pem"], |
| 198 | } |
| 199 | |
Jooyung Han | d35952e | 2021-11-08 17:53:47 +0900 | [diff] [blame] | 200 | // custom tool to replace bytes in a file |
| 201 | python_binary_host { |
| 202 | name: "replace_bytes", |
| 203 | srcs: [ |
| 204 | "replace_bytes.py", |
| 205 | ], |
| 206 | version: { |
Jooyung Han | d35952e | 2021-11-08 17:53:47 +0900 | [diff] [blame] | 207 | py3: { |
Jooyung Han | d35952e | 2021-11-08 17:53:47 +0900 | [diff] [blame] | 208 | embedded_launcher: true, |
| 209 | }, |
| 210 | }, |
| 211 | } |
Nikita Ioffe | f28eec2 | 2022-10-18 23:17:34 +0100 | [diff] [blame] | 212 | |
| 213 | // Encapsulate the contributions made by the com.android.virt to the bootclasspath. |
| 214 | bootclasspath_fragment { |
| 215 | name: "com.android.virt-bootclasspath-fragment", |
| 216 | contents: ["framework-virtualization"], |
| 217 | apex_available: ["com.android.virt"], |
| 218 | |
| 219 | // The bootclasspath_fragments that provide APIs on which this depends. |
| 220 | fragments: [ |
| 221 | { |
| 222 | apex: "com.android.art", |
| 223 | module: "art-bootclasspath-fragment", |
| 224 | }, |
| 225 | ], |
| 226 | |
| 227 | // Additional stubs libraries that this fragment's contents use which are |
| 228 | // not provided by another bootclasspath_fragment. |
| 229 | additional_stubs: [ |
| 230 | "android-non-updatable", |
| 231 | ], |
| 232 | |
| 233 | hidden_api: { |
| 234 | |
| 235 | // This module does not contain any split packages. |
| 236 | split_packages: [], |
| 237 | |
| 238 | // The following packages and all their subpackages currently only |
| 239 | // contain classes from this bootclasspath_fragment. Listing a package |
| 240 | // here won't prevent other bootclasspath modules from adding classes in |
| 241 | // any of those packages but it will prevent them from adding those |
| 242 | // classes into an API surface, e.g. public, system, etc.. Doing so will |
| 243 | // result in a build failure due to inconsistent flags. |
| 244 | package_prefixes: [ |
| 245 | "android.system.virtualmachine", |
| 246 | "android.system.virtualizationservice", |
| 247 | // android.sysprop.*, renamed by jarjar |
| 248 | "com.android.system.virtualmachine.sysprop", |
| 249 | ], |
| 250 | }, |
| 251 | } |