Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 1 | // |
| 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 Henry | 99df6c8 | 2018-10-25 15:00:43 -0700 | [diff] [blame] | 17 | subdirs = ["test", "tools"] |
| 18 | |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 19 | cc_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 Zeuthen | 047ecf7 | 2017-06-28 14:10:55 -0400 | [diff] [blame] | 29 | "-Wmissing-prototypes", |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 30 | "-Wno-psabi", |
| 31 | "-Wno-unused-parameter", |
Yi Kong | ed46d64 | 2018-01-03 11:52:56 -0800 | [diff] [blame] | 32 | "-Wno-format", |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 33 | "-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 | |
| 54 | cc_defaults { |
| 55 | name: "avb_sources", |
| 56 | srcs: [ |
| 57 | "libavb/avb_chain_partition_descriptor.c", |
Lonnie Liu | 97740e5 | 2017-11-09 11:16:15 -0800 | [diff] [blame] | 58 | "libavb/avb_cmdline.c", |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 59 | "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 Light | 027718c | 2019-03-07 16:44:46 -0800 | [diff] [blame] | 77 | python_binary_host { |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 78 | name: "avbtool", |
Alex Light | 027718c | 2019-03-07 16:44:46 -0800 | [diff] [blame] | 79 | srcs: [":avbtool_py"], |
| 80 | main: "avbtool.py", |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 81 | required: ["fec"], |
Alex Light | 027718c | 2019-03-07 16:44:46 -0800 | [diff] [blame] | 82 | version: { |
| 83 | py2: { |
| 84 | enabled: true, |
| 85 | embedded_launcher: true, |
| 86 | }, |
| 87 | py3: { |
| 88 | enabled: false, |
| 89 | }, |
| 90 | }, |
| 91 | } |
| 92 | |
Dan Austin | 715f503 | 2020-01-08 10:18:05 -0800 | [diff] [blame] | 93 | genrule { |
| 94 | name: "aftltool_py", |
| 95 | srcs: ["aftltool",], |
| 96 | out: ["aftltool.py"], |
| 97 | cmd: "cp $(in) $(out)", |
| 98 | } |
| 99 | |
Jan Monsch | 0ec6b9a | 2020-01-29 14:38:46 +0100 | [diff] [blame] | 100 | python_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 Austin | 715f503 | 2020-01-08 10:18:05 -0800 | [diff] [blame] | 117 | python_binary_host { |
| 118 | name: "aftltool", |
Jan Monsch | 5ac429e | 2019-12-11 19:04:26 +0100 | [diff] [blame] | 119 | srcs: [ |
Dan Austin | 715f503 | 2020-01-08 10:18:05 -0800 | [diff] [blame] | 120 | ":aftltool_py", |
Jan Monsch | 5ac429e | 2019-12-11 19:04:26 +0100 | [diff] [blame] | 121 | ":avbtool_py", |
Dan Austin | 715f503 | 2020-01-08 10:18:05 -0800 | [diff] [blame] | 122 | ], |
Jan Monsch | 0ec6b9a | 2020-01-29 14:38:46 +0100 | [diff] [blame] | 123 | libs: [ |
| 124 | "aftl_proto", |
| 125 | ], |
Dan Austin | 715f503 | 2020-01-08 10:18:05 -0800 | [diff] [blame] | 126 | 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 | |
| 139 | python_test_host { |
| 140 | name: "aftltool_test", |
| 141 | main: "aftltool_test.py", |
| 142 | srcs: [ |
| 143 | ":aftltool_py", |
| 144 | ":avbtool_py", |
| 145 | "aftltool_test.py", |
Jan Monsch | 5ac429e | 2019-12-11 19:04:26 +0100 | [diff] [blame] | 146 | ], |
Jan Monsch | 0ec6b9a | 2020-01-29 14:38:46 +0100 | [diff] [blame] | 147 | libs: [ |
| 148 | "aftl_proto", |
| 149 | ], |
| 150 | data: [ |
| 151 | "test/data/testkey_rsa4096.pem", |
| 152 | ], |
Jan Monsch | 5ac429e | 2019-12-11 19:04:26 +0100 | [diff] [blame] | 153 | test_suites: ["general-tests"], |
| 154 | version: { |
| 155 | py2: { |
| 156 | enabled: true, |
Jan Monsch | 0ec6b9a | 2020-01-29 14:38:46 +0100 | [diff] [blame] | 157 | // This is needs to be false due to b/146057182#comment5. |
Jan Monsch | 5ac429e | 2019-12-11 19:04:26 +0100 | [diff] [blame] | 158 | embedded_launcher: false, |
| 159 | }, |
| 160 | py3: { |
| 161 | enabled: false, |
| 162 | }, |
| 163 | }, |
| 164 | } |
| 165 | |
Alex Light | 027718c | 2019-03-07 16:44:46 -0800 | [diff] [blame] | 166 | genrule { |
| 167 | name: "avbtool_py", |
| 168 | srcs: ["avbtool",], |
| 169 | out: ["avbtool.py"], |
| 170 | cmd: "cp $(in) $(out)", |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 171 | } |
| 172 | |
| 173 | // Build libavb - this is a static library that depends |
| 174 | // on only libc and doesn't drag in any other dependencies. |
| 175 | cc_library_static { |
| 176 | name: "libavb", |
| 177 | defaults: [ |
| 178 | "avb_defaults", |
| 179 | "avb_sources", |
| 180 | ], |
| 181 | host_supported: true, |
Jiyong Park | 44e0712 | 2018-05-24 14:07:34 +0900 | [diff] [blame] | 182 | recovery_available: true, |
Chin-Ting Kuo | 3cf5c72 | 2019-09-16 11:38:01 +0800 | [diff] [blame] | 183 | header_libs: [ |
| 184 | "avb_headers", |
| 185 | ], |
| 186 | export_header_lib_headers: ["avb_headers"], |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 187 | target: { |
Andreas Gampe | 364a342 | 2018-12-26 11:12:11 -0800 | [diff] [blame] | 188 | linux: { |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 189 | srcs: ["libavb/avb_sysdeps_posix.c"], |
| 190 | }, |
Dan Willemsen | 34ec123 | 2017-10-02 10:41:07 -0700 | [diff] [blame] | 191 | linux_glibc: { |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 192 | 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. |
| 200 | cc_library_static { |
| 201 | name: "libavb_user", |
| 202 | defaults: [ |
| 203 | "avb_defaults", |
| 204 | "avb_sources", |
| 205 | ], |
Jiyong Park | 44e0712 | 2018-05-24 14:07:34 +0900 | [diff] [blame] | 206 | recovery_available: true, |
Chin-Ting Kuo | 3cf5c72 | 2019-09-16 11:38:01 +0800 | [diff] [blame] | 207 | header_libs: [ |
| 208 | "avb_headers", |
| 209 | ], |
| 210 | export_header_lib_headers: ["avb_headers"], |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 211 | shared_libs: ["libbase"], |
| 212 | static_libs: ["libfs_mgr"], |
David Zeuthen | 37f5946 | 2017-09-20 15:02:32 -0400 | [diff] [blame] | 213 | cflags: [ |
| 214 | "-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED", |
| 215 | ], |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 216 | srcs: [ |
| 217 | "libavb/avb_sysdeps_posix.c", |
| 218 | "libavb_ab/avb_ab_flow.c", |
Bowgo Tsai | 84c610e | 2017-09-28 15:13:05 +0800 | [diff] [blame] | 219 | "libavb_user/avb_ops_user.cpp", |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 220 | "libavb_user/avb_user_verity.c", |
David Zeuthen | 0922bf8 | 2017-06-19 17:50:38 -0400 | [diff] [blame] | 221 | "libavb_user/avb_user_verification.c", |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 222 | ], |
| 223 | } |
| 224 | |
| 225 | cc_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 | |
| 236 | cc_library_host_static { |
| 237 | name: "libavb_ab_host", |
| 238 | defaults: ["avb_defaults"], |
Chin-Ting Kuo | 3cf5c72 | 2019-09-16 11:38:01 +0800 | [diff] [blame] | 239 | header_libs: [ |
| 240 | "avb_headers", |
| 241 | ], |
| 242 | export_header_lib_headers: ["avb_headers"], |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 243 | cflags: [ |
| 244 | "-fno-stack-protector", |
David Zeuthen | 37f5946 | 2017-09-20 15:02:32 -0400 | [diff] [blame] | 245 | "-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED", |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 246 | ], |
| 247 | srcs: ["libavb_ab/avb_ab_flow.c"], |
| 248 | } |
| 249 | |
| 250 | cc_library_host_static { |
Dan Austin | 6bda987 | 2020-01-22 19:14:15 -0800 | [diff] [blame] | 251 | 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 Monsch | a86b614 | 2020-02-17 12:44:41 +0100 | [diff] [blame] | 261 | "libavb_aftl/avb_aftl_util.c", |
Dan Austin | 6bda987 | 2020-01-22 19:14:15 -0800 | [diff] [blame] | 262 | "libavb_aftl/avb_aftl_validate.c", |
Dan Austin | a4fc595 | 2020-02-14 11:32:17 -0800 | [diff] [blame^] | 263 | "libavb_aftl/avb_aftl_verify.c", |
Dan Austin | 6bda987 | 2020-01-22 19:14:15 -0800 | [diff] [blame] | 264 | ], |
| 265 | } |
| 266 | |
| 267 | cc_library_host_static { |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 268 | name: "libavb_atx_host", |
| 269 | defaults: ["avb_defaults"], |
Chin-Ting Kuo | 3cf5c72 | 2019-09-16 11:38:01 +0800 | [diff] [blame] | 270 | header_libs: [ |
| 271 | "avb_headers", |
| 272 | ], |
| 273 | export_header_lib_headers: ["avb_headers"], |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 274 | cflags: [ |
| 275 | "-fno-stack-protector", |
| 276 | ], |
| 277 | srcs: ["libavb_atx/avb_atx_validate.c"], |
| 278 | } |
| 279 | |
| 280 | cc_library_host_static { |
| 281 | name: "libavb_host_sysdeps", |
| 282 | defaults: ["avb_defaults"], |
Chin-Ting Kuo | 3cf5c72 | 2019-09-16 11:38:01 +0800 | [diff] [blame] | 283 | header_libs: [ |
| 284 | "avb_headers", |
| 285 | ], |
| 286 | export_header_lib_headers: ["avb_headers"], |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 287 | srcs: ["libavb/avb_sysdeps_posix.c"], |
| 288 | } |
| 289 | |
Darren Krahn | 8160f36 | 2017-10-05 22:11:02 -0700 | [diff] [blame] | 290 | cc_library_host_static { |
| 291 | name: "libavb_things_example", |
| 292 | defaults: ["avb_defaults"], |
Chin-Ting Kuo | 3cf5c72 | 2019-09-16 11:38:01 +0800 | [diff] [blame] | 293 | header_libs: [ |
| 294 | "avb_headers", |
| 295 | ], |
| 296 | export_header_lib_headers: ["avb_headers"], |
Darren Krahn | 8160f36 | 2017-10-05 22:11:02 -0700 | [diff] [blame] | 297 | srcs: ["examples/things/avb_atx_slot_verify.c"], |
| 298 | } |
| 299 | |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 300 | cc_test_host { |
| 301 | name: "libavb_host_unittest", |
| 302 | defaults: ["avb_defaults"], |
| 303 | required: [ |
| 304 | "simg2img", |
| 305 | "img2simg", |
| 306 | "avbtool", |
| 307 | ], |
Bryan Henry | b24af10 | 2018-10-25 18:20:23 -0700 | [diff] [blame] | 308 | data: [ |
| 309 | "avbtool", |
Bryan Henry | 38f0c8b | 2018-11-28 19:14:57 -0800 | [diff] [blame] | 310 | "test/avbtool_signing_helper_*.py", |
Bryan Henry | b24af10 | 2018-10-25 18:20:23 -0700 | [diff] [blame] | 311 | "test/data/*", |
| 312 | ], |
| 313 | test_config: "test/libavb_host_unittest.xml", |
Bryan Henry | d7156cd | 2019-01-24 16:32:52 -0800 | [diff] [blame] | 314 | test_suites: ["general-tests"], |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 315 | static_libs: [ |
| 316 | "libavb", |
| 317 | "libavb_ab_host", |
Dan Austin | 6bda987 | 2020-01-22 19:14:15 -0800 | [diff] [blame] | 318 | "libavb_aftl_host", |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 319 | "libavb_atx_host", |
Darren Krahn | 8160f36 | 2017-10-05 22:11:02 -0700 | [diff] [blame] | 320 | "libavb_things_example", |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 321 | "libgmock_host", |
| 322 | "libgtest_host", |
| 323 | ], |
| 324 | shared_libs: [ |
Bryan Henry | 573bb4c | 2018-12-01 11:42:18 -0800 | [diff] [blame] | 325 | "libbase", |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 326 | "libchrome", |
| 327 | "libcrypto", |
| 328 | ], |
David Zeuthen | 047ecf7 | 2017-06-28 14:10:55 -0400 | [diff] [blame] | 329 | cflags: [ |
| 330 | "-Wno-missing-prototypes", |
David Zeuthen | 37f5946 | 2017-09-20 15:02:32 -0400 | [diff] [blame] | 331 | "-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED", |
David Zeuthen | 047ecf7 | 2017-06-28 14:10:55 -0400 | [diff] [blame] | 332 | ], |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 333 | srcs: [ |
| 334 | "test/avb_ab_flow_unittest.cc", |
Jan Monsch | a86b614 | 2020-02-17 12:44:41 +0100 | [diff] [blame] | 335 | "test/avb_aftl_util_unittest.cc", |
Dan Austin | 6bda987 | 2020-01-22 19:14:15 -0800 | [diff] [blame] | 336 | "test/avb_aftl_validate_unittest.cc", |
Dan Austin | a4fc595 | 2020-02-14 11:32:17 -0800 | [diff] [blame^] | 337 | "test/avb_aftl_verify_unittest.cc", |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 338 | "test/avb_atx_validate_unittest.cc", |
Darren Krahn | 8160f36 | 2017-10-05 22:11:02 -0700 | [diff] [blame] | 339 | "test/avb_atx_slot_verify_unittest.cc", |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 340 | "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 Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 348 | } |
| 349 | |
| 350 | cc_library_host_static { |
| 351 | name: "libavb_host_user_code_test", |
| 352 | defaults: ["avb_defaults"], |
David Zeuthen | 37f5946 | 2017-09-20 15:02:32 -0400 | [diff] [blame] | 353 | cflags: [ |
| 354 | "-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED", |
| 355 | ], |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 356 | srcs: ["test/user_code_test.cc"], |
| 357 | } |
| 358 | |
| 359 | cc_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 Zeuthen | 37f5946 | 2017-09-20 15:02:32 -0400 | [diff] [blame] | 371 | cflags: [ |
| 372 | "-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED", |
| 373 | ], |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 374 | srcs: ["boot_control/boot_control_avb.c"], |
| 375 | } |
Chin-Ting Kuo | 3cf5c72 | 2019-09-16 11:38:01 +0800 | [diff] [blame] | 376 | |
| 377 | cc_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 | } |