blob: 33fe1892f598e4784095b8282492c9de9c7fc31e [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",
Maurice Lam0322b8c2023-12-18 22:13:48 +000013 "libbssl_sys_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 Wangdda3ba92023-05-25 15:15:30 +000018 "libfdtpci",
19 "liblibfdt",
David Brazdil05a72fd2022-07-09 17:33:08 +010020 "liblog_rust_nostd",
Alice Wang748b0322023-07-24 12:51:18 +000021 "libservice_vm_comm_nostd",
Alice Wang4ac9c8b2023-12-05 16:23:14 +000022 "libservice_vm_fake_chain_nostd",
Alice Wang7b4b6132023-10-05 08:00:16 +000023 "libservice_vm_requests_nostd",
Alice Wang953a6572023-08-24 13:40:10 +000024 "libtinyvec_nostd",
Alice Wangd36c7112023-07-04 09:50:45 +000025 "libvirtio_drivers",
David Brazdil66fc1202022-07-04 21:48:45 +010026 "libvmbase",
Alice Wang7b2ab942023-09-12 13:04:42 +000027 ],
David Brazdil66fc1202022-07-04 21:48:45 +010028}
29
30cc_binary {
31 name: "rialto_elf",
32 stem: "rialto",
33 defaults: ["vmbase_elf_defaults"],
34 srcs: [
35 "idmap.S",
36 ],
37 static_libs: [
38 "librialto",
David Brazdil66fc1202022-07-04 21:48:45 +010039 ],
40 linker_scripts: [
41 "image.ld",
42 ":vmbase_sections",
43 ],
David Brazdil66fc1202022-07-04 21:48:45 +010044}
45
46raw_binary {
Alice Wang9a8b39f2023-04-12 15:31:48 +000047 name: "rialto_unsigned",
David Brazdil66fc1202022-07-04 21:48:45 +010048 src: ":rialto_elf",
49 enabled: false,
50 target: {
51 android_arm64: {
52 enabled: true,
53 },
54 },
55}
56
Alice Wang9a8b39f2023-04-12 15:31:48 +000057// python -c "import hashlib; print(hashlib.sha256(b'rialto_salt').hexdigest())"
58rialto_salt = "ea9d8c3ae1785396884d0c16c7652921874e2b8703f336ff23760f2049ee9e29"
59
60filegroup {
61 name: "rialto_sign_key",
62 srcs: [":avb_testkey_rsa4096"],
63}
64
Alice Wang12e4c862023-12-11 13:52:27 +000065// Both SERVICE_VM_VERSION and SERVICE_VM_VERSION_STRING should represent the
66// same version number for the service VM.
67SERVICE_VM_VERSION = 1
68SERVICE_VM_VERSION_STRING = "1"
69
70genrule {
71 name: "service_vm_version_rs",
72 out: ["lib.rs"],
73 cmd: "(" +
74 " echo '#![no_std]';" +
75 " echo '#![allow(missing_docs)]';" +
76 " echo 'pub const VERSION: u64 = " + SERVICE_VM_VERSION_STRING + ";'" +
77 ") > $(out)",
78}
79
80rust_library_rlib {
81 name: "libservice_vm_version",
82 crate_name: "service_vm_version",
83 defaults: ["vmbase_rlib_defaults"],
84 srcs: [":service_vm_version_rs"],
85}
86
Alice Wang9a8b39f2023-04-12 15:31:48 +000087avb_add_hash_footer {
88 name: "rialto_signed",
89 src: ":empty_file",
90 filename: "rialto",
91 partition_name: "boot",
92 private_key: ":rialto_sign_key",
93 salt: rialto_salt,
Alice Wang12e4c862023-12-11 13:52:27 +000094 rollback_index: SERVICE_VM_VERSION,
Alice Wangab0d0202023-05-17 08:07:41 +000095 props: [
96 {
97 name: "com.android.virt.cap",
98 value: "remote_attest",
99 },
100 ],
Alice Wang9a8b39f2023-04-12 15:31:48 +0000101 enabled: false,
102 arch: {
103 arm64: {
104 src: ":rialto_unsigned",
105 enabled: true,
106 },
107 },
108}
109
110prebuilt_etc {
Alan Stokes1294f942023-08-21 14:34:12 +0100111 // rialto_bin is a prebuilt target wrapping the signed bare-metal service VM.
Alice Wang9a8b39f2023-04-12 15:31:48 +0000112 name: "rialto_bin",
113 filename: "rialto.bin",
114 target: {
115 android_arm64: {
116 src: ":rialto_signed",
117 },
118 },
119 src: ":empty_file",
120 installable: false,
121}
122
David Brazdil66fc1202022-07-04 21:48:45 +0100123rust_test {
124 name: "rialto_test",
125 crate_name: "rialto_test",
Nikita Ioffeda1b2732023-09-04 13:46:56 +0100126 defaults: ["avf_build_flags_rust"],
David Brazdil66fc1202022-07-04 21:48:45 +0100127 srcs: ["tests/test.rs"],
128 prefer_rlib: true,
129 edition: "2021",
130 rustlibs: [
131 "android.system.virtualizationservice-rust",
132 "libandroid_logger",
133 "libanyhow",
Alice Wang20b8ebc2023-11-17 09:54:47 +0000134 "libbssl_avf_nostd",
Alice Wangde6bee52023-11-10 09:58:40 +0000135 "libclient_vm_csr",
Alice Wang20b8ebc2023-11-17 09:54:47 +0000136 "libcoset",
David Brazdil66fc1202022-07-04 21:48:45 +0100137 "liblibc",
138 "liblog_rust",
Alice Wang68d11402024-01-02 13:59:44 +0000139 "libhwtrust",
Alice Wang748b0322023-07-24 12:51:18 +0000140 "libservice_vm_comm",
Alice Wang4ac9c8b2023-12-05 16:23:14 +0000141 "libservice_vm_fake_chain",
Alice Wang17dc76e2023-09-06 09:43:52 +0000142 "libservice_vm_manager",
David Brazdil66fc1202022-07-04 21:48:45 +0100143 "libvmclient",
Alice Wang6a504ef2023-12-21 15:37:55 +0000144 "libx509_cert_nostd",
David Brazdil66fc1202022-07-04 21:48:45 +0100145 ],
146 data: [
Alice Wang9a8b39f2023-04-12 15:31:48 +0000147 ":rialto_unsigned",
Alice Wang20b8ebc2023-11-17 09:54:47 +0000148 ":test_rkp_cert_chain",
David Brazdil66fc1202022-07-04 21:48:45 +0100149 ],
150 test_suites: ["general-tests"],
151 enabled: false,
152 target: {
153 android_arm64: {
154 enabled: true,
155 },
156 },
157}