blob: b73a924d6914cd499d963165cc321ec5a06095a2 [file] [log] [blame]
Tom Cherry8d225d82017-05-12 17:00:31 -07001//
Jan Monschcd7c9132020-05-08 02:34:40 +02002// Copyright (C) 2017-2020 The Android Open Source Project
Tom Cherry8d225d82017-05-12 17:00:31 -07003//
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
Bob Badourb30c9712021-02-12 14:49:55 -080017package {
18 default_applicable_licenses: ["external_avb_license"],
19}
20
21// Added automatically by a large-scale-change that took the approach of
22// 'apply every license found to every target'. While this makes sure we respect
23// every license restriction, it may not be entirely correct.
24//
25// e.g. GPL in an MIT project might only apply to the contrib/ directory.
26//
27// Please consider splitting the single license below into multiple licenses,
28// taking care not to lose any license_kind information, and overriding the
29// default license using the 'licenses: [...]' property on targets as needed.
30//
31// For unused files, consider creating a 'fileGroup' with "//visibility:private"
32// to attach the license to, and including a comment whether the files may be
33// used in the current project.
34// See: http://go/android-license-faq
35license {
36 name: "external_avb_license",
37 visibility: [":__subpackages__"],
38 license_kinds: [
39 "SPDX-license-identifier-Apache-2.0",
40 "SPDX-license-identifier-BSD",
41 "SPDX-license-identifier-MIT",
42 ],
43 license_text: [
44 "LICENSE",
45 ],
46}
47
ThiƩbaud Weksteen23dbe6e2020-05-15 15:52:02 +020048subdirs = [
49 "test",
50 "tools",
51]
Bryan Henry99df6c82018-10-25 15:00:43 -070052
Tom Cherry8d225d82017-05-12 17:00:31 -070053cc_defaults {
54 name: "avb_defaults",
55 cflags: [
56 "-D_FILE_OFFSET_BITS=64",
57 "-D_POSIX_C_SOURCE=199309L",
58 "-Wa,--noexecstack",
59 "-Werror",
60 "-Wall",
61 "-Wextra",
62 "-Wformat=2",
David Zeuthen047ecf72017-06-28 14:10:55 -040063 "-Wmissing-prototypes",
Tom Cherry8d225d82017-05-12 17:00:31 -070064 "-Wno-psabi",
65 "-Wno-unused-parameter",
Yi Konged46d642018-01-03 11:52:56 -080066 "-Wno-format",
Tom Cherry8d225d82017-05-12 17:00:31 -070067 "-ffunction-sections",
68 "-fstack-protector-strong",
69 "-g",
70 "-DAVB_ENABLE_DEBUG",
71 "-DAVB_COMPILATION",
72 ],
73 cppflags: [
74 "-Wnon-virtual-dtor",
75 "-fno-strict-aliasing",
76 ],
77 ldflags: [
78 "-Wl,--gc-sections",
79 "-rdynamic",
80 ],
81 target: {
82 darwin: {
83 enabled: false,
84 },
85 },
86}
87
88cc_defaults {
89 name: "avb_sources",
90 srcs: [
91 "libavb/avb_chain_partition_descriptor.c",
Lonnie Liu97740e52017-11-09 11:16:15 -080092 "libavb/avb_cmdline.c",
Tom Cherry8d225d82017-05-12 17:00:31 -070093 "libavb/avb_crc32.c",
94 "libavb/avb_crypto.c",
95 "libavb/avb_descriptor.c",
96 "libavb/avb_footer.c",
97 "libavb/avb_hash_descriptor.c",
98 "libavb/avb_hashtree_descriptor.c",
99 "libavb/avb_kernel_cmdline_descriptor.c",
100 "libavb/avb_property_descriptor.c",
101 "libavb/avb_rsa.c",
Tom Cherry8d225d82017-05-12 17:00:31 -0700102 "libavb/avb_slot_verify.c",
103 "libavb/avb_util.c",
104 "libavb/avb_vbmeta_image.c",
105 "libavb/avb_version.c",
106 ],
107}
108
Andrew Scull725bff42021-04-29 20:39:42 +0000109cc_defaults {
110 name: "avb_crypto_ops_impl_boringssl",
111 srcs: [
112 "libavb/boringssl/sha.c",
113 ],
114 local_include_dirs: [
115 "libavb/boringssl",
116 ],
117 shared_libs: [
118 "libcrypto",
119 ],
120}
121
122cc_defaults {
123 name: "avb_crypto_ops_impl_sha",
124 srcs: [
125 "libavb/sha/sha256_impl.c",
126 "libavb/sha/sha512_impl.c",
127 ],
128 local_include_dirs: [
129 "libavb/sha",
130 ],
131}
132
Alex Light027718c2019-03-07 16:44:46 -0800133python_binary_host {
Tom Cherry8d225d82017-05-12 17:00:31 -0700134 name: "avbtool",
Jan Monscha18b2ec2020-04-22 11:43:35 +0200135 srcs: ["avbtool.py"],
Alex Light027718c2019-03-07 16:44:46 -0800136 main: "avbtool.py",
Tom Cherry8d225d82017-05-12 17:00:31 -0700137 required: ["fec"],
Alex Light027718c2019-03-07 16:44:46 -0800138 version: {
139 py2: {
Jan Monsch13efb5f2020-04-22 17:34:24 +0200140 enabled: false,
Alex Light027718c2019-03-07 16:44:46 -0800141 },
142 py3: {
Jan Monsch13efb5f2020-04-22 17:34:24 +0200143 enabled: true,
Bowgo Tsaie4c67ec2021-01-28 13:29:01 +0800144 embedded_launcher: true,
Julien Desprez0d584b62021-01-15 17:56:56 -0800145 },
146 },
Julien Desprez809d2692021-01-27 14:07:27 -0800147 compile_multilib: "first",
Alex Light027718c2019-03-07 16:44:46 -0800148}
149
Andrew Scull2787f222022-01-11 17:48:22 +0000150// Build libavb - this is a static library that depends
151// on only libc and libcrypto, but no other dependencies.
Tom Cherry8d225d82017-05-12 17:00:31 -0700152cc_library_static {
153 name: "libavb",
154 defaults: [
155 "avb_defaults",
156 "avb_sources",
Andrew Scull725bff42021-04-29 20:39:42 +0000157 "avb_crypto_ops_impl_boringssl",
Tom Cherry8d225d82017-05-12 17:00:31 -0700158 ],
159 host_supported: true,
Inseob Kimf1bca772021-06-14 11:53:04 +0900160 ramdisk_available: true,
David Andersonddab37d2021-07-23 16:51:13 -0700161 vendor_ramdisk_available: true,
Jiyong Park44e07122018-05-24 14:07:34 +0900162 recovery_available: true,
Chin-Ting Kuo3cf5c722019-09-16 11:38:01 +0800163 header_libs: [
164 "avb_headers",
165 ],
166 export_header_lib_headers: ["avb_headers"],
Tom Cherry8d225d82017-05-12 17:00:31 -0700167 target: {
Andreas Gampe364a3422018-12-26 11:12:11 -0800168 linux: {
Tom Cherry8d225d82017-05-12 17:00:31 -0700169 srcs: ["libavb/avb_sysdeps_posix.c"],
170 },
Colin Cross23393c62022-03-08 15:12:26 -0800171 host_linux: {
Tom Cherry8d225d82017-05-12 17:00:31 -0700172 cflags: ["-fno-stack-protector"],
173 },
174 },
175}
176
177// Build libavb_user for the target - in addition to libavb, it
178// includes libavb_ab, libavb_user and also depends on libbase and
179// libfs_mgr.
180cc_library_static {
181 name: "libavb_user",
182 defaults: [
183 "avb_defaults",
184 "avb_sources",
Andrew Scull725bff42021-04-29 20:39:42 +0000185 "avb_crypto_ops_impl_boringssl",
Tom Cherry8d225d82017-05-12 17:00:31 -0700186 ],
Jiyong Park44e07122018-05-24 14:07:34 +0900187 recovery_available: true,
Chin-Ting Kuo3cf5c722019-09-16 11:38:01 +0800188 header_libs: [
189 "avb_headers",
190 ],
191 export_header_lib_headers: ["avb_headers"],
Tom Cherry8d225d82017-05-12 17:00:31 -0700192 shared_libs: ["libbase"],
193 static_libs: ["libfs_mgr"],
David Zeuthen37f59462017-09-20 15:02:32 -0400194 cflags: [
195 "-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED",
196 ],
Tom Cherry8d225d82017-05-12 17:00:31 -0700197 srcs: [
198 "libavb/avb_sysdeps_posix.c",
199 "libavb_ab/avb_ab_flow.c",
Bowgo Tsai84c610e2017-09-28 15:13:05 +0800200 "libavb_user/avb_ops_user.cpp",
Tom Cherry8d225d82017-05-12 17:00:31 -0700201 "libavb_user/avb_user_verity.c",
David Zeuthen0922bf82017-06-19 17:50:38 -0400202 "libavb_user/avb_user_verification.c",
Tom Cherry8d225d82017-05-12 17:00:31 -0700203 ],
204}
205
206cc_binary {
207 name: "avbctl",
208 defaults: ["avb_defaults"],
209 static_libs: [
210 "libavb_user",
211 "libfs_mgr",
212 ],
Andrew Scull725bff42021-04-29 20:39:42 +0000213 shared_libs: [
214 "libbase",
215 "libcrypto",
216 ],
Tom Cherry8d225d82017-05-12 17:00:31 -0700217 srcs: ["tools/avbctl/avbctl.cc"],
218}
219
220cc_library_host_static {
221 name: "libavb_ab_host",
222 defaults: ["avb_defaults"],
Chin-Ting Kuo3cf5c722019-09-16 11:38:01 +0800223 header_libs: [
224 "avb_headers",
225 ],
226 export_header_lib_headers: ["avb_headers"],
Tom Cherry8d225d82017-05-12 17:00:31 -0700227 cflags: [
228 "-fno-stack-protector",
David Zeuthen37f59462017-09-20 15:02:32 -0400229 "-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED",
Tom Cherry8d225d82017-05-12 17:00:31 -0700230 ],
231 srcs: ["libavb_ab/avb_ab_flow.c"],
232}
233
Andrew Scull2787f222022-01-11 17:48:22 +0000234cc_defaults {
235 name: "avb_atx_sources",
Tom Cherry8d225d82017-05-12 17:00:31 -0700236 srcs: ["libavb_atx/avb_atx_validate.c"],
237}
238
239cc_library_host_static {
240 name: "libavb_host_sysdeps",
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 srcs: ["libavb/avb_sysdeps_posix.c"],
247}
248
Andrew Scull2787f222022-01-11 17:48:22 +0000249cc_defaults {
250 name: "avb_things_example_sources",
Darren Krahn8160f362017-10-05 22:11:02 -0700251 srcs: ["examples/things/avb_atx_slot_verify.c"],
252}
253
Andrew Scull725bff42021-04-29 20:39:42 +0000254cc_defaults {
255 name: "libavb_host_unittest_core",
Andrew Scull2787f222022-01-11 17:48:22 +0000256 defaults: [
257 "avb_defaults",
258 "avb_sources",
259 "avb_atx_sources",
260 "avb_things_example_sources",
261 ],
Tom Cherry8d225d82017-05-12 17:00:31 -0700262 required: [
263 "simg2img",
264 "img2simg",
265 "avbtool",
266 ],
Julien Desprez15e81d92021-01-21 11:29:14 -0800267 test_options: {
268 unit_test: true,
269 },
270 compile_multilib: "first",
Bryan Henryb24af102018-10-25 18:20:23 -0700271 data: [
272 "avbtool",
Jan Monschcd7c9132020-05-08 02:34:40 +0200273 "test/avbtool_signing_helper_test.py",
274 "test/avbtool_signing_helper_with_files_test.py",
Bryan Henryb24af102018-10-25 18:20:23 -0700275 "test/data/*",
276 ],
277 test_config: "test/libavb_host_unittest.xml",
Bryan Henryd7156cd2019-01-24 16:32:52 -0800278 test_suites: ["general-tests"],
Tom Cherry8d225d82017-05-12 17:00:31 -0700279 static_libs: [
Tom Cherry8d225d82017-05-12 17:00:31 -0700280 "libavb_ab_host",
Tom Cherry8d225d82017-05-12 17:00:31 -0700281 "libgmock_host",
282 "libgtest_host",
283 ],
284 shared_libs: [
Bryan Henry573bb4c2018-12-01 11:42:18 -0800285 "libbase",
Tom Cherry8d225d82017-05-12 17:00:31 -0700286 "libchrome",
287 "libcrypto",
288 ],
David Zeuthen047ecf72017-06-28 14:10:55 -0400289 cflags: [
ThiƩbaud Weksteen23dbe6e2020-05-15 15:52:02 +0200290 "-Wno-missing-prototypes",
291 "-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED",
David Zeuthen047ecf72017-06-28 14:10:55 -0400292 ],
Tom Cherry8d225d82017-05-12 17:00:31 -0700293 srcs: [
294 "test/avb_ab_flow_unittest.cc",
295 "test/avb_atx_validate_unittest.cc",
Darren Krahn8160f362017-10-05 22:11:02 -0700296 "test/avb_atx_slot_verify_unittest.cc",
Andrew Scull725bff42021-04-29 20:39:42 +0000297 "test/avb_crypto_ops_unittest.cc",
Tom Cherry8d225d82017-05-12 17:00:31 -0700298 "test/avb_slot_verify_unittest.cc",
299 "test/avb_unittest_util.cc",
300 "test/avb_util_unittest.cc",
301 "test/avb_vbmeta_image_unittest.cc",
302 "test/avbtool_unittest.cc",
303 "test/fake_avb_ops.cc",
304 "test/avb_sysdeps_posix_testing.cc",
305 ],
Tom Cherry8d225d82017-05-12 17:00:31 -0700306}
307
Andrew Scull725bff42021-04-29 20:39:42 +0000308cc_test_host {
309 name: "libavb_host_unittest",
310 defaults: [
311 "avb_crypto_ops_impl_boringssl",
312 "libavb_host_unittest_core",
313 ],
314 data: [
315 ":img2simg",
316 ":simg2img",
317 ":fec",
318 ],
319}
320
321cc_test_host {
322 name: "libavb_host_unittest_sha",
323 defaults: [
324 "avb_crypto_ops_impl_sha",
325 "libavb_host_unittest_core",
326 ],
327 data: [
328 ":img2simg",
329 ":simg2img",
330 ":fec",
331 ],
332}
333
Tom Cherry8d225d82017-05-12 17:00:31 -0700334cc_library_host_static {
335 name: "libavb_host_user_code_test",
336 defaults: ["avb_defaults"],
David Zeuthen37f59462017-09-20 15:02:32 -0400337 cflags: [
338 "-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED",
339 ],
Tom Cherry8d225d82017-05-12 17:00:31 -0700340 srcs: ["test/user_code_test.cc"],
341}
342
343cc_library {
344 name: "bootctrl.avb",
345 defaults: ["avb_defaults"],
346 relative_install_path: "hw",
347 static_libs: [
348 "libavb_user",
349 "libfs_mgr",
350 ],
351 shared_libs: [
352 "libbase",
Andrew Scull725bff42021-04-29 20:39:42 +0000353 "libcrypto",
Tom Cherry8d225d82017-05-12 17:00:31 -0700354 "libcutils",
355 ],
David Zeuthen37f59462017-09-20 15:02:32 -0400356 cflags: [
357 "-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED",
358 ],
Tom Cherry8d225d82017-05-12 17:00:31 -0700359 srcs: ["boot_control/boot_control_avb.c"],
360}
Chin-Ting Kuo3cf5c722019-09-16 11:38:01 +0800361
362cc_library_headers {
363 name: "avb_headers",
364 host_supported: true,
Inseob Kimf1bca772021-06-14 11:53:04 +0900365 ramdisk_available: true,
David Andersonddab37d2021-07-23 16:51:13 -0700366 vendor_ramdisk_available: true,
Chin-Ting Kuo3cf5c722019-09-16 11:38:01 +0800367 recovery_available: true,
368 export_include_dirs: ["."],
369 target: {
370 windows: {
371 enabled: true,
372 },
373 },
374}