xref: /aosp_15_r20/external/vboot_reference/Android.bp (revision 8617a60d3594060b7ecbd21bc622a7c14f3cf2bc)
1*8617a60dSAndroid Build Coastguard Worker// Copyright 2024 The ChromiumOS Authors
2*8617a60dSAndroid Build Coastguard Worker// Use of this source code is governed by a BSD-style license that can be
3*8617a60dSAndroid Build Coastguard Worker// found in the LICENSE file.
4*8617a60dSAndroid Build Coastguard Worker
5*8617a60dSAndroid Build Coastguard Workercc_defaults {
6*8617a60dSAndroid Build Coastguard Worker    name: "vboot_defaults",
7*8617a60dSAndroid Build Coastguard Worker    visibility: ["//visibility:public"],
8*8617a60dSAndroid Build Coastguard Worker    init_rc: ["vboot.rc"],
9*8617a60dSAndroid Build Coastguard Worker
10*8617a60dSAndroid Build Coastguard Worker    cflags: [
11*8617a60dSAndroid Build Coastguard Worker        "-Wall",
12*8617a60dSAndroid Build Coastguard Worker        "-Werror",
13*8617a60dSAndroid Build Coastguard Worker        "-Wstrict-prototypes",
14*8617a60dSAndroid Build Coastguard Worker        "-Wtype-limits",
15*8617a60dSAndroid Build Coastguard Worker        "-Wundef",
16*8617a60dSAndroid Build Coastguard Worker        "-Wmissing-prototypes",
17*8617a60dSAndroid Build Coastguard Worker        "-Wno-trigraphs",
18*8617a60dSAndroid Build Coastguard Worker        "-Wredundant-decls",
19*8617a60dSAndroid Build Coastguard Worker        "-Wshadow",
20*8617a60dSAndroid Build Coastguard Worker        "-Wwrite-strings",
21*8617a60dSAndroid Build Coastguard Worker        "-Wstrict-aliasing",
22*8617a60dSAndroid Build Coastguard Worker        "-Wdate-time",
23*8617a60dSAndroid Build Coastguard Worker        "-Wno-format-security",
24*8617a60dSAndroid Build Coastguard Worker        "-Wimplicit-fallthrough",
25*8617a60dSAndroid Build Coastguard Worker        "-Wno-address-of-packed-member",
26*8617a60dSAndroid Build Coastguard Worker        "-Wincompatible-function-pointer-types",
27*8617a60dSAndroid Build Coastguard Worker        "-Wno-error=deprecated-declarations",
28*8617a60dSAndroid Build Coastguard Worker        "-D_GNU_SOURCE",
29*8617a60dSAndroid Build Coastguard Worker        "-DCHROMEOS_ENVIRONMENT", // FIRMWARE_ARCH=""
30*8617a60dSAndroid Build Coastguard Worker        "-DUSE_FLASHROM",
31*8617a60dSAndroid Build Coastguard Worker        "-DEXTERNAL_TPM_CLEAR_REQUEST=0",
32*8617a60dSAndroid Build Coastguard Worker        "-Wno-gnu-pointer-arith",
33*8617a60dSAndroid Build Coastguard Worker        "-Wno-ignored-qualifiers",
34*8617a60dSAndroid Build Coastguard Worker        "-Wno-missing-field-initializers",
35*8617a60dSAndroid Build Coastguard Worker        "-Wno-unused-parameter",
36*8617a60dSAndroid Build Coastguard Worker        "-Wno-macro-redefined",
37*8617a60dSAndroid Build Coastguard Worker        "-DTPM2_MODE",
38*8617a60dSAndroid Build Coastguard Worker        "-DEC_EFS=0",
39*8617a60dSAndroid Build Coastguard Worker    ],
40*8617a60dSAndroid Build Coastguard Worker
41*8617a60dSAndroid Build Coastguard Worker    local_include_dirs: [
42*8617a60dSAndroid Build Coastguard Worker        "firmware/include",
43*8617a60dSAndroid Build Coastguard Worker        "firmware/lib/include",
44*8617a60dSAndroid Build Coastguard Worker        "firmware/lib/cgptlib/include",
45*8617a60dSAndroid Build Coastguard Worker        "firmware/lib/tpm_lite/include",
46*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/include",
47*8617a60dSAndroid Build Coastguard Worker
48*8617a60dSAndroid Build Coastguard Worker        // FIRMWARE_STUB
49*8617a60dSAndroid Build Coastguard Worker        "host/include",
50*8617a60dSAndroid Build Coastguard Worker        "host/lib/include",
51*8617a60dSAndroid Build Coastguard Worker        "host/lib21/include",
52*8617a60dSAndroid Build Coastguard Worker    ],
53*8617a60dSAndroid Build Coastguard Worker
54*8617a60dSAndroid Build Coastguard Worker    export_include_dirs: [
55*8617a60dSAndroid Build Coastguard Worker        "host/include",
56*8617a60dSAndroid Build Coastguard Worker        "firmware/include",
57*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/include",
58*8617a60dSAndroid Build Coastguard Worker    ],
59*8617a60dSAndroid Build Coastguard Worker
60*8617a60dSAndroid Build Coastguard Worker    shared_libs: [
61*8617a60dSAndroid Build Coastguard Worker        "libcrypto",
62*8617a60dSAndroid Build Coastguard Worker        "libflashrom",
63*8617a60dSAndroid Build Coastguard Worker        "libssl",
64*8617a60dSAndroid Build Coastguard Worker    ],
65*8617a60dSAndroid Build Coastguard Worker
66*8617a60dSAndroid Build Coastguard Worker    target: {
67*8617a60dSAndroid Build Coastguard Worker        android: {
68*8617a60dSAndroid Build Coastguard Worker            cflags: [
69*8617a60dSAndroid Build Coastguard Worker                "-DCROSSYSTEM_LOCK_DIR=\"/data/vendor/vboot/tmp\"",
70*8617a60dSAndroid Build Coastguard Worker                "-DVBOOT_TMP_DIR=\"/data/vendor/vboot/tmp\"",
71*8617a60dSAndroid Build Coastguard Worker            ],
72*8617a60dSAndroid Build Coastguard Worker        },
73*8617a60dSAndroid Build Coastguard Worker        darwin: {
74*8617a60dSAndroid Build Coastguard Worker            cflags: [
75*8617a60dSAndroid Build Coastguard Worker                "-DHAVE_MACOS",
76*8617a60dSAndroid Build Coastguard Worker                "-DCROSSYSTEM_LOCK_DIR=\"/tmp\"",
77*8617a60dSAndroid Build Coastguard Worker                "-DVBOOT_TMP_DIR=\"/tmp\"",
78*8617a60dSAndroid Build Coastguard Worker            ],
79*8617a60dSAndroid Build Coastguard Worker        },
80*8617a60dSAndroid Build Coastguard Worker        linux: {
81*8617a60dSAndroid Build Coastguard Worker            cflags: [
82*8617a60dSAndroid Build Coastguard Worker                "-DCROSSYSTEM_LOCK_DIR=\"/run/lock\"",
83*8617a60dSAndroid Build Coastguard Worker                "-DVBOOT_TMP_DIR=\"/tmp\"",
84*8617a60dSAndroid Build Coastguard Worker            ],
85*8617a60dSAndroid Build Coastguard Worker        },
86*8617a60dSAndroid Build Coastguard Worker        windows: {
87*8617a60dSAndroid Build Coastguard Worker            cflags: [
88*8617a60dSAndroid Build Coastguard Worker                "-DCROSSYSTEM_LOCK_DIR=\"c:\\windows\\temp\"",
89*8617a60dSAndroid Build Coastguard Worker                "-DVBOOT_TMP_DIR=\"c:\\windows\\temp\"",
90*8617a60dSAndroid Build Coastguard Worker            ],
91*8617a60dSAndroid Build Coastguard Worker        },
92*8617a60dSAndroid Build Coastguard Worker    },
93*8617a60dSAndroid Build Coastguard Worker}
94*8617a60dSAndroid Build Coastguard Worker
95*8617a60dSAndroid Build Coastguard Workerfilegroup {
96*8617a60dSAndroid Build Coastguard Worker    name: "tlcl_srcs",
97*8617a60dSAndroid Build Coastguard Worker    srcs: [
98*8617a60dSAndroid Build Coastguard Worker        "firmware/lib/tpm2_lite/tlcl.c",
99*8617a60dSAndroid Build Coastguard Worker        "firmware/lib/tpm2_lite/marshaling.c",
100*8617a60dSAndroid Build Coastguard Worker    ],
101*8617a60dSAndroid Build Coastguard Worker}
102*8617a60dSAndroid Build Coastguard Worker
103*8617a60dSAndroid Build Coastguard Workercc_library_static {
104*8617a60dSAndroid Build Coastguard Worker    name: "tlcl",
105*8617a60dSAndroid Build Coastguard Worker    defaults: ["vboot_defaults"],
106*8617a60dSAndroid Build Coastguard Worker    host_supported: true,
107*8617a60dSAndroid Build Coastguard Worker    vendor_available: true,
108*8617a60dSAndroid Build Coastguard Worker    srcs: [":tlcl_srcs"],
109*8617a60dSAndroid Build Coastguard Worker}
110*8617a60dSAndroid Build Coastguard Worker
111*8617a60dSAndroid Build Coastguard Workerfilegroup {
112*8617a60dSAndroid Build Coastguard Worker    name: "vboot_fw_srcs",
113*8617a60dSAndroid Build Coastguard Worker    srcs: [
114*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2api.c",
115*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2auxfw_sync.c",
116*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2common.c",
117*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2context.c",
118*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2crc8.c",
119*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2crypto.c",
120*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2ec_sync.c",
121*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2firmware.c",
122*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2gbb.c",
123*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2hmac.c",
124*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2kernel.c",
125*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2load_kernel.c",
126*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2misc.c",
127*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2nvstorage.c",
128*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2packed_key.c",
129*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2recovery_reasons.c",
130*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2rsa.c",
131*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2secdata_firmware.c",
132*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2secdata_fwmp.c",
133*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2secdata_kernel.c",
134*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2sha1.c",
135*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2sha256.c",
136*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2sha512.c",
137*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2sha_utility.c",
138*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2struct.c",
139*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2stub_hwcrypto.c",
140*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2tpm_bootmode.c",
141*8617a60dSAndroid Build Coastguard Worker        "firmware/lib/cgptlib/cgptlib.c",
142*8617a60dSAndroid Build Coastguard Worker        "firmware/lib/cgptlib/cgptlib_internal.c",
143*8617a60dSAndroid Build Coastguard Worker        "firmware/lib/cgptlib/crc32.c",
144*8617a60dSAndroid Build Coastguard Worker        "firmware/lib/gpt_misc.c",
145*8617a60dSAndroid Build Coastguard Worker        "firmware/lib20/api_kernel.c",
146*8617a60dSAndroid Build Coastguard Worker        "firmware/lib20/kernel.c",
147*8617a60dSAndroid Build Coastguard Worker
148*8617a60dSAndroid Build Coastguard Worker        // FIRMWARE_STUB
149*8617a60dSAndroid Build Coastguard Worker        "firmware/stub/tpm_lite_stub.c",
150*8617a60dSAndroid Build Coastguard Worker        "firmware/stub/vboot_api_stub_disk.c",
151*8617a60dSAndroid Build Coastguard Worker        "firmware/stub/vboot_api_stub_stream.c",
152*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2stub.c",
153*8617a60dSAndroid Build Coastguard Worker    ],
154*8617a60dSAndroid Build Coastguard Worker}
155*8617a60dSAndroid Build Coastguard Worker
156*8617a60dSAndroid Build Coastguard Workercc_library_static {
157*8617a60dSAndroid Build Coastguard Worker    name: "vboot_fw",
158*8617a60dSAndroid Build Coastguard Worker    defaults: ["vboot_defaults"],
159*8617a60dSAndroid Build Coastguard Worker    host_supported: true,
160*8617a60dSAndroid Build Coastguard Worker    vendor_available: true,
161*8617a60dSAndroid Build Coastguard Worker    srcs: [":vboot_fw_srcs"],
162*8617a60dSAndroid Build Coastguard Worker}
163*8617a60dSAndroid Build Coastguard Worker
164*8617a60dSAndroid Build Coastguard Workercc_defaults {
165*8617a60dSAndroid Build Coastguard Worker    name: "libvboot_defaults",
166*8617a60dSAndroid Build Coastguard Worker    defaults: ["vboot_defaults"],
167*8617a60dSAndroid Build Coastguard Worker    srcs: [
168*8617a60dSAndroid Build Coastguard Worker        // USE_FLASHROM
169*8617a60dSAndroid Build Coastguard Worker        "host/lib/flashrom.c",
170*8617a60dSAndroid Build Coastguard Worker        "host/lib/flashrom_drv.c",
171*8617a60dSAndroid Build Coastguard Worker
172*8617a60dSAndroid Build Coastguard Worker        "host/lib/subprocess.c",
173*8617a60dSAndroid Build Coastguard Worker        "host/lib/cbfstool.c",
174*8617a60dSAndroid Build Coastguard Worker    ],
175*8617a60dSAndroid Build Coastguard Worker}
176*8617a60dSAndroid Build Coastguard Worker
177*8617a60dSAndroid Build Coastguard Workerfilegroup {
178*8617a60dSAndroid Build Coastguard Worker    name: "cgpt_common",
179*8617a60dSAndroid Build Coastguard Worker    srcs: [
180*8617a60dSAndroid Build Coastguard Worker        "cgpt/cgpt_add.c",
181*8617a60dSAndroid Build Coastguard Worker        "cgpt/cgpt_boot.c",
182*8617a60dSAndroid Build Coastguard Worker        "cgpt/cgpt_common.c",
183*8617a60dSAndroid Build Coastguard Worker        "cgpt/cgpt_create.c",
184*8617a60dSAndroid Build Coastguard Worker        "cgpt/cgpt_edit.c",
185*8617a60dSAndroid Build Coastguard Worker        "cgpt/cgpt_prioritize.c",
186*8617a60dSAndroid Build Coastguard Worker        "cgpt/cgpt_repair.c",
187*8617a60dSAndroid Build Coastguard Worker        "cgpt/cgpt_show.c",
188*8617a60dSAndroid Build Coastguard Worker    ],
189*8617a60dSAndroid Build Coastguard Worker}
190*8617a60dSAndroid Build Coastguard Worker
191*8617a60dSAndroid Build Coastguard Workercc_library_static {
192*8617a60dSAndroid Build Coastguard Worker    name: "libvboot_util",
193*8617a60dSAndroid Build Coastguard Worker    defaults: ["libvboot_defaults"],
194*8617a60dSAndroid Build Coastguard Worker    host_supported: true,
195*8617a60dSAndroid Build Coastguard Worker    vendor_available: true,
196*8617a60dSAndroid Build Coastguard Worker
197*8617a60dSAndroid Build Coastguard Worker    srcs: [
198*8617a60dSAndroid Build Coastguard Worker        ":cgpt_common",
199*8617a60dSAndroid Build Coastguard Worker        "futility/dump_kernel_config_lib.c",
200*8617a60dSAndroid Build Coastguard Worker        "host/lib/chromeos_config.c",
201*8617a60dSAndroid Build Coastguard Worker        "host/lib/crossystem.c",
202*8617a60dSAndroid Build Coastguard Worker        "host/lib/crypto.c",
203*8617a60dSAndroid Build Coastguard Worker        "host/lib/file_keys.c",
204*8617a60dSAndroid Build Coastguard Worker        "host/lib/fmap.c",
205*8617a60dSAndroid Build Coastguard Worker        "host/lib/host_common.c",
206*8617a60dSAndroid Build Coastguard Worker        "host/lib/host_key2.c",
207*8617a60dSAndroid Build Coastguard Worker        "host/lib/host_keyblock.c",
208*8617a60dSAndroid Build Coastguard Worker        "host/lib/host_misc.c",
209*8617a60dSAndroid Build Coastguard Worker        "host/lib/host_p11_stub.c",
210*8617a60dSAndroid Build Coastguard Worker        "host/lib/host_signature.c",
211*8617a60dSAndroid Build Coastguard Worker        "host/lib/host_signature2.c",
212*8617a60dSAndroid Build Coastguard Worker        "host/lib/signature_digest.c",
213*8617a60dSAndroid Build Coastguard Worker        "host/lib/util_misc.c",
214*8617a60dSAndroid Build Coastguard Worker        "host/lib21/host_common.c",
215*8617a60dSAndroid Build Coastguard Worker        "host/lib21/host_key.c",
216*8617a60dSAndroid Build Coastguard Worker        "host/lib21/host_misc.c",
217*8617a60dSAndroid Build Coastguard Worker        "host/lib21/host_signature.c",
218*8617a60dSAndroid Build Coastguard Worker        ":vboot_fw_srcs",
219*8617a60dSAndroid Build Coastguard Worker        ":tlcl_srcs",
220*8617a60dSAndroid Build Coastguard Worker    ],
221*8617a60dSAndroid Build Coastguard Worker
222*8617a60dSAndroid Build Coastguard Worker    arch: {
223*8617a60dSAndroid Build Coastguard Worker        arm: {
224*8617a60dSAndroid Build Coastguard Worker            srcs: [
225*8617a60dSAndroid Build Coastguard Worker                "host/arch/arm/lib/crossystem_arch.c",
226*8617a60dSAndroid Build Coastguard Worker            ],
227*8617a60dSAndroid Build Coastguard Worker        },
228*8617a60dSAndroid Build Coastguard Worker        arm64: {
229*8617a60dSAndroid Build Coastguard Worker            srcs: [
230*8617a60dSAndroid Build Coastguard Worker                "host/arch/arm/lib/crossystem_arch.c",
231*8617a60dSAndroid Build Coastguard Worker            ],
232*8617a60dSAndroid Build Coastguard Worker        },
233*8617a60dSAndroid Build Coastguard Worker        x86: {
234*8617a60dSAndroid Build Coastguard Worker            srcs: [
235*8617a60dSAndroid Build Coastguard Worker                "host/arch/x86/lib/crossystem_arch.c",
236*8617a60dSAndroid Build Coastguard Worker            ],
237*8617a60dSAndroid Build Coastguard Worker        },
238*8617a60dSAndroid Build Coastguard Worker        x86_64: {
239*8617a60dSAndroid Build Coastguard Worker            srcs: [
240*8617a60dSAndroid Build Coastguard Worker                "host/arch/x86/lib/crossystem_arch.c",
241*8617a60dSAndroid Build Coastguard Worker            ],
242*8617a60dSAndroid Build Coastguard Worker        },
243*8617a60dSAndroid Build Coastguard Worker    },
244*8617a60dSAndroid Build Coastguard Worker}
245*8617a60dSAndroid Build Coastguard Worker
246*8617a60dSAndroid Build Coastguard Workercc_library_static {
247*8617a60dSAndroid Build Coastguard Worker    name: "libvboot_host",
248*8617a60dSAndroid Build Coastguard Worker    defaults: ["libvboot_defaults"],
249*8617a60dSAndroid Build Coastguard Worker    host_supported: true,
250*8617a60dSAndroid Build Coastguard Worker    vendor_available: true,
251*8617a60dSAndroid Build Coastguard Worker
252*8617a60dSAndroid Build Coastguard Worker    srcs: [
253*8617a60dSAndroid Build Coastguard Worker        ":cgpt_common",
254*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2common.c",
255*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2context.c",
256*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2crc8.c",
257*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2crypto.c",
258*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2hmac.c",
259*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2nvstorage.c",
260*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2recovery_reasons.c",
261*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2rsa.c",
262*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2sha1.c",
263*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2sha256.c",
264*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2sha512.c",
265*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2sha_utility.c",
266*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2struct.c",
267*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2stub.c",
268*8617a60dSAndroid Build Coastguard Worker        "firmware/2lib/2stub_hwcrypto.c",
269*8617a60dSAndroid Build Coastguard Worker        "firmware/lib/cgptlib/cgptlib_internal.c",
270*8617a60dSAndroid Build Coastguard Worker        "firmware/lib/cgptlib/crc32.c",
271*8617a60dSAndroid Build Coastguard Worker        "firmware/lib/gpt_misc.c",
272*8617a60dSAndroid Build Coastguard Worker        "firmware/stub/tpm_lite_stub.c",
273*8617a60dSAndroid Build Coastguard Worker        "firmware/stub/vboot_api_stub_disk.c",
274*8617a60dSAndroid Build Coastguard Worker        "futility/dump_kernel_config_lib.c",
275*8617a60dSAndroid Build Coastguard Worker        "host/lib/chromeos_config.c",
276*8617a60dSAndroid Build Coastguard Worker        "host/lib/crossystem.c",
277*8617a60dSAndroid Build Coastguard Worker        "host/lib/crypto.c",
278*8617a60dSAndroid Build Coastguard Worker        "host/lib/extract_vmlinuz.c",
279*8617a60dSAndroid Build Coastguard Worker        "host/lib/fmap.c",
280*8617a60dSAndroid Build Coastguard Worker        "host/lib/host_misc.c",
281*8617a60dSAndroid Build Coastguard Worker        "host/lib21/host_misc.c",
282*8617a60dSAndroid Build Coastguard Worker        ":tlcl_srcs",
283*8617a60dSAndroid Build Coastguard Worker    ],
284*8617a60dSAndroid Build Coastguard Worker
285*8617a60dSAndroid Build Coastguard Worker    arch: {
286*8617a60dSAndroid Build Coastguard Worker        arm: {
287*8617a60dSAndroid Build Coastguard Worker            srcs: [
288*8617a60dSAndroid Build Coastguard Worker                "host/arch/arm/lib/crossystem_arch.c",
289*8617a60dSAndroid Build Coastguard Worker            ],
290*8617a60dSAndroid Build Coastguard Worker        },
291*8617a60dSAndroid Build Coastguard Worker        arm64: {
292*8617a60dSAndroid Build Coastguard Worker            srcs: [
293*8617a60dSAndroid Build Coastguard Worker                "host/arch/arm/lib/crossystem_arch.c",
294*8617a60dSAndroid Build Coastguard Worker            ],
295*8617a60dSAndroid Build Coastguard Worker        },
296*8617a60dSAndroid Build Coastguard Worker        x86: {
297*8617a60dSAndroid Build Coastguard Worker            srcs: [
298*8617a60dSAndroid Build Coastguard Worker                "host/arch/x86/lib/crossystem_arch.c",
299*8617a60dSAndroid Build Coastguard Worker            ],
300*8617a60dSAndroid Build Coastguard Worker        },
301*8617a60dSAndroid Build Coastguard Worker        x86_64: {
302*8617a60dSAndroid Build Coastguard Worker            srcs: [
303*8617a60dSAndroid Build Coastguard Worker                "host/arch/x86/lib/crossystem_arch.c",
304*8617a60dSAndroid Build Coastguard Worker            ],
305*8617a60dSAndroid Build Coastguard Worker        },
306*8617a60dSAndroid Build Coastguard Worker    },
307*8617a60dSAndroid Build Coastguard Worker}
308*8617a60dSAndroid Build Coastguard Worker
309*8617a60dSAndroid Build Coastguard Workercc_binary {
310*8617a60dSAndroid Build Coastguard Worker    name: "cgpt",
311*8617a60dSAndroid Build Coastguard Worker    defaults: ["vboot_defaults"],
312*8617a60dSAndroid Build Coastguard Worker    host_supported: true,
313*8617a60dSAndroid Build Coastguard Worker    vendor: true,
314*8617a60dSAndroid Build Coastguard Worker
315*8617a60dSAndroid Build Coastguard Worker    srcs: [
316*8617a60dSAndroid Build Coastguard Worker        "cgpt/cgpt.c",
317*8617a60dSAndroid Build Coastguard Worker        ":cgpt_common",
318*8617a60dSAndroid Build Coastguard Worker        "cgpt/cgpt_find.c",
319*8617a60dSAndroid Build Coastguard Worker        "cgpt/cgpt_legacy.c",
320*8617a60dSAndroid Build Coastguard Worker        "cgpt/cmd_add.c",
321*8617a60dSAndroid Build Coastguard Worker        "cgpt/cmd_boot.c",
322*8617a60dSAndroid Build Coastguard Worker        "cgpt/cmd_create.c",
323*8617a60dSAndroid Build Coastguard Worker        "cgpt/cmd_edit.c",
324*8617a60dSAndroid Build Coastguard Worker        "cgpt/cmd_find.c",
325*8617a60dSAndroid Build Coastguard Worker        "cgpt/cmd_legacy.c",
326*8617a60dSAndroid Build Coastguard Worker        "cgpt/cmd_prioritize.c",
327*8617a60dSAndroid Build Coastguard Worker        "cgpt/cmd_repair.c",
328*8617a60dSAndroid Build Coastguard Worker        "cgpt/cmd_show.c",
329*8617a60dSAndroid Build Coastguard Worker    ],
330*8617a60dSAndroid Build Coastguard Worker
331*8617a60dSAndroid Build Coastguard Worker    include_dirs: [
332*8617a60dSAndroid Build Coastguard Worker        "external/e2fsprogs/lib/",
333*8617a60dSAndroid Build Coastguard Worker    ],
334*8617a60dSAndroid Build Coastguard Worker
335*8617a60dSAndroid Build Coastguard Worker    static_libs: [
336*8617a60dSAndroid Build Coastguard Worker        "libext2_uuid",
337*8617a60dSAndroid Build Coastguard Worker        "libvboot_util",
338*8617a60dSAndroid Build Coastguard Worker    ],
339*8617a60dSAndroid Build Coastguard Worker}
340*8617a60dSAndroid Build Coastguard Worker
341*8617a60dSAndroid Build Coastguard Workerfilegroup {
342*8617a60dSAndroid Build Coastguard Worker    name: "futility_srcs",
343*8617a60dSAndroid Build Coastguard Worker    srcs: [
344*8617a60dSAndroid Build Coastguard Worker        "futility/futility.c",
345*8617a60dSAndroid Build Coastguard Worker        "futility/cmd_create.c",
346*8617a60dSAndroid Build Coastguard Worker        "futility/cmd_dump_fmap.c",
347*8617a60dSAndroid Build Coastguard Worker        "futility/cmd_dump_kernel_config.c",
348*8617a60dSAndroid Build Coastguard Worker        "futility/cmd_flash_util.c",
349*8617a60dSAndroid Build Coastguard Worker        "futility/cmd_gbb_utility.c",
350*8617a60dSAndroid Build Coastguard Worker        "futility/cmd_gscvd.c",
351*8617a60dSAndroid Build Coastguard Worker        "futility/cmd_load_fmap.c",
352*8617a60dSAndroid Build Coastguard Worker        "futility/cmd_pcr.c",
353*8617a60dSAndroid Build Coastguard Worker        "futility/cmd_read.c",
354*8617a60dSAndroid Build Coastguard Worker        "futility/cmd_show.c",
355*8617a60dSAndroid Build Coastguard Worker        "futility/cmd_sign.c",
356*8617a60dSAndroid Build Coastguard Worker        "futility/cmd_update.c",
357*8617a60dSAndroid Build Coastguard Worker        "futility/cmd_vbutil_firmware.c",
358*8617a60dSAndroid Build Coastguard Worker        "futility/cmd_vbutil_kernel.c",
359*8617a60dSAndroid Build Coastguard Worker        "futility/cmd_vbutil_key.c",
360*8617a60dSAndroid Build Coastguard Worker        "futility/cmd_vbutil_keyblock.c",
361*8617a60dSAndroid Build Coastguard Worker        "futility/file_type_bios.c",
362*8617a60dSAndroid Build Coastguard Worker        "futility/file_type.c",
363*8617a60dSAndroid Build Coastguard Worker        "futility/file_type_rwsig.c",
364*8617a60dSAndroid Build Coastguard Worker        "futility/file_type_usbpd1.c",
365*8617a60dSAndroid Build Coastguard Worker        "futility/flash_helpers.c",
366*8617a60dSAndroid Build Coastguard Worker        "futility/platform_csme.c",
367*8617a60dSAndroid Build Coastguard Worker        "futility/misc.c",
368*8617a60dSAndroid Build Coastguard Worker        "futility/vb1_helper.c",
369*8617a60dSAndroid Build Coastguard Worker        "futility/vb2_helper.c",
370*8617a60dSAndroid Build Coastguard Worker
371*8617a60dSAndroid Build Coastguard Worker        // USE_FLASHROM
372*8617a60dSAndroid Build Coastguard Worker        "host/lib/flashrom_drv.c",
373*8617a60dSAndroid Build Coastguard Worker        "futility/updater_archive.c",
374*8617a60dSAndroid Build Coastguard Worker        "futility/updater_dut.c",
375*8617a60dSAndroid Build Coastguard Worker        "futility/updater_manifest.c",
376*8617a60dSAndroid Build Coastguard Worker        "futility/updater_quirks.c",
377*8617a60dSAndroid Build Coastguard Worker        "futility/updater_utils.c",
378*8617a60dSAndroid Build Coastguard Worker        "futility/updater.c",
379*8617a60dSAndroid Build Coastguard Worker    ],
380*8617a60dSAndroid Build Coastguard Worker}
381*8617a60dSAndroid Build Coastguard Worker
382*8617a60dSAndroid Build Coastguard Workergenrule {
383*8617a60dSAndroid Build Coastguard Worker    name: "futility_cmds",
384*8617a60dSAndroid Build Coastguard Worker    cmd: "grep -hoRE '^DECLARE_FUTIL_COMMAND\\([^,]+' $(locations :futility_srcs) | sed 's/DECLARE_FUTIL_COMMAND(\\(.*\\)/_CMD(\\1)/' | sort >>$(genDir)/commands" +
385*8617a60dSAndroid Build Coastguard Worker        "&& $(location scripts/getversion.sh) >> $(out)" +
386*8617a60dSAndroid Build Coastguard Worker        "&& echo '#define _CMD(NAME) extern const struct futil_cmd_t __cmd_##NAME;' >> $(out)" +
387*8617a60dSAndroid Build Coastguard Worker        "&& cat $(genDir)/commands >> $(out)" +
388*8617a60dSAndroid Build Coastguard Worker        "&& echo '#undef _CMD' >> $(out)" +
389*8617a60dSAndroid Build Coastguard Worker        "&& echo '#define _CMD(NAME) &__cmd_##NAME,' >> $(out)" +
390*8617a60dSAndroid Build Coastguard Worker        "&& echo 'const struct futil_cmd_t *const futil_cmds[] = {' >> $(out)" +
391*8617a60dSAndroid Build Coastguard Worker        "&& cat $(genDir)/commands >> $(out)" +
392*8617a60dSAndroid Build Coastguard Worker        "&& echo '0};  /* null-terminated */' >> $(out)" +
393*8617a60dSAndroid Build Coastguard Worker        "&& echo '#undef _CMD' >> $(out)",
394*8617a60dSAndroid Build Coastguard Worker    srcs: [
395*8617a60dSAndroid Build Coastguard Worker        ":futility_srcs",
396*8617a60dSAndroid Build Coastguard Worker        "scripts/getversion.sh",
397*8617a60dSAndroid Build Coastguard Worker    ],
398*8617a60dSAndroid Build Coastguard Worker    out: ["futility_cmds.c"],
399*8617a60dSAndroid Build Coastguard Worker}
400*8617a60dSAndroid Build Coastguard Worker
401*8617a60dSAndroid Build Coastguard Workercc_binary {
402*8617a60dSAndroid Build Coastguard Worker    name: "futility",
403*8617a60dSAndroid Build Coastguard Worker    defaults: ["vboot_defaults"],
404*8617a60dSAndroid Build Coastguard Worker    host_supported: true,
405*8617a60dSAndroid Build Coastguard Worker    vendor: true,
406*8617a60dSAndroid Build Coastguard Worker
407*8617a60dSAndroid Build Coastguard Worker    srcs: [":futility_srcs"],
408*8617a60dSAndroid Build Coastguard Worker    generated_sources: ["futility_cmds"],
409*8617a60dSAndroid Build Coastguard Worker
410*8617a60dSAndroid Build Coastguard Worker    local_include_dirs: ["futility"],
411*8617a60dSAndroid Build Coastguard Worker
412*8617a60dSAndroid Build Coastguard Worker    static_libs: ["libvboot_util"],
413*8617a60dSAndroid Build Coastguard Worker}
414*8617a60dSAndroid Build Coastguard Worker
415*8617a60dSAndroid Build Coastguard Workercc_binary {
416*8617a60dSAndroid Build Coastguard Worker    name: "crossystem",
417*8617a60dSAndroid Build Coastguard Worker    defaults: ["vboot_defaults"],
418*8617a60dSAndroid Build Coastguard Worker    host_supported: true,
419*8617a60dSAndroid Build Coastguard Worker    vendor_available: true,
420*8617a60dSAndroid Build Coastguard Worker
421*8617a60dSAndroid Build Coastguard Worker    srcs: ["utility/crossystem.c"],
422*8617a60dSAndroid Build Coastguard Worker    static_libs: ["libvboot_util"],
423*8617a60dSAndroid Build Coastguard Worker}
424