blob: 8da38897c5710578b568c341fd07c3232404703c [file] [log] [blame]
David Brazdil66fc1202022-07-04 21:48:45 +01001package {
2 default_applicable_licenses: ["Android-Apache-2.0"],
3}
4
5rust_ffi_static {
6 name: "librialto",
7 crate_name: "rialto",
8 srcs: ["src/main.rs"],
David Brazdil66fc1202022-07-04 21:48:45 +01009 defaults: ["vmbase_ffi_defaults"],
10 rustlibs: [
Alice Wangc8f88f52023-09-25 14:02:17 +000011 "libbssl_avf_nostd",
Alice Wang748b0322023-07-24 12:51:18 +000012 "libciborium_io_nostd",
13 "libciborium_nostd",
Alice Wang474c0ee2023-09-14 12:52:33 +000014 "libdiced_open_dice_nostd",
Per Larsen7ec45d32024-11-02 00:56:46 +000015 "libhypervisor_backends",
Pierre-Clément Tosi992c2bb2024-10-02 10:37:42 +010016 "liblibfdt_nostd",
David Brazdil05a72fd2022-07-09 17:33:08 +010017 "liblog_rust_nostd",
Alice Wang748b0322023-07-24 12:51:18 +000018 "libservice_vm_comm_nostd",
Alice Wang4ac9c8b2023-12-05 16:23:14 +000019 "libservice_vm_fake_chain_nostd",
Alice Wang7b4b6132023-10-05 08:00:16 +000020 "libservice_vm_requests_nostd",
Alice Wang953a6572023-08-24 13:40:10 +000021 "libtinyvec_nostd",
Alice Wangd36c7112023-07-04 09:50:45 +000022 "libvirtio_drivers",
David Brazdil66fc1202022-07-04 21:48:45 +010023 "libvmbase",
Alice Wang7b2ab942023-09-12 13:04:42 +000024 ],
Daniel Verkamp0cb50d82025-03-17 17:03:22 -070025 target: {
26 android_arm64: {
27 rustlibs: [
28 "libaarch64_paging",
29 ],
30 },
31 },
David Brazdil66fc1202022-07-04 21:48:45 +010032}
33
34cc_binary {
35 name: "rialto_elf",
36 stem: "rialto",
37 defaults: ["vmbase_elf_defaults"],
38 srcs: [
39 "idmap.S",
40 ],
41 static_libs: [
42 "librialto",
Pierre-Clément Tosi6203d672024-11-18 14:54:31 +000043 "libvmbase_dice_clear_memory",
David Brazdil66fc1202022-07-04 21:48:45 +010044 ],
45 linker_scripts: [
46 "image.ld",
47 ":vmbase_sections",
48 ],
David Brazdil66fc1202022-07-04 21:48:45 +010049}
50
51raw_binary {
Alice Wang9a8b39f2023-04-12 15:31:48 +000052 name: "rialto_unsigned",
David Brazdil66fc1202022-07-04 21:48:45 +010053 src: ":rialto_elf",
54 enabled: false,
55 target: {
56 android_arm64: {
57 enabled: true,
58 },
59 },
60}
61
Alice Wang9a8b39f2023-04-12 15:31:48 +000062// python -c "import hashlib; print(hashlib.sha256(b'rialto_salt').hexdigest())"
63rialto_salt = "ea9d8c3ae1785396884d0c16c7652921874e2b8703f336ff23760f2049ee9e29"
64
65filegroup {
66 name: "rialto_sign_key",
67 srcs: [":avb_testkey_rsa4096"],
68}
69
Alice Wang12e4c862023-12-11 13:52:27 +000070// Both SERVICE_VM_VERSION and SERVICE_VM_VERSION_STRING should represent the
71// same version number for the service VM.
Shikha Panwar86f041f2025-03-06 12:36:03 +000072SERVICE_VM_VERSION = 2
73SERVICE_VM_VERSION_STRING = "2"
Alice Wang12e4c862023-12-11 13:52:27 +000074
75genrule {
76 name: "service_vm_version_rs",
77 out: ["lib.rs"],
78 cmd: "(" +
79 " echo '#![no_std]';" +
80 " echo '#![allow(missing_docs)]';" +
81 " echo 'pub const VERSION: u64 = " + SERVICE_VM_VERSION_STRING + ";'" +
82 ") > $(out)",
83}
84
85rust_library_rlib {
86 name: "libservice_vm_version",
87 crate_name: "service_vm_version",
88 defaults: ["vmbase_rlib_defaults"],
89 srcs: [":service_vm_version_rs"],
90}
91
Alice Wang9a8b39f2023-04-12 15:31:48 +000092avb_add_hash_footer {
93 name: "rialto_signed",
94 src: ":empty_file",
95 filename: "rialto",
96 partition_name: "boot",
97 private_key: ":rialto_sign_key",
98 salt: rialto_salt,
Alice Wang12e4c862023-12-11 13:52:27 +000099 rollback_index: SERVICE_VM_VERSION,
Alice Wangab0d0202023-05-17 08:07:41 +0000100 props: [
101 {
102 name: "com.android.virt.cap",
103 value: "remote_attest",
104 },
105 ],
Alice Wang9a8b39f2023-04-12 15:31:48 +0000106 enabled: false,
107 arch: {
108 arm64: {
109 src: ":rialto_unsigned",
110 enabled: true,
111 },
112 },
113}
114
115prebuilt_etc {
Alan Stokes1294f942023-08-21 14:34:12 +0100116 // rialto_bin is a prebuilt target wrapping the signed bare-metal service VM.
Alice Wang9a8b39f2023-04-12 15:31:48 +0000117 name: "rialto_bin",
118 filename: "rialto.bin",
119 target: {
120 android_arm64: {
121 src: ":rialto_signed",
122 },
123 },
124 src: ":empty_file",
125 installable: false,
126}
127
David Brazdil66fc1202022-07-04 21:48:45 +0100128rust_test {
129 name: "rialto_test",
130 crate_name: "rialto_test",
Nikita Ioffeda1b2732023-09-04 13:46:56 +0100131 defaults: ["avf_build_flags_rust"],
David Brazdil66fc1202022-07-04 21:48:45 +0100132 srcs: ["tests/test.rs"],
133 prefer_rlib: true,
134 edition: "2021",
135 rustlibs: [
136 "android.system.virtualizationservice-rust",
137 "libandroid_logger",
138 "libanyhow",
Alice Wang20b8ebc2023-11-17 09:54:47 +0000139 "libbssl_avf_nostd",
Alice Wangde6bee52023-11-10 09:58:40 +0000140 "libclient_vm_csr",
Alice Wang20b8ebc2023-11-17 09:54:47 +0000141 "libcoset",
David Brazdil66fc1202022-07-04 21:48:45 +0100142 "liblibc",
143 "liblog_rust",
Alice Wang68d11402024-01-02 13:59:44 +0000144 "libhwtrust",
Nikita Ioffebd2e2e42024-07-05 15:04:49 +0000145 "libhypervisor_props",
Alice Wang748b0322023-07-24 12:51:18 +0000146 "libservice_vm_comm",
Alice Wang4ac9c8b2023-12-05 16:23:14 +0000147 "libservice_vm_fake_chain",
Alice Wang17dc76e2023-09-06 09:43:52 +0000148 "libservice_vm_manager",
David Brazdil66fc1202022-07-04 21:48:45 +0100149 "libvmclient",
Alice Wang6a504ef2023-12-21 15:37:55 +0000150 "libx509_cert_nostd",
David Brazdil66fc1202022-07-04 21:48:45 +0100151 ],
152 data: [
Alice Wang9a8b39f2023-04-12 15:31:48 +0000153 ":rialto_unsigned",
Alice Wang20b8ebc2023-11-17 09:54:47 +0000154 ":test_rkp_cert_chain",
David Brazdil66fc1202022-07-04 21:48:45 +0100155 ],
156 test_suites: ["general-tests"],
157 enabled: false,
158 target: {
159 android_arm64: {
160 enabled: true,
161 },
162 },
163}