blob: dfb1cc1370b3921dc5a8b594086156722133439a [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
Dan Austin715f5032020-01-08 10:18:05 -080093genrule {
94 name: "aftltool_py",
95 srcs: ["aftltool",],
96 out: ["aftltool.py"],
97 cmd: "cp $(in) $(out)",
98}
99
Jan Monsch0ec6b9a2020-01-29 14:38:46 +0100100python_library_host {
101 name: "aftl_proto",
102 srcs: [
103 "proto/**/*.py",
104 ],
105 version: {
106 py2: {
107 enabled: true,
108 // This is needs to be false due to b/146057182#comment5.
109 embedded_launcher: false,
110 },
111 py3: {
112 enabled: false,
113 },
114 },
115}
116
Dan Austin715f5032020-01-08 10:18:05 -0800117python_binary_host {
118 name: "aftltool",
Jan Monsch5ac429e2019-12-11 19:04:26 +0100119 srcs: [
Dan Austin715f5032020-01-08 10:18:05 -0800120 ":aftltool_py",
Jan Monsch5ac429e2019-12-11 19:04:26 +0100121 ":avbtool_py",
Dan Austin715f5032020-01-08 10:18:05 -0800122 ],
Jan Monsch0ec6b9a2020-01-29 14:38:46 +0100123 libs: [
124 "aftl_proto",
125 ],
Dan Austin715f5032020-01-08 10:18:05 -0800126 main: "aftltool.py",
127 required: ["fec"],
128 version: {
129 py2: {
130 enabled: true,
131 embedded_launcher: false,
132 },
133 py3: {
134 enabled: false,
135 },
136 },
137}
138
139python_test_host {
140 name: "aftltool_test",
141 main: "aftltool_test.py",
142 srcs: [
143 ":aftltool_py",
144 ":avbtool_py",
145 "aftltool_test.py",
Jan Monsch5ac429e2019-12-11 19:04:26 +0100146 ],
Jan Monsch0ec6b9a2020-01-29 14:38:46 +0100147 libs: [
148 "aftl_proto",
149 ],
150 data: [
Jan Monsch443bf322020-02-19 14:56:44 +0100151 "test/data/**/*.*",
Jan Monsch0ec6b9a2020-01-29 14:38:46 +0100152 ],
Jan Monsch5ac429e2019-12-11 19:04:26 +0100153 test_suites: ["general-tests"],
154 version: {
155 py2: {
156 enabled: true,
Jan Monsch0ec6b9a2020-01-29 14:38:46 +0100157 // This is needs to be false due to b/146057182#comment5.
Jan Monsch5ac429e2019-12-11 19:04:26 +0100158 embedded_launcher: false,
159 },
160 py3: {
161 enabled: false,
162 },
163 },
164}
165
Alex Light027718c2019-03-07 16:44:46 -0800166genrule {
167 name: "avbtool_py",
168 srcs: ["avbtool",],
169 out: ["avbtool.py"],
170 cmd: "cp $(in) $(out)",
Tom Cherry8d225d82017-05-12 17:00:31 -0700171}
172
173// Build libavb - this is a static library that depends
174// on only libc and doesn't drag in any other dependencies.
175cc_library_static {
176 name: "libavb",
177 defaults: [
178 "avb_defaults",
179 "avb_sources",
180 ],
181 host_supported: true,
Jiyong Park44e07122018-05-24 14:07:34 +0900182 recovery_available: true,
Chin-Ting Kuo3cf5c722019-09-16 11:38:01 +0800183 header_libs: [
184 "avb_headers",
185 ],
186 export_header_lib_headers: ["avb_headers"],
Tom Cherry8d225d82017-05-12 17:00:31 -0700187 target: {
Andreas Gampe364a3422018-12-26 11:12:11 -0800188 linux: {
Tom Cherry8d225d82017-05-12 17:00:31 -0700189 srcs: ["libavb/avb_sysdeps_posix.c"],
190 },
Dan Willemsen34ec1232017-10-02 10:41:07 -0700191 linux_glibc: {
Tom Cherry8d225d82017-05-12 17:00:31 -0700192 cflags: ["-fno-stack-protector"],
193 },
194 },
195}
196
197// Build libavb_user for the target - in addition to libavb, it
198// includes libavb_ab, libavb_user and also depends on libbase and
199// libfs_mgr.
200cc_library_static {
201 name: "libavb_user",
202 defaults: [
203 "avb_defaults",
204 "avb_sources",
205 ],
Jiyong Park44e07122018-05-24 14:07:34 +0900206 recovery_available: true,
Chin-Ting Kuo3cf5c722019-09-16 11:38:01 +0800207 header_libs: [
208 "avb_headers",
209 ],
210 export_header_lib_headers: ["avb_headers"],
Tom Cherry8d225d82017-05-12 17:00:31 -0700211 shared_libs: ["libbase"],
212 static_libs: ["libfs_mgr"],
David Zeuthen37f59462017-09-20 15:02:32 -0400213 cflags: [
214 "-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED",
215 ],
Tom Cherry8d225d82017-05-12 17:00:31 -0700216 srcs: [
217 "libavb/avb_sysdeps_posix.c",
218 "libavb_ab/avb_ab_flow.c",
Bowgo Tsai84c610e2017-09-28 15:13:05 +0800219 "libavb_user/avb_ops_user.cpp",
Tom Cherry8d225d82017-05-12 17:00:31 -0700220 "libavb_user/avb_user_verity.c",
David Zeuthen0922bf82017-06-19 17:50:38 -0400221 "libavb_user/avb_user_verification.c",
Tom Cherry8d225d82017-05-12 17:00:31 -0700222 ],
223}
224
225cc_binary {
226 name: "avbctl",
227 defaults: ["avb_defaults"],
228 static_libs: [
229 "libavb_user",
230 "libfs_mgr",
231 ],
232 shared_libs: ["libbase"],
233 srcs: ["tools/avbctl/avbctl.cc"],
234}
235
236cc_library_host_static {
237 name: "libavb_ab_host",
238 defaults: ["avb_defaults"],
Chin-Ting Kuo3cf5c722019-09-16 11:38:01 +0800239 header_libs: [
240 "avb_headers",
241 ],
242 export_header_lib_headers: ["avb_headers"],
Tom Cherry8d225d82017-05-12 17:00:31 -0700243 cflags: [
244 "-fno-stack-protector",
David Zeuthen37f59462017-09-20 15:02:32 -0400245 "-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED",
Tom Cherry8d225d82017-05-12 17:00:31 -0700246 ],
247 srcs: ["libavb_ab/avb_ab_flow.c"],
248}
249
250cc_library_host_static {
Dan Austin6bda9872020-01-22 19:14:15 -0800251 name: "libavb_aftl_host",
252 defaults: [
253 "avb_defaults",
254 "avb_sources"],
255 header_libs: ["avb_headers"],
256 export_header_lib_headers: ["avb_headers"],
257 cflags: [
258 "-fno-stack-protector",
259 ],
260 srcs: [
Jan Monscha86b6142020-02-17 12:44:41 +0100261 "libavb_aftl/avb_aftl_util.c",
Dan Austin6bda9872020-01-22 19:14:15 -0800262 "libavb_aftl/avb_aftl_validate.c",
Dan Austina4fc5952020-02-14 11:32:17 -0800263 "libavb_aftl/avb_aftl_verify.c",
Dan Austin6bda9872020-01-22 19:14:15 -0800264 ],
265}
266
267cc_library_host_static {
Tom Cherry8d225d82017-05-12 17:00:31 -0700268 name: "libavb_atx_host",
269 defaults: ["avb_defaults"],
Chin-Ting Kuo3cf5c722019-09-16 11:38:01 +0800270 header_libs: [
271 "avb_headers",
272 ],
273 export_header_lib_headers: ["avb_headers"],
Tom Cherry8d225d82017-05-12 17:00:31 -0700274 cflags: [
275 "-fno-stack-protector",
276 ],
277 srcs: ["libavb_atx/avb_atx_validate.c"],
278}
279
280cc_library_host_static {
281 name: "libavb_host_sysdeps",
282 defaults: ["avb_defaults"],
Chin-Ting Kuo3cf5c722019-09-16 11:38:01 +0800283 header_libs: [
284 "avb_headers",
285 ],
286 export_header_lib_headers: ["avb_headers"],
Tom Cherry8d225d82017-05-12 17:00:31 -0700287 srcs: ["libavb/avb_sysdeps_posix.c"],
288}
289
Darren Krahn8160f362017-10-05 22:11:02 -0700290cc_library_host_static {
291 name: "libavb_things_example",
292 defaults: ["avb_defaults"],
Chin-Ting Kuo3cf5c722019-09-16 11:38:01 +0800293 header_libs: [
294 "avb_headers",
295 ],
296 export_header_lib_headers: ["avb_headers"],
Darren Krahn8160f362017-10-05 22:11:02 -0700297 srcs: ["examples/things/avb_atx_slot_verify.c"],
298}
299
Tom Cherry8d225d82017-05-12 17:00:31 -0700300cc_test_host {
301 name: "libavb_host_unittest",
302 defaults: ["avb_defaults"],
303 required: [
304 "simg2img",
305 "img2simg",
306 "avbtool",
307 ],
Bryan Henryb24af102018-10-25 18:20:23 -0700308 data: [
309 "avbtool",
Bryan Henry38f0c8b2018-11-28 19:14:57 -0800310 "test/avbtool_signing_helper_*.py",
Bryan Henryb24af102018-10-25 18:20:23 -0700311 "test/data/*",
312 ],
313 test_config: "test/libavb_host_unittest.xml",
Bryan Henryd7156cd2019-01-24 16:32:52 -0800314 test_suites: ["general-tests"],
Tom Cherry8d225d82017-05-12 17:00:31 -0700315 static_libs: [
316 "libavb",
317 "libavb_ab_host",
Dan Austin6bda9872020-01-22 19:14:15 -0800318 "libavb_aftl_host",
Tom Cherry8d225d82017-05-12 17:00:31 -0700319 "libavb_atx_host",
Darren Krahn8160f362017-10-05 22:11:02 -0700320 "libavb_things_example",
Tom Cherry8d225d82017-05-12 17:00:31 -0700321 "libgmock_host",
322 "libgtest_host",
323 ],
324 shared_libs: [
Bryan Henry573bb4c2018-12-01 11:42:18 -0800325 "libbase",
Tom Cherry8d225d82017-05-12 17:00:31 -0700326 "libchrome",
327 "libcrypto",
328 ],
David Zeuthen047ecf72017-06-28 14:10:55 -0400329 cflags: [
330 "-Wno-missing-prototypes",
David Zeuthen37f59462017-09-20 15:02:32 -0400331 "-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED",
David Zeuthen047ecf72017-06-28 14:10:55 -0400332 ],
Tom Cherry8d225d82017-05-12 17:00:31 -0700333 srcs: [
334 "test/avb_ab_flow_unittest.cc",
Jan Monscha86b6142020-02-17 12:44:41 +0100335 "test/avb_aftl_util_unittest.cc",
Dan Austin6bda9872020-01-22 19:14:15 -0800336 "test/avb_aftl_validate_unittest.cc",
Dan Austina4fc5952020-02-14 11:32:17 -0800337 "test/avb_aftl_verify_unittest.cc",
Tom Cherry8d225d82017-05-12 17:00:31 -0700338 "test/avb_atx_validate_unittest.cc",
Darren Krahn8160f362017-10-05 22:11:02 -0700339 "test/avb_atx_slot_verify_unittest.cc",
Tom Cherry8d225d82017-05-12 17:00:31 -0700340 "test/avb_slot_verify_unittest.cc",
341 "test/avb_unittest_util.cc",
342 "test/avb_util_unittest.cc",
343 "test/avb_vbmeta_image_unittest.cc",
344 "test/avbtool_unittest.cc",
345 "test/fake_avb_ops.cc",
346 "test/avb_sysdeps_posix_testing.cc",
347 ],
Tom Cherry8d225d82017-05-12 17:00:31 -0700348}
349
350cc_library_host_static {
351 name: "libavb_host_user_code_test",
352 defaults: ["avb_defaults"],
David Zeuthen37f59462017-09-20 15:02:32 -0400353 cflags: [
354 "-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED",
355 ],
Tom Cherry8d225d82017-05-12 17:00:31 -0700356 srcs: ["test/user_code_test.cc"],
357}
358
359cc_library {
360 name: "bootctrl.avb",
361 defaults: ["avb_defaults"],
362 relative_install_path: "hw",
363 static_libs: [
364 "libavb_user",
365 "libfs_mgr",
366 ],
367 shared_libs: [
368 "libbase",
369 "libcutils",
370 ],
David Zeuthen37f59462017-09-20 15:02:32 -0400371 cflags: [
372 "-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED",
373 ],
Tom Cherry8d225d82017-05-12 17:00:31 -0700374 srcs: ["boot_control/boot_control_avb.c"],
375}
Chin-Ting Kuo3cf5c722019-09-16 11:38:01 +0800376
377cc_library_headers {
378 name: "avb_headers",
379 host_supported: true,
380 recovery_available: true,
381 export_include_dirs: ["."],
382 target: {
383 windows: {
384 enabled: true,
385 },
386 },
387}