blob: c5429796c1e63ab4836669f9425565bfd625edf0 [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
Alex Light027718c2019-03-07 16:44:46 -080077python_binary_host {
Tom Cherry8d225d82017-05-12 17:00:31 -070078 name: "avbtool",
Alex Light027718c2019-03-07 16:44:46 -080079 srcs: [":avbtool_py"],
80 main: "avbtool.py",
Tom Cherry8d225d82017-05-12 17:00:31 -070081 required: ["fec"],
Alex Light027718c2019-03-07 16:44:46 -080082 version: {
83 py2: {
84 enabled: true,
85 embedded_launcher: true,
86 },
87 py3: {
88 enabled: false,
89 },
90 },
91}
92
Jan Monsch0ec6b9a2020-01-29 14:38:46 +010093python_library_host {
94 name: "aftl_proto",
95 srcs: [
Jan Monschfd21e7b2020-04-18 01:33:33 +020096 "proto/api.proto",
97 "proto/aftl.proto",
98 "proto/aftl_google/rpc/status.proto",
99 "proto/aftl_google/api/annotations.proto",
100 "proto/aftl_google/api/http.proto",
101 "proto/crypto/sigpb/sigpb.proto",
102 "proto/crypto/keyspb/keyspb.proto",
103 "proto/trillian.proto",
Jan Monsch0ec6b9a2020-01-29 14:38:46 +0100104 ],
Jan Monschfd21e7b2020-04-18 01:33:33 +0200105 proto: {
106 include_dirs: [
107 "external/protobuf/src",
108 ],
109 local_include_dirs: [
110 "proto",
111 ],
112 canonical_path_from_root: false,
113 },
Jan Monsch0ec6b9a2020-01-29 14:38:46 +0100114 version: {
115 py2: {
Jan Monsch7ec41822020-04-15 01:16:44 +0200116 enabled: false,
Jan Monsch0ec6b9a2020-01-29 14:38:46 +0100117 },
118 py3: {
Jan Monsch7ec41822020-04-15 01:16:44 +0200119 enabled: true,
Jan Monsch0ec6b9a2020-01-29 14:38:46 +0100120 },
121 },
122}
123
Dan Austin715f5032020-01-08 10:18:05 -0800124python_binary_host {
125 name: "aftltool",
Jan Monsch5ac429e2019-12-11 19:04:26 +0100126 srcs: [
Jan Monschfd21e7b2020-04-18 01:33:33 +0200127 "aftltool.py",
Jan Monsch5ac429e2019-12-11 19:04:26 +0100128 ":avbtool_py",
Dan Austin715f5032020-01-08 10:18:05 -0800129 ],
Jan Monsch0ec6b9a2020-01-29 14:38:46 +0100130 libs: [
131 "aftl_proto",
132 ],
Dan Austin715f5032020-01-08 10:18:05 -0800133 main: "aftltool.py",
Dan Austin715f5032020-01-08 10:18:05 -0800134 version: {
135 py2: {
Jan Monsch7ec41822020-04-15 01:16:44 +0200136 enabled: false,
Dan Austin715f5032020-01-08 10:18:05 -0800137 },
138 py3: {
Jan Monsch7ec41822020-04-15 01:16:44 +0200139 enabled: true,
Dan Austin715f5032020-01-08 10:18:05 -0800140 },
141 },
142}
143
144python_test_host {
145 name: "aftltool_test",
146 main: "aftltool_test.py",
147 srcs: [
Jan Monschfd21e7b2020-04-18 01:33:33 +0200148 "aftltool.py",
Dan Austin715f5032020-01-08 10:18:05 -0800149 "aftltool_test.py",
Jan Monschfd21e7b2020-04-18 01:33:33 +0200150 ":avbtool_py",
Jan Monsch5ac429e2019-12-11 19:04:26 +0100151 ],
Jan Monsch0ec6b9a2020-01-29 14:38:46 +0100152 libs: [
153 "aftl_proto",
154 ],
155 data: [
Jan Monsch443bf322020-02-19 14:56:44 +0100156 "test/data/**/*.*",
Jan Monsch0ec6b9a2020-01-29 14:38:46 +0100157 ],
Jan Monsch5ac429e2019-12-11 19:04:26 +0100158 test_suites: ["general-tests"],
159 version: {
160 py2: {
Jan Monsch7ec41822020-04-15 01:16:44 +0200161 enabled: false,
Jan Monsch5ac429e2019-12-11 19:04:26 +0100162 },
163 py3: {
Jan Monsch7ec41822020-04-15 01:16:44 +0200164 enabled: true,
Jan Monsch5ac429e2019-12-11 19:04:26 +0100165 },
166 },
167}
168
Alex Light027718c2019-03-07 16:44:46 -0800169genrule {
170 name: "avbtool_py",
171 srcs: ["avbtool",],
172 out: ["avbtool.py"],
173 cmd: "cp $(in) $(out)",
Tom Cherry8d225d82017-05-12 17:00:31 -0700174}
175
176// Build libavb - this is a static library that depends
177// on only libc and doesn't drag in any other dependencies.
178cc_library_static {
179 name: "libavb",
180 defaults: [
181 "avb_defaults",
182 "avb_sources",
183 ],
184 host_supported: true,
Jiyong Park44e07122018-05-24 14:07:34 +0900185 recovery_available: true,
Chin-Ting Kuo3cf5c722019-09-16 11:38:01 +0800186 header_libs: [
187 "avb_headers",
188 ],
189 export_header_lib_headers: ["avb_headers"],
Tom Cherry8d225d82017-05-12 17:00:31 -0700190 target: {
Andreas Gampe364a3422018-12-26 11:12:11 -0800191 linux: {
Tom Cherry8d225d82017-05-12 17:00:31 -0700192 srcs: ["libavb/avb_sysdeps_posix.c"],
193 },
Dan Willemsen34ec1232017-10-02 10:41:07 -0700194 linux_glibc: {
Tom Cherry8d225d82017-05-12 17:00:31 -0700195 cflags: ["-fno-stack-protector"],
196 },
197 },
198}
199
200// Build libavb_user for the target - in addition to libavb, it
201// includes libavb_ab, libavb_user and also depends on libbase and
202// libfs_mgr.
203cc_library_static {
204 name: "libavb_user",
205 defaults: [
206 "avb_defaults",
207 "avb_sources",
208 ],
Jiyong Park44e07122018-05-24 14:07:34 +0900209 recovery_available: true,
Chin-Ting Kuo3cf5c722019-09-16 11:38:01 +0800210 header_libs: [
211 "avb_headers",
212 ],
213 export_header_lib_headers: ["avb_headers"],
Tom Cherry8d225d82017-05-12 17:00:31 -0700214 shared_libs: ["libbase"],
215 static_libs: ["libfs_mgr"],
David Zeuthen37f59462017-09-20 15:02:32 -0400216 cflags: [
217 "-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED",
218 ],
Tom Cherry8d225d82017-05-12 17:00:31 -0700219 srcs: [
220 "libavb/avb_sysdeps_posix.c",
221 "libavb_ab/avb_ab_flow.c",
Bowgo Tsai84c610e2017-09-28 15:13:05 +0800222 "libavb_user/avb_ops_user.cpp",
Tom Cherry8d225d82017-05-12 17:00:31 -0700223 "libavb_user/avb_user_verity.c",
David Zeuthen0922bf82017-06-19 17:50:38 -0400224 "libavb_user/avb_user_verification.c",
Tom Cherry8d225d82017-05-12 17:00:31 -0700225 ],
226}
227
228cc_binary {
229 name: "avbctl",
230 defaults: ["avb_defaults"],
231 static_libs: [
232 "libavb_user",
233 "libfs_mgr",
234 ],
235 shared_libs: ["libbase"],
236 srcs: ["tools/avbctl/avbctl.cc"],
237}
238
239cc_library_host_static {
240 name: "libavb_ab_host",
241 defaults: ["avb_defaults"],
Chin-Ting Kuo3cf5c722019-09-16 11:38:01 +0800242 header_libs: [
243 "avb_headers",
244 ],
245 export_header_lib_headers: ["avb_headers"],
Tom Cherry8d225d82017-05-12 17:00:31 -0700246 cflags: [
247 "-fno-stack-protector",
David Zeuthen37f59462017-09-20 15:02:32 -0400248 "-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED",
Tom Cherry8d225d82017-05-12 17:00:31 -0700249 ],
250 srcs: ["libavb_ab/avb_ab_flow.c"],
251}
252
Tianjie7f4e0002020-04-12 21:45:09 -0700253cc_library_static {
254 name: "libavb_aftl",
Dan Austin6bda9872020-01-22 19:14:15 -0800255 defaults: [
256 "avb_defaults",
257 "avb_sources"],
Tianjie7f4e0002020-04-12 21:45:09 -0700258 host_supported: true,
259 recovery_available: true,
Dan Austin6bda9872020-01-22 19:14:15 -0800260 header_libs: ["avb_headers"],
261 export_header_lib_headers: ["avb_headers"],
262 cflags: [
263 "-fno-stack-protector",
264 ],
265 srcs: [
Jan Monscha86b6142020-02-17 12:44:41 +0100266 "libavb_aftl/avb_aftl_util.c",
Dan Austin6bda9872020-01-22 19:14:15 -0800267 "libavb_aftl/avb_aftl_validate.c",
Dan Austina4fc5952020-02-14 11:32:17 -0800268 "libavb_aftl/avb_aftl_verify.c",
Dan Austin6bda9872020-01-22 19:14:15 -0800269 ],
270}
271
272cc_library_host_static {
Tom Cherry8d225d82017-05-12 17:00:31 -0700273 name: "libavb_atx_host",
274 defaults: ["avb_defaults"],
Chin-Ting Kuo3cf5c722019-09-16 11:38:01 +0800275 header_libs: [
276 "avb_headers",
277 ],
278 export_header_lib_headers: ["avb_headers"],
Tom Cherry8d225d82017-05-12 17:00:31 -0700279 cflags: [
280 "-fno-stack-protector",
281 ],
282 srcs: ["libavb_atx/avb_atx_validate.c"],
283}
284
285cc_library_host_static {
286 name: "libavb_host_sysdeps",
287 defaults: ["avb_defaults"],
Chin-Ting Kuo3cf5c722019-09-16 11:38:01 +0800288 header_libs: [
289 "avb_headers",
290 ],
291 export_header_lib_headers: ["avb_headers"],
Tom Cherry8d225d82017-05-12 17:00:31 -0700292 srcs: ["libavb/avb_sysdeps_posix.c"],
293}
294
Darren Krahn8160f362017-10-05 22:11:02 -0700295cc_library_host_static {
296 name: "libavb_things_example",
297 defaults: ["avb_defaults"],
Chin-Ting Kuo3cf5c722019-09-16 11:38:01 +0800298 header_libs: [
299 "avb_headers",
300 ],
301 export_header_lib_headers: ["avb_headers"],
Darren Krahn8160f362017-10-05 22:11:02 -0700302 srcs: ["examples/things/avb_atx_slot_verify.c"],
303}
304
Tom Cherry8d225d82017-05-12 17:00:31 -0700305cc_test_host {
306 name: "libavb_host_unittest",
307 defaults: ["avb_defaults"],
308 required: [
309 "simg2img",
310 "img2simg",
311 "avbtool",
312 ],
Bryan Henryb24af102018-10-25 18:20:23 -0700313 data: [
314 "avbtool",
Bryan Henry38f0c8b2018-11-28 19:14:57 -0800315 "test/avbtool_signing_helper_*.py",
Bryan Henryb24af102018-10-25 18:20:23 -0700316 "test/data/*",
317 ],
318 test_config: "test/libavb_host_unittest.xml",
Bryan Henryd7156cd2019-01-24 16:32:52 -0800319 test_suites: ["general-tests"],
Tom Cherry8d225d82017-05-12 17:00:31 -0700320 static_libs: [
321 "libavb",
322 "libavb_ab_host",
Tianjie7f4e0002020-04-12 21:45:09 -0700323 "libavb_aftl",
Tom Cherry8d225d82017-05-12 17:00:31 -0700324 "libavb_atx_host",
Darren Krahn8160f362017-10-05 22:11:02 -0700325 "libavb_things_example",
Tom Cherry8d225d82017-05-12 17:00:31 -0700326 "libgmock_host",
327 "libgtest_host",
328 ],
329 shared_libs: [
Bryan Henry573bb4c2018-12-01 11:42:18 -0800330 "libbase",
Tom Cherry8d225d82017-05-12 17:00:31 -0700331 "libchrome",
332 "libcrypto",
333 ],
David Zeuthen047ecf72017-06-28 14:10:55 -0400334 cflags: [
335 "-Wno-missing-prototypes",
David Zeuthen37f59462017-09-20 15:02:32 -0400336 "-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED",
David Zeuthen047ecf72017-06-28 14:10:55 -0400337 ],
Tom Cherry8d225d82017-05-12 17:00:31 -0700338 srcs: [
339 "test/avb_ab_flow_unittest.cc",
Jan Monscha86b6142020-02-17 12:44:41 +0100340 "test/avb_aftl_util_unittest.cc",
Dan Austin6bda9872020-01-22 19:14:15 -0800341 "test/avb_aftl_validate_unittest.cc",
Dan Austina4fc5952020-02-14 11:32:17 -0800342 "test/avb_aftl_verify_unittest.cc",
Tom Cherry8d225d82017-05-12 17:00:31 -0700343 "test/avb_atx_validate_unittest.cc",
Darren Krahn8160f362017-10-05 22:11:02 -0700344 "test/avb_atx_slot_verify_unittest.cc",
Tom Cherry8d225d82017-05-12 17:00:31 -0700345 "test/avb_slot_verify_unittest.cc",
346 "test/avb_unittest_util.cc",
347 "test/avb_util_unittest.cc",
348 "test/avb_vbmeta_image_unittest.cc",
349 "test/avbtool_unittest.cc",
350 "test/fake_avb_ops.cc",
351 "test/avb_sysdeps_posix_testing.cc",
352 ],
Tom Cherry8d225d82017-05-12 17:00:31 -0700353}
354
355cc_library_host_static {
356 name: "libavb_host_user_code_test",
357 defaults: ["avb_defaults"],
David Zeuthen37f59462017-09-20 15:02:32 -0400358 cflags: [
359 "-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED",
360 ],
Tom Cherry8d225d82017-05-12 17:00:31 -0700361 srcs: ["test/user_code_test.cc"],
362}
363
364cc_library {
365 name: "bootctrl.avb",
366 defaults: ["avb_defaults"],
367 relative_install_path: "hw",
368 static_libs: [
369 "libavb_user",
370 "libfs_mgr",
371 ],
372 shared_libs: [
373 "libbase",
374 "libcutils",
375 ],
David Zeuthen37f59462017-09-20 15:02:32 -0400376 cflags: [
377 "-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED",
378 ],
Tom Cherry8d225d82017-05-12 17:00:31 -0700379 srcs: ["boot_control/boot_control_avb.c"],
380}
Chin-Ting Kuo3cf5c722019-09-16 11:38:01 +0800381
382cc_library_headers {
383 name: "avb_headers",
384 host_supported: true,
385 recovery_available: true,
386 export_include_dirs: ["."],
387 target: {
388 windows: {
389 enabled: true,
390 },
391 },
392}