blob: 4dd4301ee46c29881720b04016b1a0d987df1ee5 [file] [log] [blame]
Tom Cherry8d225d82017-05-12 17:00:31 -07001//
2// Copyright (C) 2017 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
Bryan Henry99df6c82018-10-25 15:00:43 -070017subdirs = ["test", "tools"]
18
Tom Cherry8d225d82017-05-12 17:00:31 -070019cc_defaults {
20 name: "avb_defaults",
21 cflags: [
22 "-D_FILE_OFFSET_BITS=64",
23 "-D_POSIX_C_SOURCE=199309L",
24 "-Wa,--noexecstack",
25 "-Werror",
26 "-Wall",
27 "-Wextra",
28 "-Wformat=2",
David Zeuthen047ecf72017-06-28 14:10:55 -040029 "-Wmissing-prototypes",
Tom Cherry8d225d82017-05-12 17:00:31 -070030 "-Wno-psabi",
31 "-Wno-unused-parameter",
Yi Konged46d642018-01-03 11:52:56 -080032 "-Wno-format",
Tom Cherry8d225d82017-05-12 17:00:31 -070033 "-ffunction-sections",
34 "-fstack-protector-strong",
35 "-g",
36 "-DAVB_ENABLE_DEBUG",
37 "-DAVB_COMPILATION",
38 ],
39 cppflags: [
40 "-Wnon-virtual-dtor",
41 "-fno-strict-aliasing",
42 ],
43 ldflags: [
44 "-Wl,--gc-sections",
45 "-rdynamic",
46 ],
47 target: {
48 darwin: {
49 enabled: false,
50 },
51 },
52}
53
54cc_defaults {
55 name: "avb_sources",
56 srcs: [
57 "libavb/avb_chain_partition_descriptor.c",
Lonnie Liu97740e52017-11-09 11:16:15 -080058 "libavb/avb_cmdline.c",
Tom Cherry8d225d82017-05-12 17:00:31 -070059 "libavb/avb_crc32.c",
60 "libavb/avb_crypto.c",
61 "libavb/avb_descriptor.c",
62 "libavb/avb_footer.c",
63 "libavb/avb_hash_descriptor.c",
64 "libavb/avb_hashtree_descriptor.c",
65 "libavb/avb_kernel_cmdline_descriptor.c",
66 "libavb/avb_property_descriptor.c",
67 "libavb/avb_rsa.c",
68 "libavb/avb_sha256.c",
69 "libavb/avb_sha512.c",
70 "libavb/avb_slot_verify.c",
71 "libavb/avb_util.c",
72 "libavb/avb_vbmeta_image.c",
73 "libavb/avb_version.c",
74 ],
75}
76
77cc_prebuilt_binary {
78 name: "avbtool",
79 srcs: ["avbtool"],
80 required: ["fec"],
81 device_supported: false,
82 host_supported: true,
Tom Cherry8d225d82017-05-12 17:00:31 -070083}
84
85// Build libavb - this is a static library that depends
86// on only libc and doesn't drag in any other dependencies.
87cc_library_static {
88 name: "libavb",
89 defaults: [
90 "avb_defaults",
91 "avb_sources",
92 ],
93 host_supported: true,
Jiyong Park44e07122018-05-24 14:07:34 +090094 recovery_available: true,
Tom Cherry8d225d82017-05-12 17:00:31 -070095 export_include_dirs: ["."],
96 target: {
Andreas Gampe364a3422018-12-26 11:12:11 -080097 linux: {
Tom Cherry8d225d82017-05-12 17:00:31 -070098 srcs: ["libavb/avb_sysdeps_posix.c"],
99 },
Dan Willemsen34ec1232017-10-02 10:41:07 -0700100 linux_glibc: {
Tom Cherry8d225d82017-05-12 17:00:31 -0700101 cflags: ["-fno-stack-protector"],
102 },
103 },
104}
105
106// Build libavb_user for the target - in addition to libavb, it
107// includes libavb_ab, libavb_user and also depends on libbase and
108// libfs_mgr.
109cc_library_static {
110 name: "libavb_user",
111 defaults: [
112 "avb_defaults",
113 "avb_sources",
114 ],
Jiyong Park44e07122018-05-24 14:07:34 +0900115 recovery_available: true,
Tom Cherry8d225d82017-05-12 17:00:31 -0700116 export_include_dirs: ["."],
117 shared_libs: ["libbase"],
118 static_libs: ["libfs_mgr"],
David Zeuthen37f59462017-09-20 15:02:32 -0400119 cflags: [
120 "-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED",
121 ],
Tom Cherry8d225d82017-05-12 17:00:31 -0700122 srcs: [
123 "libavb/avb_sysdeps_posix.c",
124 "libavb_ab/avb_ab_flow.c",
Bowgo Tsai84c610e2017-09-28 15:13:05 +0800125 "libavb_user/avb_ops_user.cpp",
Tom Cherry8d225d82017-05-12 17:00:31 -0700126 "libavb_user/avb_user_verity.c",
David Zeuthen0922bf82017-06-19 17:50:38 -0400127 "libavb_user/avb_user_verification.c",
Tom Cherry8d225d82017-05-12 17:00:31 -0700128 ],
129}
130
131cc_binary {
132 name: "avbctl",
133 defaults: ["avb_defaults"],
134 static_libs: [
135 "libavb_user",
136 "libfs_mgr",
137 ],
138 shared_libs: ["libbase"],
139 srcs: ["tools/avbctl/avbctl.cc"],
140}
141
142cc_library_host_static {
143 name: "libavb_ab_host",
144 defaults: ["avb_defaults"],
145 export_include_dirs: ["."],
146 cflags: [
147 "-fno-stack-protector",
David Zeuthen37f59462017-09-20 15:02:32 -0400148 "-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED",
Tom Cherry8d225d82017-05-12 17:00:31 -0700149 ],
150 srcs: ["libavb_ab/avb_ab_flow.c"],
151}
152
153cc_library_host_static {
154 name: "libavb_atx_host",
155 defaults: ["avb_defaults"],
156 export_include_dirs: ["."],
157 cflags: [
158 "-fno-stack-protector",
159 ],
160 srcs: ["libavb_atx/avb_atx_validate.c"],
161}
162
163cc_library_host_static {
164 name: "libavb_host_sysdeps",
165 defaults: ["avb_defaults"],
166 export_include_dirs: ["."],
167 srcs: ["libavb/avb_sysdeps_posix.c"],
168}
169
Darren Krahn8160f362017-10-05 22:11:02 -0700170cc_library_host_static {
171 name: "libavb_things_example",
172 defaults: ["avb_defaults"],
173 export_include_dirs: ["."],
174 srcs: ["examples/things/avb_atx_slot_verify.c"],
175}
176
Tom Cherry8d225d82017-05-12 17:00:31 -0700177cc_test_host {
178 name: "libavb_host_unittest",
179 defaults: ["avb_defaults"],
180 required: [
181 "simg2img",
182 "img2simg",
183 "avbtool",
184 ],
Bryan Henryb24af102018-10-25 18:20:23 -0700185 data: [
186 "avbtool",
Bryan Henry38f0c8b2018-11-28 19:14:57 -0800187 "test/avbtool_signing_helper_*.py",
Bryan Henryb24af102018-10-25 18:20:23 -0700188 "test/data/*",
189 ],
190 test_config: "test/libavb_host_unittest.xml",
Tom Cherry8d225d82017-05-12 17:00:31 -0700191 static_libs: [
192 "libavb",
193 "libavb_ab_host",
194 "libavb_atx_host",
Darren Krahn8160f362017-10-05 22:11:02 -0700195 "libavb_things_example",
Tom Cherry8d225d82017-05-12 17:00:31 -0700196 "libgmock_host",
197 "libgtest_host",
198 ],
199 shared_libs: [
Bryan Henry573bb4c2018-12-01 11:42:18 -0800200 "libbase",
Tom Cherry8d225d82017-05-12 17:00:31 -0700201 "libchrome",
202 "libcrypto",
203 ],
David Zeuthen047ecf72017-06-28 14:10:55 -0400204 cflags: [
205 "-Wno-missing-prototypes",
David Zeuthen37f59462017-09-20 15:02:32 -0400206 "-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED",
David Zeuthen047ecf72017-06-28 14:10:55 -0400207 ],
Tom Cherry8d225d82017-05-12 17:00:31 -0700208 srcs: [
209 "test/avb_ab_flow_unittest.cc",
210 "test/avb_atx_validate_unittest.cc",
Darren Krahn8160f362017-10-05 22:11:02 -0700211 "test/avb_atx_slot_verify_unittest.cc",
Tom Cherry8d225d82017-05-12 17:00:31 -0700212 "test/avb_slot_verify_unittest.cc",
213 "test/avb_unittest_util.cc",
214 "test/avb_util_unittest.cc",
215 "test/avb_vbmeta_image_unittest.cc",
216 "test/avbtool_unittest.cc",
217 "test/fake_avb_ops.cc",
218 "test/avb_sysdeps_posix_testing.cc",
219 ],
Tom Cherry8d225d82017-05-12 17:00:31 -0700220}
221
222cc_library_host_static {
223 name: "libavb_host_user_code_test",
224 defaults: ["avb_defaults"],
David Zeuthen37f59462017-09-20 15:02:32 -0400225 cflags: [
226 "-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED",
227 ],
Tom Cherry8d225d82017-05-12 17:00:31 -0700228 srcs: ["test/user_code_test.cc"],
229}
230
231cc_library {
232 name: "bootctrl.avb",
233 defaults: ["avb_defaults"],
234 relative_install_path: "hw",
235 static_libs: [
236 "libavb_user",
237 "libfs_mgr",
238 ],
239 shared_libs: [
240 "libbase",
241 "libcutils",
242 ],
David Zeuthen37f59462017-09-20 15:02:32 -0400243 cflags: [
244 "-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED",
245 ],
Tom Cherry8d225d82017-05-12 17:00:31 -0700246 srcs: ["boot_control/boot_control_avb.c"],
247}