blob: 7bcfd54ad0e6e4ac1d7d2e2c007695ecc38555c1 [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 Wang748b0322023-07-24 12:51:18 +000013 "libciborium_io_nostd",
14 "libciborium_nostd",
Pierre-Clément Tosi1bf532b2023-11-13 11:06:20 +000015 "libcstr",
Alice Wang474c0ee2023-09-14 12:52:33 +000016 "libdiced_open_dice_nostd",
Pierre-Clément Tosi992c2bb2024-10-02 10:37:42 +010017 "liblibfdt_nostd",
David Brazdil05a72fd2022-07-09 17:33:08 +010018 "liblog_rust_nostd",
Alice Wang748b0322023-07-24 12:51:18 +000019 "libservice_vm_comm_nostd",
Alice Wang4ac9c8b2023-12-05 16:23:14 +000020 "libservice_vm_fake_chain_nostd",
Alice Wang7b4b6132023-10-05 08:00:16 +000021 "libservice_vm_requests_nostd",
Alice Wang953a6572023-08-24 13:40:10 +000022 "libtinyvec_nostd",
Alice Wangd36c7112023-07-04 09:50:45 +000023 "libvirtio_drivers",
David Brazdil66fc1202022-07-04 21:48:45 +010024 "libvmbase",
Alice Wang7b2ab942023-09-12 13:04:42 +000025 ],
David Brazdil66fc1202022-07-04 21:48:45 +010026}
27
28cc_binary {
29 name: "rialto_elf",
30 stem: "rialto",
31 defaults: ["vmbase_elf_defaults"],
32 srcs: [
33 "idmap.S",
34 ],
35 static_libs: [
36 "librialto",
David Brazdil66fc1202022-07-04 21:48:45 +010037 ],
38 linker_scripts: [
39 "image.ld",
40 ":vmbase_sections",
41 ],
David Brazdil66fc1202022-07-04 21:48:45 +010042}
43
44raw_binary {
Alice Wang9a8b39f2023-04-12 15:31:48 +000045 name: "rialto_unsigned",
David Brazdil66fc1202022-07-04 21:48:45 +010046 src: ":rialto_elf",
47 enabled: false,
48 target: {
49 android_arm64: {
50 enabled: true,
51 },
52 },
53}
54
Alice Wang9a8b39f2023-04-12 15:31:48 +000055// python -c "import hashlib; print(hashlib.sha256(b'rialto_salt').hexdigest())"
56rialto_salt = "ea9d8c3ae1785396884d0c16c7652921874e2b8703f336ff23760f2049ee9e29"
57
58filegroup {
59 name: "rialto_sign_key",
60 srcs: [":avb_testkey_rsa4096"],
61}
62
Alice Wang12e4c862023-12-11 13:52:27 +000063// Both SERVICE_VM_VERSION and SERVICE_VM_VERSION_STRING should represent the
64// same version number for the service VM.
65SERVICE_VM_VERSION = 1
66SERVICE_VM_VERSION_STRING = "1"
67
68genrule {
69 name: "service_vm_version_rs",
70 out: ["lib.rs"],
71 cmd: "(" +
72 " echo '#![no_std]';" +
73 " echo '#![allow(missing_docs)]';" +
74 " echo 'pub const VERSION: u64 = " + SERVICE_VM_VERSION_STRING + ";'" +
75 ") > $(out)",
76}
77
78rust_library_rlib {
79 name: "libservice_vm_version",
80 crate_name: "service_vm_version",
81 defaults: ["vmbase_rlib_defaults"],
82 srcs: [":service_vm_version_rs"],
83}
84
Alice Wang9a8b39f2023-04-12 15:31:48 +000085avb_add_hash_footer {
86 name: "rialto_signed",
87 src: ":empty_file",
88 filename: "rialto",
89 partition_name: "boot",
90 private_key: ":rialto_sign_key",
91 salt: rialto_salt,
Alice Wang12e4c862023-12-11 13:52:27 +000092 rollback_index: SERVICE_VM_VERSION,
Alice Wangab0d0202023-05-17 08:07:41 +000093 props: [
94 {
95 name: "com.android.virt.cap",
96 value: "remote_attest",
97 },
98 ],
Alice Wang9a8b39f2023-04-12 15:31:48 +000099 enabled: false,
100 arch: {
101 arm64: {
102 src: ":rialto_unsigned",
103 enabled: true,
104 },
105 },
106}
107
108prebuilt_etc {
Alan Stokes1294f942023-08-21 14:34:12 +0100109 // rialto_bin is a prebuilt target wrapping the signed bare-metal service VM.
Alice Wang9a8b39f2023-04-12 15:31:48 +0000110 name: "rialto_bin",
111 filename: "rialto.bin",
112 target: {
113 android_arm64: {
114 src: ":rialto_signed",
115 },
116 },
117 src: ":empty_file",
118 installable: false,
119}
120
David Brazdil66fc1202022-07-04 21:48:45 +0100121rust_test {
122 name: "rialto_test",
123 crate_name: "rialto_test",
Nikita Ioffeda1b2732023-09-04 13:46:56 +0100124 defaults: ["avf_build_flags_rust"],
David Brazdil66fc1202022-07-04 21:48:45 +0100125 srcs: ["tests/test.rs"],
126 prefer_rlib: true,
127 edition: "2021",
128 rustlibs: [
129 "android.system.virtualizationservice-rust",
130 "libandroid_logger",
131 "libanyhow",
Alice Wang20b8ebc2023-11-17 09:54:47 +0000132 "libbssl_avf_nostd",
Alice Wangde6bee52023-11-10 09:58:40 +0000133 "libclient_vm_csr",
Alice Wang20b8ebc2023-11-17 09:54:47 +0000134 "libcoset",
David Brazdil66fc1202022-07-04 21:48:45 +0100135 "liblibc",
136 "liblog_rust",
Alice Wang68d11402024-01-02 13:59:44 +0000137 "libhwtrust",
Nikita Ioffebd2e2e42024-07-05 15:04:49 +0000138 "libhypervisor_props",
Alice Wang748b0322023-07-24 12:51:18 +0000139 "libservice_vm_comm",
Alice Wang4ac9c8b2023-12-05 16:23:14 +0000140 "libservice_vm_fake_chain",
Alice Wang17dc76e2023-09-06 09:43:52 +0000141 "libservice_vm_manager",
David Brazdil66fc1202022-07-04 21:48:45 +0100142 "libvmclient",
Alice Wang6a504ef2023-12-21 15:37:55 +0000143 "libx509_cert_nostd",
David Brazdil66fc1202022-07-04 21:48:45 +0100144 ],
145 data: [
Alice Wang9a8b39f2023-04-12 15:31:48 +0000146 ":rialto_unsigned",
Alice Wang20b8ebc2023-11-17 09:54:47 +0000147 ":test_rkp_cert_chain",
David Brazdil66fc1202022-07-04 21:48:45 +0100148 ],
149 test_suites: ["general-tests"],
150 enabled: false,
151 target: {
152 android_arm64: {
153 enabled: true,
154 },
155 },
156}