Debian Codegraph @

3rdparty/vboot/Android.bp

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