xref: /aosp_15_r20/external/avb/Android.bp (revision d289c2ba6de359471b23d594623b906876bc48a0)
1*d289c2baSAndroid Build Coastguard Worker//
2*d289c2baSAndroid Build Coastguard Worker// Copyright (C) 2017-2020 The Android Open Source Project
3*d289c2baSAndroid Build Coastguard Worker//
4*d289c2baSAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License");
5*d289c2baSAndroid Build Coastguard Worker// you may not use this file except in compliance with the License.
6*d289c2baSAndroid Build Coastguard Worker// You may obtain a copy of the License at
7*d289c2baSAndroid Build Coastguard Worker//
8*d289c2baSAndroid Build Coastguard Worker//      http://www.apache.org/licenses/LICENSE-2.0
9*d289c2baSAndroid Build Coastguard Worker//
10*d289c2baSAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software
11*d289c2baSAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS,
12*d289c2baSAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*d289c2baSAndroid Build Coastguard Worker// See the License for the specific language governing permissions and
14*d289c2baSAndroid Build Coastguard Worker// limitations under the License.
15*d289c2baSAndroid Build Coastguard Worker//
16*d289c2baSAndroid Build Coastguard Worker
17*d289c2baSAndroid Build Coastguard Workerpackage {
18*d289c2baSAndroid Build Coastguard Worker    default_applicable_licenses: ["external_avb_license"],
19*d289c2baSAndroid Build Coastguard Worker}
20*d289c2baSAndroid Build Coastguard Worker
21*d289c2baSAndroid Build Coastguard Worker// Added automatically by a large-scale-change that took the approach of
22*d289c2baSAndroid Build Coastguard Worker// 'apply every license found to every target'. While this makes sure we respect
23*d289c2baSAndroid Build Coastguard Worker// every license restriction, it may not be entirely correct.
24*d289c2baSAndroid Build Coastguard Worker//
25*d289c2baSAndroid Build Coastguard Worker// e.g. GPL in an MIT project might only apply to the contrib/ directory.
26*d289c2baSAndroid Build Coastguard Worker//
27*d289c2baSAndroid Build Coastguard Worker// Please consider splitting the single license below into multiple licenses,
28*d289c2baSAndroid Build Coastguard Worker// taking care not to lose any license_kind information, and overriding the
29*d289c2baSAndroid Build Coastguard Worker// default license using the 'licenses: [...]' property on targets as needed.
30*d289c2baSAndroid Build Coastguard Worker//
31*d289c2baSAndroid Build Coastguard Worker// For unused files, consider creating a 'fileGroup' with "//visibility:private"
32*d289c2baSAndroid Build Coastguard Worker// to attach the license to, and including a comment whether the files may be
33*d289c2baSAndroid Build Coastguard Worker// used in the current project.
34*d289c2baSAndroid Build Coastguard Worker// See: http://go/android-license-faq
35*d289c2baSAndroid Build Coastguard Workerlicense {
36*d289c2baSAndroid Build Coastguard Worker    name: "external_avb_license",
37*d289c2baSAndroid Build Coastguard Worker    visibility: [":__subpackages__"],
38*d289c2baSAndroid Build Coastguard Worker    license_kinds: [
39*d289c2baSAndroid Build Coastguard Worker        "SPDX-license-identifier-Apache-2.0",
40*d289c2baSAndroid Build Coastguard Worker        "SPDX-license-identifier-BSD",
41*d289c2baSAndroid Build Coastguard Worker        "SPDX-license-identifier-MIT",
42*d289c2baSAndroid Build Coastguard Worker    ],
43*d289c2baSAndroid Build Coastguard Worker    license_text: [
44*d289c2baSAndroid Build Coastguard Worker        "LICENSE",
45*d289c2baSAndroid Build Coastguard Worker    ],
46*d289c2baSAndroid Build Coastguard Worker}
47*d289c2baSAndroid Build Coastguard Worker
48*d289c2baSAndroid Build Coastguard Workersubdirs = [
49*d289c2baSAndroid Build Coastguard Worker    "test",
50*d289c2baSAndroid Build Coastguard Worker    "tools",
51*d289c2baSAndroid Build Coastguard Worker]
52*d289c2baSAndroid Build Coastguard Worker
53*d289c2baSAndroid Build Coastguard Workercc_defaults {
54*d289c2baSAndroid Build Coastguard Worker    name: "avb_defaults",
55*d289c2baSAndroid Build Coastguard Worker    cflags: [
56*d289c2baSAndroid Build Coastguard Worker        "-D_FILE_OFFSET_BITS=64",
57*d289c2baSAndroid Build Coastguard Worker        "-D_POSIX_C_SOURCE=199309L",
58*d289c2baSAndroid Build Coastguard Worker        "-Wa,--noexecstack",
59*d289c2baSAndroid Build Coastguard Worker        "-Werror",
60*d289c2baSAndroid Build Coastguard Worker        "-Wall",
61*d289c2baSAndroid Build Coastguard Worker        "-Wextra",
62*d289c2baSAndroid Build Coastguard Worker        "-Wformat=2",
63*d289c2baSAndroid Build Coastguard Worker        "-Wmissing-prototypes",
64*d289c2baSAndroid Build Coastguard Worker        "-Wno-psabi",
65*d289c2baSAndroid Build Coastguard Worker        "-Wno-unused-parameter",
66*d289c2baSAndroid Build Coastguard Worker        "-Wno-format",
67*d289c2baSAndroid Build Coastguard Worker        "-ffunction-sections",
68*d289c2baSAndroid Build Coastguard Worker        "-fstack-protector-strong",
69*d289c2baSAndroid Build Coastguard Worker        "-g",
70*d289c2baSAndroid Build Coastguard Worker        "-DAVB_ENABLE_DEBUG",
71*d289c2baSAndroid Build Coastguard Worker        "-DAVB_COMPILATION",
72*d289c2baSAndroid Build Coastguard Worker    ],
73*d289c2baSAndroid Build Coastguard Worker    cppflags: [
74*d289c2baSAndroid Build Coastguard Worker        "-Wnon-virtual-dtor",
75*d289c2baSAndroid Build Coastguard Worker        "-fno-strict-aliasing",
76*d289c2baSAndroid Build Coastguard Worker    ],
77*d289c2baSAndroid Build Coastguard Worker    ldflags: [
78*d289c2baSAndroid Build Coastguard Worker        "-Wl,--gc-sections",
79*d289c2baSAndroid Build Coastguard Worker        "-rdynamic",
80*d289c2baSAndroid Build Coastguard Worker    ],
81*d289c2baSAndroid Build Coastguard Worker    target: {
82*d289c2baSAndroid Build Coastguard Worker        darwin: {
83*d289c2baSAndroid Build Coastguard Worker            enabled: false,
84*d289c2baSAndroid Build Coastguard Worker        },
85*d289c2baSAndroid Build Coastguard Worker    },
86*d289c2baSAndroid Build Coastguard Worker}
87*d289c2baSAndroid Build Coastguard Worker
88*d289c2baSAndroid Build Coastguard Workercc_defaults {
89*d289c2baSAndroid Build Coastguard Worker    name: "avb_sources",
90*d289c2baSAndroid Build Coastguard Worker    srcs: [
91*d289c2baSAndroid Build Coastguard Worker        "libavb/avb_chain_partition_descriptor.c",
92*d289c2baSAndroid Build Coastguard Worker        "libavb/avb_cmdline.c",
93*d289c2baSAndroid Build Coastguard Worker        "libavb/avb_crc32.c",
94*d289c2baSAndroid Build Coastguard Worker        "libavb/avb_crypto.c",
95*d289c2baSAndroid Build Coastguard Worker        "libavb/avb_descriptor.c",
96*d289c2baSAndroid Build Coastguard Worker        "libavb/avb_footer.c",
97*d289c2baSAndroid Build Coastguard Worker        "libavb/avb_hash_descriptor.c",
98*d289c2baSAndroid Build Coastguard Worker        "libavb/avb_hashtree_descriptor.c",
99*d289c2baSAndroid Build Coastguard Worker        "libavb/avb_kernel_cmdline_descriptor.c",
100*d289c2baSAndroid Build Coastguard Worker        "libavb/avb_property_descriptor.c",
101*d289c2baSAndroid Build Coastguard Worker        "libavb/avb_rsa.c",
102*d289c2baSAndroid Build Coastguard Worker        "libavb/avb_slot_verify.c",
103*d289c2baSAndroid Build Coastguard Worker        "libavb/avb_util.c",
104*d289c2baSAndroid Build Coastguard Worker        "libavb/avb_vbmeta_image.c",
105*d289c2baSAndroid Build Coastguard Worker        "libavb/avb_version.c",
106*d289c2baSAndroid Build Coastguard Worker    ],
107*d289c2baSAndroid Build Coastguard Worker}
108*d289c2baSAndroid Build Coastguard Worker
109*d289c2baSAndroid Build Coastguard Workercc_defaults {
110*d289c2baSAndroid Build Coastguard Worker    name: "avb_crypto_ops_impl_boringssl",
111*d289c2baSAndroid Build Coastguard Worker    srcs: [
112*d289c2baSAndroid Build Coastguard Worker        "libavb/boringssl/sha.c",
113*d289c2baSAndroid Build Coastguard Worker    ],
114*d289c2baSAndroid Build Coastguard Worker    local_include_dirs: [
115*d289c2baSAndroid Build Coastguard Worker        "libavb/boringssl",
116*d289c2baSAndroid Build Coastguard Worker    ],
117*d289c2baSAndroid Build Coastguard Worker}
118*d289c2baSAndroid Build Coastguard Worker
119*d289c2baSAndroid Build Coastguard Workercc_defaults {
120*d289c2baSAndroid Build Coastguard Worker    name: "avb_crypto_ops_impl_sha",
121*d289c2baSAndroid Build Coastguard Worker    srcs: [
122*d289c2baSAndroid Build Coastguard Worker        "libavb/sha/sha256_impl.c",
123*d289c2baSAndroid Build Coastguard Worker        "libavb/sha/sha512_impl.c",
124*d289c2baSAndroid Build Coastguard Worker    ],
125*d289c2baSAndroid Build Coastguard Worker    local_include_dirs: [
126*d289c2baSAndroid Build Coastguard Worker        "libavb/sha",
127*d289c2baSAndroid Build Coastguard Worker    ],
128*d289c2baSAndroid Build Coastguard Worker}
129*d289c2baSAndroid Build Coastguard Worker
130*d289c2baSAndroid Build Coastguard Workerpython_library_host {
131*d289c2baSAndroid Build Coastguard Worker    name: "libavbtool",
132*d289c2baSAndroid Build Coastguard Worker    srcs: ["avbtool.py"],
133*d289c2baSAndroid Build Coastguard Worker}
134*d289c2baSAndroid Build Coastguard Worker
135*d289c2baSAndroid Build Coastguard Workerpython_binary_host {
136*d289c2baSAndroid Build Coastguard Worker    name: "avbtool",
137*d289c2baSAndroid Build Coastguard Worker    srcs: ["avbtool.py"],
138*d289c2baSAndroid Build Coastguard Worker    main: "avbtool.py",
139*d289c2baSAndroid Build Coastguard Worker    required: ["fec"],
140*d289c2baSAndroid Build Coastguard Worker    version: {
141*d289c2baSAndroid Build Coastguard Worker        py3: {
142*d289c2baSAndroid Build Coastguard Worker            embedded_launcher: true,
143*d289c2baSAndroid Build Coastguard Worker        },
144*d289c2baSAndroid Build Coastguard Worker    },
145*d289c2baSAndroid Build Coastguard Worker    compile_multilib: "first",
146*d289c2baSAndroid Build Coastguard Worker}
147*d289c2baSAndroid Build Coastguard Worker
148*d289c2baSAndroid Build Coastguard Worker// Default common to both standard and baremetal versions of libavb.
149*d289c2baSAndroid Build Coastguard Workercc_defaults {
150*d289c2baSAndroid Build Coastguard Worker    name: "libavb_base_defaults",
151*d289c2baSAndroid Build Coastguard Worker    defaults: [
152*d289c2baSAndroid Build Coastguard Worker        "avb_defaults",
153*d289c2baSAndroid Build Coastguard Worker        "avb_sources",
154*d289c2baSAndroid Build Coastguard Worker        "avb_crypto_ops_impl_boringssl",
155*d289c2baSAndroid Build Coastguard Worker    ],
156*d289c2baSAndroid Build Coastguard Worker    header_libs: [
157*d289c2baSAndroid Build Coastguard Worker        "avb_headers",
158*d289c2baSAndroid Build Coastguard Worker    ],
159*d289c2baSAndroid Build Coastguard Worker    export_header_lib_headers: ["avb_headers"],
160*d289c2baSAndroid Build Coastguard Worker}
161*d289c2baSAndroid Build Coastguard Worker
162*d289c2baSAndroid Build Coastguard Worker// Defaults for standard libavb; depends on only libc and libcrypto.
163*d289c2baSAndroid Build Coastguard Worker//
164*d289c2baSAndroid Build Coastguard Worker// The standard targets enable more logging and uses the standard versions of
165*d289c2baSAndroid Build Coastguard Worker// the dependencies; see the baremetal variant for a slimmer alternative.
166*d289c2baSAndroid Build Coastguard Workercc_defaults {
167*d289c2baSAndroid Build Coastguard Worker    name: "libavb_standard_defaults",
168*d289c2baSAndroid Build Coastguard Worker    defaults: ["libavb_base_defaults"],
169*d289c2baSAndroid Build Coastguard Worker    host_supported: true,
170*d289c2baSAndroid Build Coastguard Worker    ramdisk_available: true,
171*d289c2baSAndroid Build Coastguard Worker    vendor_ramdisk_available: true,
172*d289c2baSAndroid Build Coastguard Worker    recovery_available: true,
173*d289c2baSAndroid Build Coastguard Worker    shared_libs: [
174*d289c2baSAndroid Build Coastguard Worker        "libcrypto",
175*d289c2baSAndroid Build Coastguard Worker    ],
176*d289c2baSAndroid Build Coastguard Worker    target: {
177*d289c2baSAndroid Build Coastguard Worker        linux: {
178*d289c2baSAndroid Build Coastguard Worker            srcs: ["libavb/avb_sysdeps_posix.c"],
179*d289c2baSAndroid Build Coastguard Worker        },
180*d289c2baSAndroid Build Coastguard Worker        darwin: {
181*d289c2baSAndroid Build Coastguard Worker            enabled: true,
182*d289c2baSAndroid Build Coastguard Worker            srcs: ["libavb/avb_sysdeps_posix.c"],
183*d289c2baSAndroid Build Coastguard Worker        },
184*d289c2baSAndroid Build Coastguard Worker        host_linux: {
185*d289c2baSAndroid Build Coastguard Worker            cflags: ["-fno-stack-protector"],
186*d289c2baSAndroid Build Coastguard Worker        },
187*d289c2baSAndroid Build Coastguard Worker    },
188*d289c2baSAndroid Build Coastguard Worker    apex_available: [
189*d289c2baSAndroid Build Coastguard Worker        "//apex_available:platform",
190*d289c2baSAndroid Build Coastguard Worker        "com.android.virt",
191*d289c2baSAndroid Build Coastguard Worker    ],
192*d289c2baSAndroid Build Coastguard Worker}
193*d289c2baSAndroid Build Coastguard Worker
194*d289c2baSAndroid Build Coastguard Worker// libavb
195*d289c2baSAndroid Build Coastguard Workercc_library_static {
196*d289c2baSAndroid Build Coastguard Worker    name: "libavb",
197*d289c2baSAndroid Build Coastguard Worker    defaults: ["libavb_standard_defaults"],
198*d289c2baSAndroid Build Coastguard Worker}
199*d289c2baSAndroid Build Coastguard Worker
200*d289c2baSAndroid Build Coastguard Worker// libavb + cert
201*d289c2baSAndroid Build Coastguard Worker//
202*d289c2baSAndroid Build Coastguard Worker// The cert extensions provides some additional support for minimal
203*d289c2baSAndroid Build Coastguard Worker// certificate-based signing.
204*d289c2baSAndroid Build Coastguard Workercc_library_static {
205*d289c2baSAndroid Build Coastguard Worker    name: "libavb_cert",
206*d289c2baSAndroid Build Coastguard Worker    defaults: [
207*d289c2baSAndroid Build Coastguard Worker        "avb_cert_sources",
208*d289c2baSAndroid Build Coastguard Worker        "libavb_standard_defaults",
209*d289c2baSAndroid Build Coastguard Worker    ],
210*d289c2baSAndroid Build Coastguard Worker}
211*d289c2baSAndroid Build Coastguard Worker
212*d289c2baSAndroid Build Coastguard Worker// Defaults for a variant of libavb that can run in baremetal environments.
213*d289c2baSAndroid Build Coastguard Worker//
214*d289c2baSAndroid Build Coastguard Worker// The debug feature isn't enabled, removing verbose logging and assertions.
215*d289c2baSAndroid Build Coastguard Worker// Also uses the baremetal variant of the dependencies.
216*d289c2baSAndroid Build Coastguard Worker//
217*d289c2baSAndroid Build Coastguard Worker// This does still require a handful of Posix APIs as used by the sysdeps
218*d289c2baSAndroid Build Coastguard Worker// implementation.
219*d289c2baSAndroid Build Coastguard Workercc_defaults {
220*d289c2baSAndroid Build Coastguard Worker    name: "libavb_baremetal_defaults",
221*d289c2baSAndroid Build Coastguard Worker    defaults: [
222*d289c2baSAndroid Build Coastguard Worker        "cc_baremetal_defaults",
223*d289c2baSAndroid Build Coastguard Worker        "libavb_base_defaults",
224*d289c2baSAndroid Build Coastguard Worker    ],
225*d289c2baSAndroid Build Coastguard Worker    cflags: ["-UAVB_ENABLE_DEBUG"],
226*d289c2baSAndroid Build Coastguard Worker    static_libs: [
227*d289c2baSAndroid Build Coastguard Worker        "libcrypto_baremetal",
228*d289c2baSAndroid Build Coastguard Worker    ],
229*d289c2baSAndroid Build Coastguard Worker    srcs: ["libavb/avb_sysdeps_posix.c"],
230*d289c2baSAndroid Build Coastguard Worker}
231*d289c2baSAndroid Build Coastguard Worker
232*d289c2baSAndroid Build Coastguard Worker// Baremetal libavb
233*d289c2baSAndroid Build Coastguard Workercc_library_static {
234*d289c2baSAndroid Build Coastguard Worker    name: "libavb_baremetal",
235*d289c2baSAndroid Build Coastguard Worker    defaults: ["libavb_baremetal_defaults"],
236*d289c2baSAndroid Build Coastguard Worker}
237*d289c2baSAndroid Build Coastguard Worker
238*d289c2baSAndroid Build Coastguard Worker// Baremetal libavb + cert
239*d289c2baSAndroid Build Coastguard Workercc_library_static {
240*d289c2baSAndroid Build Coastguard Worker    name: "libavb_cert_baremetal",
241*d289c2baSAndroid Build Coastguard Worker    defaults: [
242*d289c2baSAndroid Build Coastguard Worker        "avb_cert_sources",
243*d289c2baSAndroid Build Coastguard Worker        "libavb_baremetal_defaults",
244*d289c2baSAndroid Build Coastguard Worker    ],
245*d289c2baSAndroid Build Coastguard Worker}
246*d289c2baSAndroid Build Coastguard Worker
247*d289c2baSAndroid Build Coastguard Worker// Build libavb_user for the target - in addition to libavb, it
248*d289c2baSAndroid Build Coastguard Worker// includes libavb_ab, libavb_user and also depends on libbase and
249*d289c2baSAndroid Build Coastguard Worker// libfs_mgr.
250*d289c2baSAndroid Build Coastguard Workercc_library_static {
251*d289c2baSAndroid Build Coastguard Worker    name: "libavb_user",
252*d289c2baSAndroid Build Coastguard Worker    defaults: [
253*d289c2baSAndroid Build Coastguard Worker        "avb_defaults",
254*d289c2baSAndroid Build Coastguard Worker        "avb_sources",
255*d289c2baSAndroid Build Coastguard Worker        "avb_crypto_ops_impl_boringssl",
256*d289c2baSAndroid Build Coastguard Worker    ],
257*d289c2baSAndroid Build Coastguard Worker    recovery_available: true,
258*d289c2baSAndroid Build Coastguard Worker    header_libs: [
259*d289c2baSAndroid Build Coastguard Worker        "avb_headers",
260*d289c2baSAndroid Build Coastguard Worker    ],
261*d289c2baSAndroid Build Coastguard Worker    export_header_lib_headers: ["avb_headers"],
262*d289c2baSAndroid Build Coastguard Worker    shared_libs: [
263*d289c2baSAndroid Build Coastguard Worker        "libbase",
264*d289c2baSAndroid Build Coastguard Worker        "libcrypto",
265*d289c2baSAndroid Build Coastguard Worker    ],
266*d289c2baSAndroid Build Coastguard Worker    static_libs: ["libfs_mgr"],
267*d289c2baSAndroid Build Coastguard Worker    cflags: [
268*d289c2baSAndroid Build Coastguard Worker        "-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED",
269*d289c2baSAndroid Build Coastguard Worker    ],
270*d289c2baSAndroid Build Coastguard Worker    srcs: [
271*d289c2baSAndroid Build Coastguard Worker        "libavb/avb_sysdeps_posix.c",
272*d289c2baSAndroid Build Coastguard Worker        "libavb_ab/avb_ab_flow.c",
273*d289c2baSAndroid Build Coastguard Worker        "libavb_user/avb_ops_user.cpp",
274*d289c2baSAndroid Build Coastguard Worker        "libavb_user/avb_user_verity.c",
275*d289c2baSAndroid Build Coastguard Worker        "libavb_user/avb_user_verification.c",
276*d289c2baSAndroid Build Coastguard Worker    ],
277*d289c2baSAndroid Build Coastguard Worker}
278*d289c2baSAndroid Build Coastguard Worker
279*d289c2baSAndroid Build Coastguard Workercc_binary {
280*d289c2baSAndroid Build Coastguard Worker    name: "avbctl",
281*d289c2baSAndroid Build Coastguard Worker    defaults: ["avb_defaults"],
282*d289c2baSAndroid Build Coastguard Worker    static_libs: [
283*d289c2baSAndroid Build Coastguard Worker        "libavb_user",
284*d289c2baSAndroid Build Coastguard Worker        "libfs_mgr",
285*d289c2baSAndroid Build Coastguard Worker    ],
286*d289c2baSAndroid Build Coastguard Worker    shared_libs: [
287*d289c2baSAndroid Build Coastguard Worker        "libbase",
288*d289c2baSAndroid Build Coastguard Worker        "libcrypto",
289*d289c2baSAndroid Build Coastguard Worker    ],
290*d289c2baSAndroid Build Coastguard Worker    srcs: ["tools/avbctl/avbctl.cc"],
291*d289c2baSAndroid Build Coastguard Worker}
292*d289c2baSAndroid Build Coastguard Worker
293*d289c2baSAndroid Build Coastguard Workercc_library_host_static {
294*d289c2baSAndroid Build Coastguard Worker    name: "libavb_ab_host",
295*d289c2baSAndroid Build Coastguard Worker    defaults: ["avb_defaults"],
296*d289c2baSAndroid Build Coastguard Worker    header_libs: [
297*d289c2baSAndroid Build Coastguard Worker        "avb_headers",
298*d289c2baSAndroid Build Coastguard Worker    ],
299*d289c2baSAndroid Build Coastguard Worker    export_header_lib_headers: ["avb_headers"],
300*d289c2baSAndroid Build Coastguard Worker    cflags: [
301*d289c2baSAndroid Build Coastguard Worker        "-fno-stack-protector",
302*d289c2baSAndroid Build Coastguard Worker        "-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED",
303*d289c2baSAndroid Build Coastguard Worker    ],
304*d289c2baSAndroid Build Coastguard Worker    srcs: ["libavb_ab/avb_ab_flow.c"],
305*d289c2baSAndroid Build Coastguard Worker}
306*d289c2baSAndroid Build Coastguard Worker
307*d289c2baSAndroid Build Coastguard Workercc_defaults {
308*d289c2baSAndroid Build Coastguard Worker    name: "avb_cert_sources",
309*d289c2baSAndroid Build Coastguard Worker    srcs: ["libavb_cert/avb_cert_validate.c"],
310*d289c2baSAndroid Build Coastguard Worker}
311*d289c2baSAndroid Build Coastguard Worker
312*d289c2baSAndroid Build Coastguard Workercc_library_host_static {
313*d289c2baSAndroid Build Coastguard Worker    name: "libavb_host_sysdeps",
314*d289c2baSAndroid Build Coastguard Worker    defaults: ["avb_defaults"],
315*d289c2baSAndroid Build Coastguard Worker    header_libs: [
316*d289c2baSAndroid Build Coastguard Worker        "avb_headers",
317*d289c2baSAndroid Build Coastguard Worker    ],
318*d289c2baSAndroid Build Coastguard Worker    export_header_lib_headers: ["avb_headers"],
319*d289c2baSAndroid Build Coastguard Worker    srcs: ["libavb/avb_sysdeps_posix.c"],
320*d289c2baSAndroid Build Coastguard Worker}
321*d289c2baSAndroid Build Coastguard Worker
322*d289c2baSAndroid Build Coastguard Workercc_defaults {
323*d289c2baSAndroid Build Coastguard Worker    name: "avb_cert_example_sources",
324*d289c2baSAndroid Build Coastguard Worker    srcs: ["examples/cert/avb_cert_slot_verify.c"],
325*d289c2baSAndroid Build Coastguard Worker}
326*d289c2baSAndroid Build Coastguard Worker
327*d289c2baSAndroid Build Coastguard Workercc_defaults {
328*d289c2baSAndroid Build Coastguard Worker    name: "libavb_host_unittest_core",
329*d289c2baSAndroid Build Coastguard Worker    defaults: [
330*d289c2baSAndroid Build Coastguard Worker        "avb_defaults",
331*d289c2baSAndroid Build Coastguard Worker        "avb_sources",
332*d289c2baSAndroid Build Coastguard Worker        "avb_cert_sources",
333*d289c2baSAndroid Build Coastguard Worker        "avb_cert_example_sources",
334*d289c2baSAndroid Build Coastguard Worker    ],
335*d289c2baSAndroid Build Coastguard Worker    required: [
336*d289c2baSAndroid Build Coastguard Worker        "simg2img",
337*d289c2baSAndroid Build Coastguard Worker        "img2simg",
338*d289c2baSAndroid Build Coastguard Worker        "avbtool",
339*d289c2baSAndroid Build Coastguard Worker    ],
340*d289c2baSAndroid Build Coastguard Worker    test_options: {
341*d289c2baSAndroid Build Coastguard Worker        unit_test: true,
342*d289c2baSAndroid Build Coastguard Worker    },
343*d289c2baSAndroid Build Coastguard Worker    compile_multilib: "first",
344*d289c2baSAndroid Build Coastguard Worker    data: [
345*d289c2baSAndroid Build Coastguard Worker        "avbtool.py",
346*d289c2baSAndroid Build Coastguard Worker        "test/avbtool_signing_helper_test.py",
347*d289c2baSAndroid Build Coastguard Worker        "test/avbtool_signing_helper_with_files_test.py",
348*d289c2baSAndroid Build Coastguard Worker        "test/data/*",
349*d289c2baSAndroid Build Coastguard Worker    ],
350*d289c2baSAndroid Build Coastguard Worker    test_config: "test/libavb_host_unittest.xml",
351*d289c2baSAndroid Build Coastguard Worker    static_libs: [
352*d289c2baSAndroid Build Coastguard Worker        "libavb_ab_host",
353*d289c2baSAndroid Build Coastguard Worker        "libgmock_host",
354*d289c2baSAndroid Build Coastguard Worker        "libgtest_host",
355*d289c2baSAndroid Build Coastguard Worker    ],
356*d289c2baSAndroid Build Coastguard Worker    shared_libs: [
357*d289c2baSAndroid Build Coastguard Worker        "libbase",
358*d289c2baSAndroid Build Coastguard Worker        "libchrome",
359*d289c2baSAndroid Build Coastguard Worker        "libcrypto",
360*d289c2baSAndroid Build Coastguard Worker    ],
361*d289c2baSAndroid Build Coastguard Worker    cflags: [
362*d289c2baSAndroid Build Coastguard Worker        "-Wno-missing-prototypes",
363*d289c2baSAndroid Build Coastguard Worker        "-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED",
364*d289c2baSAndroid Build Coastguard Worker    ],
365*d289c2baSAndroid Build Coastguard Worker    srcs: [
366*d289c2baSAndroid Build Coastguard Worker        "test/avb_ab_flow_unittest.cc",
367*d289c2baSAndroid Build Coastguard Worker        "test/avb_cert_validate_unittest.cc",
368*d289c2baSAndroid Build Coastguard Worker        "test/avb_cert_slot_verify_unittest.cc",
369*d289c2baSAndroid Build Coastguard Worker        "test/avb_crypto_ops_unittest.cc",
370*d289c2baSAndroid Build Coastguard Worker        "test/avb_slot_verify_unittest.cc",
371*d289c2baSAndroid Build Coastguard Worker        "test/avb_unittest_util.cc",
372*d289c2baSAndroid Build Coastguard Worker        "test/avb_util_unittest.cc",
373*d289c2baSAndroid Build Coastguard Worker        "test/avb_vbmeta_image_unittest.cc",
374*d289c2baSAndroid Build Coastguard Worker        "test/avbtool_unittest.cc",
375*d289c2baSAndroid Build Coastguard Worker        "test/fake_avb_ops.cc",
376*d289c2baSAndroid Build Coastguard Worker        "test/avb_sysdeps_posix_testing.cc",
377*d289c2baSAndroid Build Coastguard Worker    ],
378*d289c2baSAndroid Build Coastguard Worker}
379*d289c2baSAndroid Build Coastguard Worker
380*d289c2baSAndroid Build Coastguard Workercc_test_host {
381*d289c2baSAndroid Build Coastguard Worker    name: "libavb_host_unittest",
382*d289c2baSAndroid Build Coastguard Worker    defaults: [
383*d289c2baSAndroid Build Coastguard Worker        "avb_crypto_ops_impl_boringssl",
384*d289c2baSAndroid Build Coastguard Worker        "libavb_host_unittest_core",
385*d289c2baSAndroid Build Coastguard Worker    ],
386*d289c2baSAndroid Build Coastguard Worker    data: [
387*d289c2baSAndroid Build Coastguard Worker        ":img2simg",
388*d289c2baSAndroid Build Coastguard Worker        ":simg2img",
389*d289c2baSAndroid Build Coastguard Worker        ":fec",
390*d289c2baSAndroid Build Coastguard Worker    ],
391*d289c2baSAndroid Build Coastguard Worker}
392*d289c2baSAndroid Build Coastguard Worker
393*d289c2baSAndroid Build Coastguard Workercc_test_host {
394*d289c2baSAndroid Build Coastguard Worker    name: "libavb_host_unittest_sha",
395*d289c2baSAndroid Build Coastguard Worker    defaults: [
396*d289c2baSAndroid Build Coastguard Worker        "avb_crypto_ops_impl_sha",
397*d289c2baSAndroid Build Coastguard Worker        "libavb_host_unittest_core",
398*d289c2baSAndroid Build Coastguard Worker    ],
399*d289c2baSAndroid Build Coastguard Worker    data: [
400*d289c2baSAndroid Build Coastguard Worker        ":img2simg",
401*d289c2baSAndroid Build Coastguard Worker        ":simg2img",
402*d289c2baSAndroid Build Coastguard Worker        ":fec",
403*d289c2baSAndroid Build Coastguard Worker    ],
404*d289c2baSAndroid Build Coastguard Worker}
405*d289c2baSAndroid Build Coastguard Worker
406*d289c2baSAndroid Build Coastguard Workercc_library_host_static {
407*d289c2baSAndroid Build Coastguard Worker    name: "libavb_host_user_code_test",
408*d289c2baSAndroid Build Coastguard Worker    defaults: ["avb_defaults"],
409*d289c2baSAndroid Build Coastguard Worker    cflags: [
410*d289c2baSAndroid Build Coastguard Worker        "-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED",
411*d289c2baSAndroid Build Coastguard Worker    ],
412*d289c2baSAndroid Build Coastguard Worker    srcs: ["test/user_code_test.cc"],
413*d289c2baSAndroid Build Coastguard Worker}
414*d289c2baSAndroid Build Coastguard Worker
415*d289c2baSAndroid Build Coastguard Workercc_library {
416*d289c2baSAndroid Build Coastguard Worker    name: "bootctrl.avb",
417*d289c2baSAndroid Build Coastguard Worker    defaults: ["avb_defaults"],
418*d289c2baSAndroid Build Coastguard Worker    relative_install_path: "hw",
419*d289c2baSAndroid Build Coastguard Worker    static_libs: [
420*d289c2baSAndroid Build Coastguard Worker        "libavb_user",
421*d289c2baSAndroid Build Coastguard Worker        "libfs_mgr",
422*d289c2baSAndroid Build Coastguard Worker    ],
423*d289c2baSAndroid Build Coastguard Worker    shared_libs: [
424*d289c2baSAndroid Build Coastguard Worker        "libbase",
425*d289c2baSAndroid Build Coastguard Worker        "libcrypto",
426*d289c2baSAndroid Build Coastguard Worker        "libcutils",
427*d289c2baSAndroid Build Coastguard Worker    ],
428*d289c2baSAndroid Build Coastguard Worker    cflags: [
429*d289c2baSAndroid Build Coastguard Worker        "-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED",
430*d289c2baSAndroid Build Coastguard Worker    ],
431*d289c2baSAndroid Build Coastguard Worker    srcs: ["boot_control/boot_control_avb.c"],
432*d289c2baSAndroid Build Coastguard Worker}
433*d289c2baSAndroid Build Coastguard Worker
434*d289c2baSAndroid Build Coastguard Workercc_library_headers {
435*d289c2baSAndroid Build Coastguard Worker    name: "avb_headers",
436*d289c2baSAndroid Build Coastguard Worker    host_supported: true,
437*d289c2baSAndroid Build Coastguard Worker    ramdisk_available: true,
438*d289c2baSAndroid Build Coastguard Worker    vendor_ramdisk_available: true,
439*d289c2baSAndroid Build Coastguard Worker    recovery_available: true,
440*d289c2baSAndroid Build Coastguard Worker    export_include_dirs: ["."],
441*d289c2baSAndroid Build Coastguard Worker    target: {
442*d289c2baSAndroid Build Coastguard Worker        windows: {
443*d289c2baSAndroid Build Coastguard Worker            enabled: true,
444*d289c2baSAndroid Build Coastguard Worker        },
445*d289c2baSAndroid Build Coastguard Worker    },
446*d289c2baSAndroid Build Coastguard Worker    apex_available: [
447*d289c2baSAndroid Build Coastguard Worker        "//apex_available:platform",
448*d289c2baSAndroid Build Coastguard Worker        "com.android.virt",
449*d289c2baSAndroid Build Coastguard Worker    ],
450*d289c2baSAndroid Build Coastguard Worker}
451