blob: fb950b7a1f7c425a01d830a375927140d2fe54c3 [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",
Alice Wangf2752862023-01-18 11:51:25 +000012 "libtinyvec_nostd",
Alice Wangf3d96b12022-12-15 13:10:47 +000013 ],
Alice Wanga78279c2022-12-16 12:41:19 +000014 whole_static_libs: [
15 "libavb",
16 ],
Alice Wangf3d96b12022-12-15 13:10:47 +000017}
18
19rust_library_rlib {
20 name: "libpvmfw_avb_nostd",
21 defaults: ["libpvmfw_avb_nostd_defaults"],
22 no_stdlibs: true,
23 stdlibs: [
24 "libcore.rust_sysroot",
25 ],
26}
27
28rust_test {
Alice Wangbf7fadd2023-01-13 12:18:24 +000029 name: "libpvmfw_avb.integration_test",
30 crate_name: "pvmfw_avb_test",
Alice Wang2925b0a2023-01-19 10:44:24 +000031 srcs: ["tests/*.rs"],
Alice Wangf3d96b12022-12-15 13:10:47 +000032 test_suites: ["general-tests"],
Alice Wanga78279c2022-12-16 12:41:19 +000033 data: [
34 ":avb_testkey_rsa2048_pub_bin",
35 ":avb_testkey_rsa4096_pub_bin",
36 ":microdroid_kernel_signed",
Alice Wang6b486f12023-01-06 13:12:16 +000037 ":microdroid_initrd_normal",
Alice Wang4e55dd92023-01-11 10:17:01 +000038 ":microdroid_initrd_debuggable",
Alice Wang6b486f12023-01-06 13:12:16 +000039 ":test_image_with_one_hashdesc",
Alice Wang86383df2023-01-11 10:03:56 +000040 ":test_image_with_non_initrd_hashdesc",
Alice Wangf2752862023-01-18 11:51:25 +000041 ":test_image_with_initrd_and_non_initrd_desc",
Alice Wang86383df2023-01-11 10:03:56 +000042 ":test_image_with_prop_desc",
Alice Wanga78279c2022-12-16 12:41:19 +000043 ":unsigned_test_image",
44 ],
Alice Wangbf7fadd2023-01-13 12:18:24 +000045 prefer_rlib: true,
Alice Wanga78279c2022-12-16 12:41:19 +000046 rustlibs: [
47 "libanyhow",
Alice Wangbf7fadd2023-01-13 12:18:24 +000048 "libavb_bindgen",
49 "libpvmfw_avb_nostd",
Alice Wanga78279c2022-12-16 12:41:19 +000050 ],
51 enabled: false,
52 arch: {
53 // Microdroid kernel is only available in these architectures.
54 arm64: {
55 enabled: true,
56 },
57 x86_64: {
58 enabled: true,
59 },
60 },
61}
62
63// Generates a 16KB unsigned image for testing.
64genrule {
65 name: "unsigned_test_image",
66 tools: ["avbtool"],
67 out: ["unsigned_test.img"],
68 cmd: "$(location avbtool) generate_test_image --image_size 16384 --output $(out)",
Alice Wangf3d96b12022-12-15 13:10:47 +000069}
Alice Wang6b486f12023-01-06 13:12:16 +000070
Alice Wang86383df2023-01-11 10:03:56 +000071avb_gen_vbmeta_image {
72 name: "test_non_initrd_hashdesc",
73 src: ":unsigned_test_image",
74 partition_name: "non_initrd11",
75 salt: "2222",
76}
77
78avb_add_hash_footer {
79 name: "test_image_with_non_initrd_hashdesc",
80 src: ":unsigned_test_image",
81 partition_name: "boot",
82 private_key: ":pvmfw_sign_key",
Alice Wangf2752862023-01-18 11:51:25 +000083 salt: "3322",
Alice Wang86383df2023-01-11 10:03:56 +000084 include_descriptors_from_images: [
85 ":test_non_initrd_hashdesc",
86 ],
87}
88
89avb_add_hash_footer {
Alice Wangf2752862023-01-18 11:51:25 +000090 name: "test_image_with_initrd_and_non_initrd_desc",
91 src: ":unsigned_test_image",
92 partition_name: "boot",
93 private_key: ":pvmfw_sign_key",
94 salt: "3241",
95 include_descriptors_from_images: [
96 ":microdroid_initrd_normal_hashdesc",
97 ":test_non_initrd_hashdesc",
98 ],
99 enabled: false,
100 arch: {
101 // microdroid_initrd_normal_hashdesc is only available in these architectures.
102 arm64: {
103 enabled: true,
104 },
105 x86_64: {
106 enabled: true,
107 },
108 },
109}
110
111avb_add_hash_footer {
Alice Wang86383df2023-01-11 10:03:56 +0000112 name: "test_image_with_prop_desc",
113 src: ":unsigned_test_image",
114 partition_name: "boot",
115 private_key: ":pvmfw_sign_key",
Alice Wangf2752862023-01-18 11:51:25 +0000116 salt: "2134",
Alice Wang86383df2023-01-11 10:03:56 +0000117 props: [
118 {
119 name: "mock_prop",
120 value: "3333",
121 },
122 ],
123}
124
Alice Wang6b486f12023-01-06 13:12:16 +0000125avb_add_hash_footer {
126 name: "test_image_with_one_hashdesc",
127 src: ":unsigned_test_image",
Alice Wang8aa3cb12023-01-11 09:04:04 +0000128 partition_name: "boot",
Alice Wang6b486f12023-01-06 13:12:16 +0000129 private_key: ":pvmfw_sign_key",
130 salt: "1111",
131}