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: [ |
| 11 | "libaarch64_paging", |
Alice Wang | c8f88f5 | 2023-09-25 14:02:17 +0000 | [diff] [blame] | 12 | "libbssl_avf_nostd", |
Alice Wang | 7b2ab94 | 2023-09-12 13:04:42 +0000 | [diff] [blame] | 13 | "libbssl_ffi_nostd", |
Alice Wang | 748b032 | 2023-07-24 12:51:18 +0000 | [diff] [blame] | 14 | "libciborium_io_nostd", |
| 15 | "libciborium_nostd", |
Pierre-Clément Tosi | 1bf532b | 2023-11-13 11:06:20 +0000 | [diff] [blame] | 16 | "libcstr", |
Alice Wang | 474c0ee | 2023-09-14 12:52:33 +0000 | [diff] [blame] | 17 | "libdiced_open_dice_nostd", |
Alice Wang | 9a8b39f | 2023-04-12 15:31:48 +0000 | [diff] [blame] | 18 | "libhyp", |
Alice Wang | dda3ba9 | 2023-05-25 15:15:30 +0000 | [diff] [blame] | 19 | "libfdtpci", |
| 20 | "liblibfdt", |
David Brazdil | 05a72fd | 2022-07-09 17:33:08 +0100 | [diff] [blame] | 21 | "liblog_rust_nostd", |
Alice Wang | 748b032 | 2023-07-24 12:51:18 +0000 | [diff] [blame] | 22 | "libservice_vm_comm_nostd", |
Alice Wang | 4ac9c8b | 2023-12-05 16:23:14 +0000 | [diff] [blame] | 23 | "libservice_vm_fake_chain_nostd", |
Alice Wang | 7b4b613 | 2023-10-05 08:00:16 +0000 | [diff] [blame] | 24 | "libservice_vm_requests_nostd", |
Alice Wang | 953a657 | 2023-08-24 13:40:10 +0000 | [diff] [blame] | 25 | "libtinyvec_nostd", |
Alice Wang | d36c711 | 2023-07-04 09:50:45 +0000 | [diff] [blame] | 26 | "libvirtio_drivers", |
David Brazdil | 66fc120 | 2022-07-04 21:48:45 +0100 | [diff] [blame] | 27 | "libvmbase", |
Alice Wang | 7b2ab94 | 2023-09-12 13:04:42 +0000 | [diff] [blame] | 28 | ], |
David Brazdil | 66fc120 | 2022-07-04 21:48:45 +0100 | [diff] [blame] | 29 | } |
| 30 | |
| 31 | cc_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 Brazdil | 66fc120 | 2022-07-04 21:48:45 +0100 | [diff] [blame] | 40 | ], |
| 41 | linker_scripts: [ |
| 42 | "image.ld", |
| 43 | ":vmbase_sections", |
| 44 | ], |
David Brazdil | 66fc120 | 2022-07-04 21:48:45 +0100 | [diff] [blame] | 45 | } |
| 46 | |
| 47 | raw_binary { |
Alice Wang | 9a8b39f | 2023-04-12 15:31:48 +0000 | [diff] [blame] | 48 | name: "rialto_unsigned", |
David Brazdil | 66fc120 | 2022-07-04 21:48:45 +0100 | [diff] [blame] | 49 | src: ":rialto_elf", |
| 50 | enabled: false, |
| 51 | target: { |
| 52 | android_arm64: { |
| 53 | enabled: true, |
| 54 | }, |
| 55 | }, |
| 56 | } |
| 57 | |
Alice Wang | 9a8b39f | 2023-04-12 15:31:48 +0000 | [diff] [blame] | 58 | // python -c "import hashlib; print(hashlib.sha256(b'rialto_salt').hexdigest())" |
| 59 | rialto_salt = "ea9d8c3ae1785396884d0c16c7652921874e2b8703f336ff23760f2049ee9e29" |
| 60 | |
| 61 | filegroup { |
| 62 | name: "rialto_sign_key", |
| 63 | srcs: [":avb_testkey_rsa4096"], |
| 64 | } |
| 65 | |
Alice Wang | 12e4c86 | 2023-12-11 13:52:27 +0000 | [diff] [blame] | 66 | // Both SERVICE_VM_VERSION and SERVICE_VM_VERSION_STRING should represent the |
| 67 | // same version number for the service VM. |
| 68 | SERVICE_VM_VERSION = 1 |
| 69 | SERVICE_VM_VERSION_STRING = "1" |
| 70 | |
| 71 | genrule { |
| 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 | |
| 81 | rust_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 Wang | 9a8b39f | 2023-04-12 15:31:48 +0000 | [diff] [blame] | 88 | avb_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 Wang | 12e4c86 | 2023-12-11 13:52:27 +0000 | [diff] [blame] | 95 | rollback_index: SERVICE_VM_VERSION, |
Alice Wang | ab0d020 | 2023-05-17 08:07:41 +0000 | [diff] [blame] | 96 | props: [ |
| 97 | { |
| 98 | name: "com.android.virt.cap", |
| 99 | value: "remote_attest", |
| 100 | }, |
| 101 | ], |
Alice Wang | 9a8b39f | 2023-04-12 15:31:48 +0000 | [diff] [blame] | 102 | enabled: false, |
| 103 | arch: { |
| 104 | arm64: { |
| 105 | src: ":rialto_unsigned", |
| 106 | enabled: true, |
| 107 | }, |
| 108 | }, |
| 109 | } |
| 110 | |
| 111 | prebuilt_etc { |
Alan Stokes | 1294f94 | 2023-08-21 14:34:12 +0100 | [diff] [blame] | 112 | // 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] | 113 | 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 Brazdil | 66fc120 | 2022-07-04 21:48:45 +0100 | [diff] [blame] | 124 | rust_test { |
| 125 | name: "rialto_test", |
| 126 | crate_name: "rialto_test", |
Nikita Ioffe | da1b273 | 2023-09-04 13:46:56 +0100 | [diff] [blame] | 127 | defaults: ["avf_build_flags_rust"], |
David Brazdil | 66fc120 | 2022-07-04 21:48:45 +0100 | [diff] [blame] | 128 | srcs: ["tests/test.rs"], |
| 129 | prefer_rlib: true, |
| 130 | edition: "2021", |
| 131 | rustlibs: [ |
| 132 | "android.system.virtualizationservice-rust", |
| 133 | "libandroid_logger", |
| 134 | "libanyhow", |
Alice Wang | 20b8ebc | 2023-11-17 09:54:47 +0000 | [diff] [blame] | 135 | "libbssl_avf_nostd", |
Alice Wang | f7c0f94 | 2023-09-14 09:33:04 +0000 | [diff] [blame] | 136 | "libciborium", |
Alice Wang | de6bee5 | 2023-11-10 09:58:40 +0000 | [diff] [blame] | 137 | "libclient_vm_csr", |
Alice Wang | 20b8ebc | 2023-11-17 09:54:47 +0000 | [diff] [blame] | 138 | "libcoset", |
David Brazdil | 66fc120 | 2022-07-04 21:48:45 +0100 | [diff] [blame] | 139 | "liblibc", |
| 140 | "liblog_rust", |
Alice Wang | 748b032 | 2023-07-24 12:51:18 +0000 | [diff] [blame] | 141 | "libservice_vm_comm", |
Alice Wang | 4ac9c8b | 2023-12-05 16:23:14 +0000 | [diff] [blame] | 142 | "libservice_vm_fake_chain", |
Alice Wang | 17dc76e | 2023-09-06 09:43:52 +0000 | [diff] [blame] | 143 | "libservice_vm_manager", |
David Brazdil | 66fc120 | 2022-07-04 21:48:45 +0100 | [diff] [blame] | 144 | "libvmclient", |
Alice Wang | 20b8ebc | 2023-11-17 09:54:47 +0000 | [diff] [blame] | 145 | "libx509_parser", |
David Brazdil | 66fc120 | 2022-07-04 21:48:45 +0100 | [diff] [blame] | 146 | ], |
| 147 | data: [ |
Alice Wang | 9a8b39f | 2023-04-12 15:31:48 +0000 | [diff] [blame] | 148 | ":rialto_unsigned", |
Alice Wang | 20b8ebc | 2023-11-17 09:54:47 +0000 | [diff] [blame] | 149 | ":test_rkp_cert_chain", |
David Brazdil | 66fc120 | 2022-07-04 21:48:45 +0100 | [diff] [blame] | 150 | ], |
| 151 | test_suites: ["general-tests"], |
| 152 | enabled: false, |
| 153 | target: { |
| 154 | android_arm64: { |
| 155 | enabled: true, |
| 156 | }, |
| 157 | }, |
| 158 | } |