blob: 0527dfbf4aa618b41555ff811f2d9c4a6d88b50e [file] [log] [blame]
Alice Wangf3d96b12022-12-15 13:10:47 +00001package {
2 default_applicable_licenses: ["Android-Apache-2.0"],
3}
4
5rust_defaults {
6 name: "libpvmfw_avb_nostd_defaults",
7 crate_name: "pvmfw_avb",
8 srcs: ["src/lib.rs"],
9 prefer_rlib: true,
10 rustlibs: [
11 "libavb_bindgen",
12 ],
Alice Wanga78279c2022-12-16 12:41:19 +000013 whole_static_libs: [
14 "libavb",
15 ],
Alice Wangf3d96b12022-12-15 13:10:47 +000016}
17
18rust_library_rlib {
19 name: "libpvmfw_avb_nostd",
20 defaults: ["libpvmfw_avb_nostd_defaults"],
21 no_stdlibs: true,
22 stdlibs: [
23 "libcore.rust_sysroot",
24 ],
25}
26
27rust_test {
Alice Wangbf7fadd2023-01-13 12:18:24 +000028 name: "libpvmfw_avb.integration_test",
29 crate_name: "pvmfw_avb_test",
30 srcs: ["tests/*_test.rs"],
Alice Wangf3d96b12022-12-15 13:10:47 +000031 test_suites: ["general-tests"],
Alice Wanga78279c2022-12-16 12:41:19 +000032 data: [
33 ":avb_testkey_rsa2048_pub_bin",
34 ":avb_testkey_rsa4096_pub_bin",
35 ":microdroid_kernel_signed",
Alice Wang6b486f12023-01-06 13:12:16 +000036 ":microdroid_initrd_normal",
Alice Wang4e55dd92023-01-11 10:17:01 +000037 ":microdroid_initrd_debuggable",
Alice Wang6b486f12023-01-06 13:12:16 +000038 ":test_image_with_one_hashdesc",
Alice Wang86383df2023-01-11 10:03:56 +000039 ":test_image_with_non_initrd_hashdesc",
40 ":test_image_with_prop_desc",
Alice Wanga78279c2022-12-16 12:41:19 +000041 ":unsigned_test_image",
42 ],
Alice Wangbf7fadd2023-01-13 12:18:24 +000043 prefer_rlib: true,
Alice Wanga78279c2022-12-16 12:41:19 +000044 rustlibs: [
45 "libanyhow",
Alice Wangbf7fadd2023-01-13 12:18:24 +000046 "libavb_bindgen",
47 "libpvmfw_avb_nostd",
Alice Wanga78279c2022-12-16 12:41:19 +000048 ],
49 enabled: false,
50 arch: {
51 // Microdroid kernel is only available in these architectures.
52 arm64: {
53 enabled: true,
54 },
55 x86_64: {
56 enabled: true,
57 },
58 },
59}
60
61// Generates a 16KB unsigned image for testing.
62genrule {
63 name: "unsigned_test_image",
64 tools: ["avbtool"],
65 out: ["unsigned_test.img"],
66 cmd: "$(location avbtool) generate_test_image --image_size 16384 --output $(out)",
Alice Wangf3d96b12022-12-15 13:10:47 +000067}
Alice Wang6b486f12023-01-06 13:12:16 +000068
Alice Wang86383df2023-01-11 10:03:56 +000069avb_gen_vbmeta_image {
70 name: "test_non_initrd_hashdesc",
71 src: ":unsigned_test_image",
72 partition_name: "non_initrd11",
73 salt: "2222",
74}
75
76avb_add_hash_footer {
77 name: "test_image_with_non_initrd_hashdesc",
78 src: ":unsigned_test_image",
79 partition_name: "boot",
80 private_key: ":pvmfw_sign_key",
81 salt: "1111",
82 include_descriptors_from_images: [
83 ":test_non_initrd_hashdesc",
84 ],
85}
86
87avb_add_hash_footer {
88 name: "test_image_with_prop_desc",
89 src: ":unsigned_test_image",
90 partition_name: "boot",
91 private_key: ":pvmfw_sign_key",
92 salt: "1111",
93 props: [
94 {
95 name: "mock_prop",
96 value: "3333",
97 },
98 ],
99}
100
Alice Wang6b486f12023-01-06 13:12:16 +0000101avb_add_hash_footer {
102 name: "test_image_with_one_hashdesc",
103 src: ":unsigned_test_image",
Alice Wang8aa3cb12023-01-11 09:04:04 +0000104 partition_name: "boot",
Alice Wang6b486f12023-01-06 13:12:16 +0000105 private_key: ":pvmfw_sign_key",
106 salt: "1111",
107}