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 | |
| 77 | cc_prebuilt_binary { |
| 78 | name: "avbtool", |
| 79 | srcs: ["avbtool"], |
| 80 | required: ["fec"], |
| 81 | device_supported: false, |
| 82 | host_supported: true, |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 83 | } |
| 84 | |
| 85 | // Build libavb - this is a static library that depends |
| 86 | // on only libc and doesn't drag in any other dependencies. |
| 87 | cc_library_static { |
| 88 | name: "libavb", |
| 89 | defaults: [ |
| 90 | "avb_defaults", |
| 91 | "avb_sources", |
| 92 | ], |
| 93 | host_supported: true, |
Jiyong Park | 44e0712 | 2018-05-24 14:07:34 +0900 | [diff] [blame] | 94 | recovery_available: true, |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 95 | export_include_dirs: ["."], |
| 96 | target: { |
Andreas Gampe | 364a342 | 2018-12-26 11:12:11 -0800 | [diff] [blame^] | 97 | linux: { |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 98 | srcs: ["libavb/avb_sysdeps_posix.c"], |
| 99 | }, |
Dan Willemsen | 34ec123 | 2017-10-02 10:41:07 -0700 | [diff] [blame] | 100 | linux_glibc: { |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 101 | 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. |
| 109 | cc_library_static { |
| 110 | name: "libavb_user", |
| 111 | defaults: [ |
| 112 | "avb_defaults", |
| 113 | "avb_sources", |
| 114 | ], |
Jiyong Park | 44e0712 | 2018-05-24 14:07:34 +0900 | [diff] [blame] | 115 | recovery_available: true, |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 116 | export_include_dirs: ["."], |
| 117 | shared_libs: ["libbase"], |
| 118 | static_libs: ["libfs_mgr"], |
David Zeuthen | 37f5946 | 2017-09-20 15:02:32 -0400 | [diff] [blame] | 119 | cflags: [ |
| 120 | "-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED", |
| 121 | ], |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 122 | srcs: [ |
| 123 | "libavb/avb_sysdeps_posix.c", |
| 124 | "libavb_ab/avb_ab_flow.c", |
Bowgo Tsai | 84c610e | 2017-09-28 15:13:05 +0800 | [diff] [blame] | 125 | "libavb_user/avb_ops_user.cpp", |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 126 | "libavb_user/avb_user_verity.c", |
David Zeuthen | 0922bf8 | 2017-06-19 17:50:38 -0400 | [diff] [blame] | 127 | "libavb_user/avb_user_verification.c", |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 128 | ], |
| 129 | } |
| 130 | |
| 131 | cc_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 | |
| 142 | cc_library_host_static { |
| 143 | name: "libavb_ab_host", |
| 144 | defaults: ["avb_defaults"], |
| 145 | export_include_dirs: ["."], |
| 146 | cflags: [ |
| 147 | "-fno-stack-protector", |
David Zeuthen | 37f5946 | 2017-09-20 15:02:32 -0400 | [diff] [blame] | 148 | "-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED", |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 149 | ], |
| 150 | srcs: ["libavb_ab/avb_ab_flow.c"], |
| 151 | } |
| 152 | |
| 153 | cc_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 | |
| 163 | cc_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 Krahn | 8160f36 | 2017-10-05 22:11:02 -0700 | [diff] [blame] | 170 | cc_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 Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 177 | cc_test_host { |
| 178 | name: "libavb_host_unittest", |
| 179 | defaults: ["avb_defaults"], |
| 180 | required: [ |
| 181 | "simg2img", |
| 182 | "img2simg", |
| 183 | "avbtool", |
| 184 | ], |
Bryan Henry | b24af10 | 2018-10-25 18:20:23 -0700 | [diff] [blame] | 185 | data: [ |
| 186 | "avbtool", |
Bryan Henry | 38f0c8b | 2018-11-28 19:14:57 -0800 | [diff] [blame] | 187 | "test/avbtool_signing_helper_*.py", |
Bryan Henry | b24af10 | 2018-10-25 18:20:23 -0700 | [diff] [blame] | 188 | "test/data/*", |
| 189 | ], |
| 190 | test_config: "test/libavb_host_unittest.xml", |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 191 | static_libs: [ |
| 192 | "libavb", |
| 193 | "libavb_ab_host", |
| 194 | "libavb_atx_host", |
Darren Krahn | 8160f36 | 2017-10-05 22:11:02 -0700 | [diff] [blame] | 195 | "libavb_things_example", |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 196 | "libgmock_host", |
| 197 | "libgtest_host", |
| 198 | ], |
| 199 | shared_libs: [ |
Bryan Henry | 573bb4c | 2018-12-01 11:42:18 -0800 | [diff] [blame] | 200 | "libbase", |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 201 | "libchrome", |
| 202 | "libcrypto", |
| 203 | ], |
David Zeuthen | 047ecf7 | 2017-06-28 14:10:55 -0400 | [diff] [blame] | 204 | cflags: [ |
| 205 | "-Wno-missing-prototypes", |
David Zeuthen | 37f5946 | 2017-09-20 15:02:32 -0400 | [diff] [blame] | 206 | "-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED", |
David Zeuthen | 047ecf7 | 2017-06-28 14:10:55 -0400 | [diff] [blame] | 207 | ], |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 208 | srcs: [ |
| 209 | "test/avb_ab_flow_unittest.cc", |
| 210 | "test/avb_atx_validate_unittest.cc", |
Darren Krahn | 8160f36 | 2017-10-05 22:11:02 -0700 | [diff] [blame] | 211 | "test/avb_atx_slot_verify_unittest.cc", |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 212 | "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 Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 220 | } |
| 221 | |
| 222 | cc_library_host_static { |
| 223 | name: "libavb_host_user_code_test", |
| 224 | defaults: ["avb_defaults"], |
David Zeuthen | 37f5946 | 2017-09-20 15:02:32 -0400 | [diff] [blame] | 225 | cflags: [ |
| 226 | "-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED", |
| 227 | ], |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 228 | srcs: ["test/user_code_test.cc"], |
| 229 | } |
| 230 | |
| 231 | cc_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 Zeuthen | 37f5946 | 2017-09-20 15:02:32 -0400 | [diff] [blame] | 243 | cflags: [ |
| 244 | "-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED", |
| 245 | ], |
Tom Cherry | 8d225d8 | 2017-05-12 17:00:31 -0700 | [diff] [blame] | 246 | srcs: ["boot_control/boot_control_avb.c"], |
| 247 | } |