David Brazdil | 66fc120 | 2022-07-04 21:48:45 +0100 | [diff] [blame] | 1 | package { |
| 2 | default_applicable_licenses: ["Android-Apache-2.0"], |
| 3 | } |
| 4 | |
| 5 | rust_ffi_static { |
| 6 | name: "librialto", |
| 7 | crate_name: "rialto", |
| 8 | srcs: ["src/main.rs"], |
David Brazdil | 66fc120 | 2022-07-04 21:48:45 +0100 | [diff] [blame] | 9 | defaults: ["vmbase_ffi_defaults"], |
| 10 | rustlibs: [ |
Alice Wang | c8f88f5 | 2023-09-25 14:02:17 +0000 | [diff] [blame] | 11 | "libbssl_avf_nostd", |
Alice Wang | 748b032 | 2023-07-24 12:51:18 +0000 | [diff] [blame] | 12 | "libciborium_io_nostd", |
| 13 | "libciborium_nostd", |
Alice Wang | 474c0ee | 2023-09-14 12:52:33 +0000 | [diff] [blame] | 14 | "libdiced_open_dice_nostd", |
Per Larsen | 7ec45d3 | 2024-11-02 00:56:46 +0000 | [diff] [blame] | 15 | "libhypervisor_backends", |
Pierre-Clément Tosi | 992c2bb | 2024-10-02 10:37:42 +0100 | [diff] [blame] | 16 | "liblibfdt_nostd", |
David Brazdil | 05a72fd | 2022-07-09 17:33:08 +0100 | [diff] [blame] | 17 | "liblog_rust_nostd", |
Alice Wang | 748b032 | 2023-07-24 12:51:18 +0000 | [diff] [blame] | 18 | "libservice_vm_comm_nostd", |
Alice Wang | 4ac9c8b | 2023-12-05 16:23:14 +0000 | [diff] [blame] | 19 | "libservice_vm_fake_chain_nostd", |
Alice Wang | 7b4b613 | 2023-10-05 08:00:16 +0000 | [diff] [blame] | 20 | "libservice_vm_requests_nostd", |
Alice Wang | 953a657 | 2023-08-24 13:40:10 +0000 | [diff] [blame] | 21 | "libtinyvec_nostd", |
Alice Wang | d36c711 | 2023-07-04 09:50:45 +0000 | [diff] [blame] | 22 | "libvirtio_drivers", |
David Brazdil | 66fc120 | 2022-07-04 21:48:45 +0100 | [diff] [blame] | 23 | "libvmbase", |
Alice Wang | 7b2ab94 | 2023-09-12 13:04:42 +0000 | [diff] [blame] | 24 | ], |
Daniel Verkamp | 0cb50d8 | 2025-03-17 17:03:22 -0700 | [diff] [blame] | 25 | target: { |
| 26 | android_arm64: { |
| 27 | rustlibs: [ |
| 28 | "libaarch64_paging", |
| 29 | ], |
| 30 | }, |
| 31 | }, |
David Brazdil | 66fc120 | 2022-07-04 21:48:45 +0100 | [diff] [blame] | 32 | } |
| 33 | |
| 34 | cc_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 Tosi | 6203d67 | 2024-11-18 14:54:31 +0000 | [diff] [blame] | 43 | "libvmbase_dice_clear_memory", |
David Brazdil | 66fc120 | 2022-07-04 21:48:45 +0100 | [diff] [blame] | 44 | ], |
| 45 | linker_scripts: [ |
| 46 | "image.ld", |
| 47 | ":vmbase_sections", |
| 48 | ], |
David Brazdil | 66fc120 | 2022-07-04 21:48:45 +0100 | [diff] [blame] | 49 | } |
| 50 | |
| 51 | raw_binary { |
Alice Wang | 9a8b39f | 2023-04-12 15:31:48 +0000 | [diff] [blame] | 52 | name: "rialto_unsigned", |
David Brazdil | 66fc120 | 2022-07-04 21:48:45 +0100 | [diff] [blame] | 53 | src: ":rialto_elf", |
| 54 | enabled: false, |
| 55 | target: { |
| 56 | android_arm64: { |
| 57 | enabled: true, |
| 58 | }, |
| 59 | }, |
| 60 | } |
| 61 | |
Alice Wang | 9a8b39f | 2023-04-12 15:31:48 +0000 | [diff] [blame] | 62 | // python -c "import hashlib; print(hashlib.sha256(b'rialto_salt').hexdigest())" |
| 63 | rialto_salt = "ea9d8c3ae1785396884d0c16c7652921874e2b8703f336ff23760f2049ee9e29" |
| 64 | |
| 65 | filegroup { |
| 66 | name: "rialto_sign_key", |
| 67 | srcs: [":avb_testkey_rsa4096"], |
| 68 | } |
| 69 | |
Alice Wang | 12e4c86 | 2023-12-11 13:52:27 +0000 | [diff] [blame] | 70 | // Both SERVICE_VM_VERSION and SERVICE_VM_VERSION_STRING should represent the |
| 71 | // same version number for the service VM. |
Shikha Panwar | 86f041f | 2025-03-06 12:36:03 +0000 | [diff] [blame] | 72 | SERVICE_VM_VERSION = 2 |
| 73 | SERVICE_VM_VERSION_STRING = "2" |
Alice Wang | 12e4c86 | 2023-12-11 13:52:27 +0000 | [diff] [blame] | 74 | |
| 75 | genrule { |
| 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 | |
| 85 | rust_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 Wang | 9a8b39f | 2023-04-12 15:31:48 +0000 | [diff] [blame] | 92 | avb_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 Wang | 12e4c86 | 2023-12-11 13:52:27 +0000 | [diff] [blame] | 99 | rollback_index: SERVICE_VM_VERSION, |
Alice Wang | ab0d020 | 2023-05-17 08:07:41 +0000 | [diff] [blame] | 100 | props: [ |
| 101 | { |
| 102 | name: "com.android.virt.cap", |
| 103 | value: "remote_attest", |
| 104 | }, |
| 105 | ], |
Alice Wang | 9a8b39f | 2023-04-12 15:31:48 +0000 | [diff] [blame] | 106 | enabled: false, |
| 107 | arch: { |
| 108 | arm64: { |
| 109 | src: ":rialto_unsigned", |
| 110 | enabled: true, |
| 111 | }, |
| 112 | }, |
| 113 | } |
| 114 | |
| 115 | prebuilt_etc { |
Alan Stokes | 1294f94 | 2023-08-21 14:34:12 +0100 | [diff] [blame] | 116 | // rialto_bin is a prebuilt target wrapping the signed bare-metal service VM. |
Alice Wang | 9a8b39f | 2023-04-12 15:31:48 +0000 | [diff] [blame] | 117 | 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 Brazdil | 66fc120 | 2022-07-04 21:48:45 +0100 | [diff] [blame] | 128 | rust_test { |
| 129 | name: "rialto_test", |
| 130 | crate_name: "rialto_test", |
Nikita Ioffe | da1b273 | 2023-09-04 13:46:56 +0100 | [diff] [blame] | 131 | defaults: ["avf_build_flags_rust"], |
David Brazdil | 66fc120 | 2022-07-04 21:48:45 +0100 | [diff] [blame] | 132 | srcs: ["tests/test.rs"], |
| 133 | prefer_rlib: true, |
| 134 | edition: "2021", |
| 135 | rustlibs: [ |
| 136 | "android.system.virtualizationservice-rust", |
| 137 | "libandroid_logger", |
| 138 | "libanyhow", |
Alice Wang | 20b8ebc | 2023-11-17 09:54:47 +0000 | [diff] [blame] | 139 | "libbssl_avf_nostd", |
Alice Wang | de6bee5 | 2023-11-10 09:58:40 +0000 | [diff] [blame] | 140 | "libclient_vm_csr", |
Alice Wang | 20b8ebc | 2023-11-17 09:54:47 +0000 | [diff] [blame] | 141 | "libcoset", |
David Brazdil | 66fc120 | 2022-07-04 21:48:45 +0100 | [diff] [blame] | 142 | "liblibc", |
| 143 | "liblog_rust", |
Alice Wang | 68d1140 | 2024-01-02 13:59:44 +0000 | [diff] [blame] | 144 | "libhwtrust", |
Nikita Ioffe | bd2e2e4 | 2024-07-05 15:04:49 +0000 | [diff] [blame] | 145 | "libhypervisor_props", |
Alice Wang | 748b032 | 2023-07-24 12:51:18 +0000 | [diff] [blame] | 146 | "libservice_vm_comm", |
Alice Wang | 4ac9c8b | 2023-12-05 16:23:14 +0000 | [diff] [blame] | 147 | "libservice_vm_fake_chain", |
Alice Wang | 17dc76e | 2023-09-06 09:43:52 +0000 | [diff] [blame] | 148 | "libservice_vm_manager", |
David Brazdil | 66fc120 | 2022-07-04 21:48:45 +0100 | [diff] [blame] | 149 | "libvmclient", |
Alice Wang | 6a504ef | 2023-12-21 15:37:55 +0000 | [diff] [blame] | 150 | "libx509_cert_nostd", |
David Brazdil | 66fc120 | 2022-07-04 21:48:45 +0100 | [diff] [blame] | 151 | ], |
| 152 | data: [ |
Alice Wang | 9a8b39f | 2023-04-12 15:31:48 +0000 | [diff] [blame] | 153 | ":rialto_unsigned", |
Alice Wang | 20b8ebc | 2023-11-17 09:54:47 +0000 | [diff] [blame] | 154 | ":test_rkp_cert_chain", |
David Brazdil | 66fc120 | 2022-07-04 21:48:45 +0100 | [diff] [blame] | 155 | ], |
| 156 | test_suites: ["general-tests"], |
| 157 | enabled: false, |
| 158 | target: { |
| 159 | android_arm64: { |
| 160 | enabled: true, |
| 161 | }, |
| 162 | }, |
| 163 | } |