blob: 5e7fe1fe0f559c0a86c0a542c92abb3959dd552e [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: [
11 "libaarch64_paging",
Alice Wangc8f88f52023-09-25 14:02:17 +000012 "libbssl_avf_nostd",
Alice Wang7b2ab942023-09-12 13:04:42 +000013 "libbssl_ffi_nostd",
Alice Wang748b0322023-07-24 12:51:18 +000014 "libciborium_io_nostd",
15 "libciborium_nostd",
Pierre-Clément Tosi1bf532b2023-11-13 11:06:20 +000016 "libcstr",
Alice Wang474c0ee2023-09-14 12:52:33 +000017 "libdiced_open_dice_nostd",
Alice Wang9a8b39f2023-04-12 15:31:48 +000018 "libhyp",
Alice Wangdda3ba92023-05-25 15:15:30 +000019 "libfdtpci",
20 "liblibfdt",
David Brazdil05a72fd2022-07-09 17:33:08 +010021 "liblog_rust_nostd",
Alice Wang748b0322023-07-24 12:51:18 +000022 "libservice_vm_comm_nostd",
Alice Wang4ac9c8b2023-12-05 16:23:14 +000023 "libservice_vm_fake_chain_nostd",
Alice Wang7b4b6132023-10-05 08:00:16 +000024 "libservice_vm_requests_nostd",
Alice Wang953a6572023-08-24 13:40:10 +000025 "libtinyvec_nostd",
Alice Wangd36c7112023-07-04 09:50:45 +000026 "libvirtio_drivers",
David Brazdil66fc1202022-07-04 21:48:45 +010027 "libvmbase",
Alice Wang7b2ab942023-09-12 13:04:42 +000028 ],
David Brazdil66fc1202022-07-04 21:48:45 +010029}
30
31cc_binary {
32 name: "rialto_elf",
33 stem: "rialto",
34 defaults: ["vmbase_elf_defaults"],
35 srcs: [
36 "idmap.S",
37 ],
38 static_libs: [
39 "librialto",
David Brazdil66fc1202022-07-04 21:48:45 +010040 ],
41 linker_scripts: [
42 "image.ld",
43 ":vmbase_sections",
44 ],
David Brazdil66fc1202022-07-04 21:48:45 +010045}
46
47raw_binary {
Alice Wang9a8b39f2023-04-12 15:31:48 +000048 name: "rialto_unsigned",
David Brazdil66fc1202022-07-04 21:48:45 +010049 src: ":rialto_elf",
50 enabled: false,
51 target: {
52 android_arm64: {
53 enabled: true,
54 },
55 },
56}
57
Alice Wang9a8b39f2023-04-12 15:31:48 +000058// python -c "import hashlib; print(hashlib.sha256(b'rialto_salt').hexdigest())"
59rialto_salt = "ea9d8c3ae1785396884d0c16c7652921874e2b8703f336ff23760f2049ee9e29"
60
61filegroup {
62 name: "rialto_sign_key",
63 srcs: [":avb_testkey_rsa4096"],
64}
65
Alice Wang12e4c862023-12-11 13:52:27 +000066// Both SERVICE_VM_VERSION and SERVICE_VM_VERSION_STRING should represent the
67// same version number for the service VM.
68SERVICE_VM_VERSION = 1
69SERVICE_VM_VERSION_STRING = "1"
70
71genrule {
72 name: "service_vm_version_rs",
73 out: ["lib.rs"],
74 cmd: "(" +
75 " echo '#![no_std]';" +
76 " echo '#![allow(missing_docs)]';" +
77 " echo 'pub const VERSION: u64 = " + SERVICE_VM_VERSION_STRING + ";'" +
78 ") > $(out)",
79}
80
81rust_library_rlib {
82 name: "libservice_vm_version",
83 crate_name: "service_vm_version",
84 defaults: ["vmbase_rlib_defaults"],
85 srcs: [":service_vm_version_rs"],
86}
87
Alice Wang9a8b39f2023-04-12 15:31:48 +000088avb_add_hash_footer {
89 name: "rialto_signed",
90 src: ":empty_file",
91 filename: "rialto",
92 partition_name: "boot",
93 private_key: ":rialto_sign_key",
94 salt: rialto_salt,
Alice Wang12e4c862023-12-11 13:52:27 +000095 rollback_index: SERVICE_VM_VERSION,
Alice Wangab0d0202023-05-17 08:07:41 +000096 props: [
97 {
98 name: "com.android.virt.cap",
99 value: "remote_attest",
100 },
101 ],
Alice Wang9a8b39f2023-04-12 15:31:48 +0000102 enabled: false,
103 arch: {
104 arm64: {
105 src: ":rialto_unsigned",
106 enabled: true,
107 },
108 },
109}
110
111prebuilt_etc {
Alan Stokes1294f942023-08-21 14:34:12 +0100112 // rialto_bin is a prebuilt target wrapping the signed bare-metal service VM.
Alice Wang9a8b39f2023-04-12 15:31:48 +0000113 name: "rialto_bin",
114 filename: "rialto.bin",
115 target: {
116 android_arm64: {
117 src: ":rialto_signed",
118 },
119 },
120 src: ":empty_file",
121 installable: false,
122}
123
David Brazdil66fc1202022-07-04 21:48:45 +0100124rust_test {
125 name: "rialto_test",
126 crate_name: "rialto_test",
Nikita Ioffeda1b2732023-09-04 13:46:56 +0100127 defaults: ["avf_build_flags_rust"],
David Brazdil66fc1202022-07-04 21:48:45 +0100128 srcs: ["tests/test.rs"],
129 prefer_rlib: true,
130 edition: "2021",
131 rustlibs: [
132 "android.system.virtualizationservice-rust",
133 "libandroid_logger",
134 "libanyhow",
Alice Wang20b8ebc2023-11-17 09:54:47 +0000135 "libbssl_avf_nostd",
Alice Wangf7c0f942023-09-14 09:33:04 +0000136 "libciborium",
Alice Wangde6bee52023-11-10 09:58:40 +0000137 "libclient_vm_csr",
Alice Wang20b8ebc2023-11-17 09:54:47 +0000138 "libcoset",
David Brazdil66fc1202022-07-04 21:48:45 +0100139 "liblibc",
140 "liblog_rust",
Alice Wang748b0322023-07-24 12:51:18 +0000141 "libservice_vm_comm",
Alice Wang4ac9c8b2023-12-05 16:23:14 +0000142 "libservice_vm_fake_chain",
Alice Wang17dc76e2023-09-06 09:43:52 +0000143 "libservice_vm_manager",
David Brazdil66fc1202022-07-04 21:48:45 +0100144 "libvmclient",
Alice Wang20b8ebc2023-11-17 09:54:47 +0000145 "libx509_parser",
David Brazdil66fc1202022-07-04 21:48:45 +0100146 ],
147 data: [
Alice Wang9a8b39f2023-04-12 15:31:48 +0000148 ":rialto_unsigned",
Alice Wang20b8ebc2023-11-17 09:54:47 +0000149 ":test_rkp_cert_chain",
David Brazdil66fc1202022-07-04 21:48:45 +0100150 ],
151 test_suites: ["general-tests"],
152 enabled: false,
153 target: {
154 android_arm64: {
155 enabled: true,
156 },
157 },
158}