blob: 8e69c1b3848ba0149846a0d429434b891d6a1dbf [file] [log] [blame]
Randall Spanglere8cfa312013-01-02 16:49:38 -08001# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
Gaurav Shah322536d2010-01-28 15:01:23 -08002# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
Simon Glass6d696e52011-11-14 13:46:33 -08005# This Makefile normally builds in a 'build' subdir, but use
6#
7# make BUILD=<dir>
8#
Bill Richardsoneecc18f2013-01-17 15:28:17 -08009# to put the output somewhere else.
10
11##############################################################################
12# Make variables come in two flavors, immediate or deferred.
13#
14# Variable definitions are parsed like this:
15#
16# IMMEDIATE = DEFERRED
17# or
18# IMMEDIATE := IMMEDIATE
19#
20# Rules are parsed this way:
21#
22# IMMEDIATE : IMMEDIATE
23# DEFERRED
24#
25# So you can assign variables in any order if they're only to be used in
26# actions, but if you use a variable in either the target or prerequisite of a
27# rule, the rule will be constructed using only the top-down, immediate value.
28#
29# So we'll try to define all the variables first. Then the rules.
30#
31
32##############################################################################
33# Configuration variables come first.
34#
35# Our convention is that we only use := for variables that will never be
36# changed or appended. They must be defined before being used anywhere.
37
38# we should only run pwd once, not every time we refer to ${BUILD}.
39_whereami := $(shell pwd)
40BUILD ?= $(_whereami)/build
Randall Spangler844bce52013-01-15 16:16:43 -080041export BUILD
Simon Glass6d696e52011-11-14 13:46:33 -080042
Randall Spangler5d9bbf22013-01-08 10:44:23 -080043# Target for 'make install'
44DESTDIR ?= /usr/bin
Bill Richardson826db092013-01-14 12:37:15 -080045INSTALL ?= install
Randall Spangler5d9bbf22013-01-08 10:44:23 -080046
Bill Richardsoneecc18f2013-01-17 15:28:17 -080047# Where to install the (exportable) executables for testing?
48TEST_INSTALL_DIR = ${BUILD}/install_for_test
49
50# Verbose? Use V=1
51ifeq (${V},)
52Q := @
53endif
54
Simon Glassb265c342011-11-16 15:09:51 -080055# Provide default CC and CFLAGS for firmware builds; if you have any -D flags,
56# please add them after this point (e.g., -DVBOOT_DEBUG).
Che-Liang Chiou74359b72011-06-21 15:25:51 -070057#
Che-Liang Chiou6b0003c2011-10-14 11:11:28 +080058# TODO(crosbug.com/16808) We hard-code u-boot's compiler flags here just
59# temporarily. As we are still investigating which flags are necessary for
60# maintaining a compatible ABI, etc. between u-boot and vboot_reference.
Che-Liang Chiou74359b72011-06-21 15:25:51 -070061#
Simon Glassb265c342011-11-16 15:09:51 -080062# As a first step, this makes the setting of CC and CFLAGS here optional, to
63# permit a calling script or Makefile to set these.
Che-Liang Chiou74359b72011-06-21 15:25:51 -070064#
Simon Glassb265c342011-11-16 15:09:51 -080065# Flag ordering: arch, then -f, then -m, then -W
66DEBUG_FLAGS := $(if ${DEBUG},-g -O0,-Os)
67COMMON_FLAGS := -nostdinc -pipe \
68 -ffreestanding -fno-builtin -fno-stack-protector \
Bill Richardsoneecc18f2013-01-17 15:28:17 -080069 -Werror -Wall -Wstrict-prototypes ${DEBUG_FLAGS}
Simon Glassb265c342011-11-16 15:09:51 -080070
Bill Richardsoneecc18f2013-01-17 15:28:17 -080071# Note: FIRMWARE_ARCH is defined by the Chromium OS ebuild.
72ifeq (${FIRMWARE_ARCH}, arm)
Simon Glassb265c342011-11-16 15:09:51 -080073CC ?= armv7a-cros-linux-gnueabi-gcc
74CFLAGS ?= -march=armv5 \
75 -fno-common -ffixed-r8 \
Doug Andersond50b27d2012-05-11 12:08:02 -070076 -mfloat-abi=hard -marm -mabi=aapcs-linux -mno-thumb-interwork \
Bill Richardsoneecc18f2013-01-17 15:28:17 -080077 ${COMMON_FLAGS}
78else ifeq (${FIRMWARE_ARCH}, i386)
Simon Glassb265c342011-11-16 15:09:51 -080079CC ?= i686-pc-linux-gnu-gcc
80# Drop -march=i386 to permit use of SSE instructions
81CFLAGS ?= \
82 -ffunction-sections -fvisibility=hidden -fno-strict-aliasing \
83 -fomit-frame-pointer -fno-toplevel-reorder -fno-dwarf2-cfi-asm \
84 -mpreferred-stack-boundary=2 -mregparm=3 \
Bill Richardsoneecc18f2013-01-17 15:28:17 -080085 ${COMMON_FLAGS}
86else ifeq (${FIRMWARE_ARCH}, x86_64)
87CFLAGS ?= ${COMMON_FLAGS} \
Simon Glass8e85e982011-11-22 13:54:50 -080088 -fvisibility=hidden -fno-strict-aliasing -fomit-frame-pointer
Randall Spangler844bce52013-01-15 16:16:43 -080089else
Bill Richardsoneecc18f2013-01-17 15:28:17 -080090# FIRMWARE_ARCH not defined; assuming local compile.
Randall Spangler5d9bbf22013-01-08 10:44:23 -080091CC ?= gcc
Bill Richardsoneecc18f2013-01-17 15:28:17 -080092CFLAGS += -DCHROMEOS_ENVIRONMENT -Wall -Werror # HEY: always want last two?
Che-Liang Chiou34be8272011-01-27 16:44:36 +080093endif
94
95ifneq (${DEBUG},)
96CFLAGS += -DVBOOT_DEBUG
vbendebb2b0fcc2010-07-15 15:09:47 -070097endif
Che-Liang Chiou0a0e8d02010-11-30 09:30:45 +080098
vbendebb2b0fcc2010-07-15 15:09:47 -070099ifeq (${DISABLE_NDEBUG},)
100CFLAGS += -DNDEBUG
101endif
102
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800103# Create / use dependency files
104CFLAGS += -MMD -MF $@.d
Simon Glassb265c342011-11-16 15:09:51 -0800105
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800106# Code coverage. Run like this: COV=1 make runtests coverage
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800107ifneq (${COV},)
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800108COV_FLAGS = -O0 --coverage
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800109CFLAGS += ${COV_FLAGS}
110LDFLAGS += ${COV_FLAGS}
Che-Liang Chiou0a0e8d02010-11-30 09:30:45 +0800111endif
Gaurav Shah322536d2010-01-28 15:01:23 -0800112
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800113# And a few more default utilities
114LD = ${CC}
115CXX ?= g++ # HEY: really?
116PKG_CONFIG ?= pkg-config
117
118# Architecture detection. If we're cross-compiling, we may need to run unit
119# tests inside QEMU.
120_machname := $(shell uname -m)
121HOST_ARCH ?= ${_machname}
122
123# Note: ARCH is defined by the Chromium OS ebuild. Pick a sane target
124# architecture if none is defined.
125ifeq (${ARCH},)
126 ARCH := ${HOST_ARCH}
127 ifeq (${ARCH}, x86_64)
128 ARCH := amd64
129 endif
130endif
131
132# Determine QEMU architecture needed, if any
133ifeq (${ARCH},${HOST_ARCH})
134 # Same architecture; no need for QEMU
135 QEMU_ARCH :=
136else ifeq (${HOST_ARCH}-${ARCH},x86_64-i386)
137 # 64-bit host can run 32-bit targets directly
138 QEMU_ARCH :=
139else ifeq (${HOST_ARCH}-${ARCH},x86_64-amd64)
140 # 64-bit host can run 64-bit directly
141 QEMU_ARCH :=
142else ifeq (${ARCH},amd64)
143 QEMU_ARCH := x86_64
144else
145 QEMU_ARCH := ${ARCH}
146endif
147
148# The top of the chroot for qemu must be passed in via the SYSROOT environment
149# variable. In the Chromium OS chroot, this is done automatically by the
150# ebuild.
151
152ifeq (${QEMU_ARCH},)
153 # Path to build output for running tests is same as for building
154 BUILD_RUN = ${BUILD}
155else
156 $(info Using qemu for testing.)
157 # Path to build output for running tests is different in the chroot
158 BUILD_RUN = $(subst ${SYSROOT},,${BUILD})
159
160 QEMU_BIN = qemu-${QEMU_ARCH}
161 QEMU_OPTS = -drop-ld-preload \
162 -E LD_LIBRARY_PATH=/lib64:/lib:/usr/lib64:/usr/lib \
163 -E HOME=${HOME} \
164 -E BUILD=${BUILD_RUN}
165 QEMU_CMD = sudo chroot ${SYSROOT} ${BUILD_RUN}/${QEMU_BIN} ${QEMU_OPTS} --
166 RUNTEST = ${QEMU_CMD}
167endif
168
169
170
171# Some things only compile inside the Chromium OS chroot.
172# TODO: Those things should be in their own repo, not part of vboot_reference
173# TODO: Is there a better way to detect this?
174ifneq (${CROS_WORKON_SRCROOT},)
175IN_CHROOT := yes
176endif
177
178# TODO: Move to separate repo.
179ifneq (${IN_CHROOT},)
180PC_BASE_VER ?= 125070
181PC_DEPS := libchrome-${PC_BASE_VER}
182PC_CFLAGS := $(shell ${PKG_CONFIG} --cflags ${PC_DEPS})
183PC_LDLIBS := $(shell ${PKG_CONFIG} --libs ${PC_DEPS})
184endif
185
186
187##############################################################################
188# Now we need to describe everything we might want or need to build
189
190# TODO: This should go in its own repo.
191AU_CGPTLIB = ${BUILD}/cgpt/libcgpt-cc.a
192# This is just ... Gah. There's no good place for it.
193DUMPKERNELCONFIGLIB = ${BUILD}/libdump_kernel_config.a
194
195# Everything wants these headers.
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800196INCLUDES += \
197 -Ifirmware/include \
198 -Ifirmware/lib/include \
199 -Ifirmware/lib/cgptlib/include \
200 -Ifirmware/lib/cryptolib/include \
201 -Ifirmware/lib/tpm_lite/include
Bill Richardson0b8f35c2010-05-26 09:18:38 -0700202
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800203# If we're not building for a specific target, just stub out things like the
204# TPM commands and various external functions that are provided by the BIOS.
205ifeq (${FIRMWARE_ARCH},)
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800206INCLUDES += -Ifirmware/stub/include
Che-Liang Chiou0a0e8d02010-11-30 09:30:45 +0800207else
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800208INCLUDES += -Ifirmware/arch/${FIRMWARE_ARCH}/include
Che-Liang Chiou0a0e8d02010-11-30 09:30:45 +0800209endif
Gaurav Shah322536d2010-01-28 15:01:23 -0800210
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800211# Firmware library. TODO: Do we still need to export this?
212FWLIB = ${BUILD}/vboot_fw.a
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800213
214# find lib -iname '*.c' | sort
215FWLIB_SRCS = \
216 firmware/lib/cgptlib/cgptlib.c \
217 firmware/lib/cgptlib/cgptlib_internal.c \
218 firmware/lib/cgptlib/crc32.c \
219 firmware/lib/crc8.c \
220 firmware/lib/cryptolib/padding.c \
221 firmware/lib/cryptolib/rsa.c \
222 firmware/lib/cryptolib/rsa_utility.c \
223 firmware/lib/cryptolib/sha1.c \
224 firmware/lib/cryptolib/sha256.c \
225 firmware/lib/cryptolib/sha512.c \
226 firmware/lib/cryptolib/sha_utility.c \
227 firmware/lib/stateful_util.c \
228 firmware/lib/utility.c \
229 firmware/lib/utility_string.c \
230 firmware/lib/vboot_api_init.c \
231 firmware/lib/vboot_api_firmware.c \
232 firmware/lib/vboot_api_kernel.c \
233 firmware/lib/vboot_audio.c \
234 firmware/lib/vboot_common.c \
235 firmware/lib/vboot_display.c \
236 firmware/lib/vboot_firmware.c \
237 firmware/lib/vboot_kernel.c \
238 firmware/lib/vboot_nvstorage.c
239
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800240# Support real TPM unless BIOS sets MOCK_TPM
241ifeq (${MOCK_TPM},)
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800242FWLIB_SRCS += \
243 firmware/lib/rollback_index.c \
244 firmware/lib/tpm_bootmode.c \
245 firmware/lib/tpm_lite/tlcl.c
246else
247FWLIB_SRCS += \
248 firmware/lib/mocked_rollback_index.c \
249 firmware/lib/mocked_tpm_bootmode.c \
250 firmware/lib/tpm_lite/mocked_tlcl.c
251endif
252
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800253ifeq (${FIRMWARE_ARCH},)
254# Include BIOS stubs in the firmware library when compiling for host
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800255FWLIB_SRCS += \
256 firmware/stub/tpm_lite_stub.c \
257 firmware/stub/utility_stub.c \
258 firmware/stub/vboot_api_stub.c \
259 firmware/stub/vboot_api_stub_disk.c
260endif
261
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800262FWLIB_OBJS = ${FWLIB_SRCS:%.c=${BUILD}/%.o}
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800263ALL_OBJS += ${FWLIB_OBJS}
264
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800265
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800266# Library to build the utilities. "HOST" mostly means "userspace".
267HOSTLIB = ${BUILD}/vboot_host.a
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800268
269HOSTLIB_SRCS = \
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800270 host/arch/${ARCH}/lib/crossystem_arch.c \
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800271 host/lib/crossystem.c \
272 host/lib/file_keys.c \
273 host/lib/fmap.c \
274 host/lib/host_common.c \
275 host/lib/host_key.c \
276 host/lib/host_keyblock.c \
277 host/lib/host_misc.c \
278 host/lib/host_signature.c \
279 host/lib/signature_digest.c
280
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800281HOSTLIB_OBJS = ${HOSTLIB_SRCS:%.c=${BUILD}/%.o}
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800282ALL_OBJS += ${HOSTLIB_OBJS}
283
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800284
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800285# Link with hostlib by default
286LIBS = $(HOSTLIB)
287
288# Might need this too.
289CRYPTO_LIBS := $(shell ${PKG_CONFIG} --libs libcrypto)
290
291
292# ----------------------------------------------------------------------------
293# Now for the userspace binaries
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800294
295CGPT = ${BUILD}/cgpt/cgpt
296
297CGPT_SRCS = \
298 cgpt/cgpt.c \
299 cgpt/cgpt_add.c \
300 cgpt/cgpt_boot.c \
301 cgpt/cgpt_common.c \
302 cgpt/cgpt_create.c \
303 cgpt/cgpt_find.c \
304 cgpt/cgpt_legacy.c \
305 cgpt/cgpt_prioritize.c \
306 cgpt/cgpt_repair.c \
307 cgpt/cgpt_show.c \
308 cgpt/cmd_add.c \
309 cgpt/cmd_boot.c \
310 cgpt/cmd_create.c \
311 cgpt/cmd_find.c \
312 cgpt/cmd_legacy.c \
313 cgpt/cmd_prioritize.c \
314 cgpt/cmd_repair.c \
315 cgpt/cmd_show.c
316
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800317CGPT_OBJS = ${CGPT_SRCS:%.c=${BUILD}/%.o}
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800318ALL_OBJS += ${CGPT_OBJS}
319
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800320C_DESTDIR = ${DESTDIR}
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800321
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800322
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800323# Scripts to install directly (not compiled)
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800324UTIL_SCRIPTS = \
325 utility/dev_debug_vboot \
326 utility/dev_make_keypair \
327 utility/enable_dev_usb_boot \
328 utility/vbutil_what_keys
329
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800330# These utilities should be linked statically.
331UTIL_NAMES_STATIC = \
332 crossystem \
333 dump_fmap \
334 gbb_utility
335
336UTIL_NAMES = ${UTIL_NAMES_STATIC} \
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800337 dev_sign_file \
338 dump_kernel_config \
339 dumpRSAPublicKey \
340 load_kernel_test \
341 pad_digest_utility \
342 signature_digest_utility \
343 tpm_init_temp_fix \
344 tpmc \
345 vbutil_ec \
346 vbutil_firmware \
347 vbutil_kernel \
348 vbutil_key \
349 vbutil_keyblock \
350 verify_data
351
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800352ifneq (${IN_CHROOT},)
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800353UTIL_NAMES += mount-encrypted
354endif
355
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800356ifeq (${MINIMAL},)
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800357UTIL_NAMES += \
358 bmpblk_font \
359 bmpblk_utility \
360 eficompress \
361 efidecompress
362endif
363
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800364UTIL_BINS_STATIC := $(addprefix ${BUILD}/utility/,${UTIL_NAMES_STATIC})
365UTIL_BINS = $(addprefix ${BUILD}/utility/,${UTIL_NAMES})
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800366ALL_DEPS += $(addsuffix .d,${UTIL_BINS})
367
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800368U_DESTDIR = ${DESTDIR}
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800369
Bill Richardson826db092013-01-14 12:37:15 -0800370
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800371# The unified firmware utility will eventually replace all the others
372FUTIL_BIN = ${BUILD}/futility/futility
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800373
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800374FUTIL_SRCS = \
375 futility/IGNOREME.c
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800376
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800377FUTIL_LDS = futility/futility.lds
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800378
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800379FUTIL_OBJS = ${FUTIL_SRCS:%.c=${BUILD}/%.o}
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800380
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800381ALL_DEPS += $(addsuffix .d,${FUTIL_BIN})
382ALL_OBJS += ${FUTIL_OBJS}
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800383
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800384F_DESTDIR = ${DESTDIR}
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800385
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800386
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800387# Library of handy test functions.
388TESTLIB = ${BUILD}/tests/test.a
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800389
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800390TESTLIB_SRCS = \
391 tests/test_common.c \
392 tests/timer_utils.c \
393 tests/crc32_test.c
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800394
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800395TESTLIB_OBJS = ${TESTLIB_SRCS:%.c=${BUILD}/%.o}
396ALL_OBJS += ${TESTLIB_OBJS}
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800397
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800398
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800399# And some compiled tests.
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800400TEST_NAMES = \
401 cgptlib_test \
402 rollback_index2_tests \
403 rsa_padding_test \
404 rsa_utility_tests \
405 rsa_verify_benchmark \
406 sha_benchmark \
407 sha_tests \
408 stateful_util_tests \
409 tpm_bootmode_tests \
410 utility_string_tests \
411 utility_tests \
412 vboot_nvstorage_test \
413 vboot_api_init_tests \
414 vboot_api_devmode_tests \
415 vboot_api_firmware_tests \
416 vboot_api_kernel_tests \
417 vboot_audio_tests \
418 vboot_common_tests \
419 vboot_common2_tests \
420 vboot_common3_tests \
421 vboot_ec_tests \
422 vboot_firmware_tests
423
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800424# Grrr
425ifneq (${IN_CHROOT},)
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800426TEST_NAMES += CgptManagerTests
427endif
428
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800429# TODO: port these tests to new API, if not already eqivalent
430# functionality in other tests. These don't even compile at present.
431#
432# big_firmware_tests
433# big_kernel_tests
434# firmware_image_tests
435# firmware_rollback_tests
436# firmware_splicing_tests
437# firmware_verify_benchmark
438# kernel_image_tests
439# kernel_rollback_tests
440# kernel_splicing_tests
441# kernel_verify_benchmark
442# rollback_index_test
443# verify_firmware_fuzz_driver
444# verify_kernel_fuzz_driver
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800445# utility/load_firmware_test
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800446
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800447# And a few more...
448TLCL_TESTS = \
449 tpmtest_earlyextend \
450 tpmtest_earlynvram \
451 tpmtest_earlynvram2 \
452 tpmtest_enable \
453 tpmtest_fastenable \
454 tpmtest_globallock \
455 tpmtest_redefine_unowned \
456 tpmtest_spaceperm \
457 tpmtest_testsetup \
458 tpmtest_timing \
459 tpmtest_writelimit
460TLCL_TEST_NAMES = $(addprefix tpm_lite/,${TLCL_TESTS})
461TLCL_TEST_BINS = $(addprefix ${BUILD}/tests/,${TLCL_TEST_NAMES})
462
463TEST_NAMES += ${TLCL_TEST_NAMES}
464
465TEST_BINS = $(addprefix ${BUILD}/tests/,${TEST_NAMES})
466ALL_DEPS += $(addsuffix .d,${TEST_BINS})
467
468
469# ----------------------------------------------------------------------------
470# TODO: why not make this include *all* the cgpt files, and simply have
471# cgpt link against it?
472# TODO: CgptManager.cc should move to the installer project. Shouldn't be
473# in libcgpt-cc.a.
474AU_CGPTLIB_SRCS = \
475 cgpt/CgptManager.cc \
476 cgpt/cgpt_create.c \
477 cgpt/cgpt_add.c \
478 cgpt/cgpt_boot.c \
479 cgpt/cgpt_show.c \
480 cgpt/cgpt_repair.c \
481 cgpt/cgpt_prioritize.c \
482 cgpt/cgpt_common.c \
483 firmware/lib/cgptlib/crc32.c \
484 firmware/lib/cgptlib/cgptlib_internal.c \
485 firmware/stub/utility_stub.c
486
487AU_CGPTLIB_OBJS = $(filter %.o, \
488 ${AU_CGPTLIB_SRCS:%.c=${BUILD}/%.o} \
489 ${AU_CGPTLIB_SRCS:%.cc=${BUILD}/%.o})
490ALL_OBJS += ${AU_CGPTLIB_OBJS}
491
492
493##############################################################################
494# Finally, some targets. High-level ones first.
495
496# Create output directories if necessary. Do this via explicit shell commands
497# so it happens before trying to generate/include dependencies.
498SUBDIRS := firmware host cgpt utility futility tests tests/tpm_lite
499_dir_create := $(foreach d, \
500 $(shell find ${SUBDIRS} -name '*.c' -exec dirname {} \; | sort -u), \
501 $(shell [ -d ${BUILD}/${d} ] || mkdir -p ${BUILD}/${d}))
502
503
504# Default target.
505.PHONY: all
506all: fwlib $(if ${FIRMWARE_ARCH},,host_stuff)
507
508# Host targets
509.PHONY: host_stuff
510host_stuff: hostlib cgpt utils futil tests
511
512# AU targets
513.PHONY: au_stuff
514au_stuff: libcgpt_cc libdump_kernel_config cgptmanager_tests
515
516.PHONY: clean
517clean:
518 ${Q}/bin/rm -rf ${BUILD}
519
520.PHONY: install
521install: cgpt_install utils_install futil_install
522
523# Coverage
524# TODO: only if COV=1
525# HEY - depend on runtests?
526COV_INFO = ${BUILD}/coverage.info
527.PHONY: coverage
528coverage:
529 rm -f ${COV_INFO}*
530 lcov --capture --directory . --base-directory . -o ${COV_INFO}.1
531 lcov --remove ${COV_INFO}.1 '/usr/*' -o ${COV_INFO}
532 genhtml ${COV_INFO} --output-directory ${BUILD}/coverage
533
534# Don't delete intermediate object files
535.SECONDARY:
536
537# TODO: I suspect this is missing some object files. Make a temp
538# target which cleans all known obj/exe's and see what's left; those
539# are the files which need deps.
540ALL_DEPS += ${ALL_OBJS:%.o=%.o.d}
541-include ${ALL_DEPS}
542
543# ----------------------------------------------------------------------------
544# Firmware library
545
546# TPM-specific flags. These depend on the particular TPM we're targeting for.
547# They are needed here only for compiling parts of the firmware code into
548# user-level tests.
549
550# TPM_BLOCKING_CONTINUESELFTEST is defined if TPM_ContinueSelfTest blocks until
551# the self test has completed.
552
553${FWLIB}: CFLAGS += -DTPM_BLOCKING_CONTINUESELFTEST
554
555# TPM_MANUAL_SELFTEST is defined if the self test must be started manually
556# (with a call to TPM_ContinueSelfTest) instead of starting automatically at
557# power on.
558#
559# We sincerely hope that TPM_BLOCKING_CONTINUESELFTEST and TPM_MANUAL_SELFTEST
560# are not both defined at the same time. (See comment in code.)
561
562# CFLAGS += -DTPM_MANUAL_SELFTEST
563
564ifeq (${FIRMWARE_ARCH},i386)
565# Unrolling loops in cryptolib makes it faster
566${FWLIB}: CFLAGS += -DUNROLL_LOOPS
567
568# Workaround for coreboot on x86, which will power off asynchronously
569# without giving us a chance to react. This is not an example of the Right
570# Way to do things. See chrome-os-partner:7689, and the commit message
571# that made this change.
572${FWLIB}: CFLAGS += -DSAVE_LOCALE_IMMEDIATELY
573
574# On x86 we don't actually read the GBB data into RAM until it is needed.
575# Therefore it makes sense to cache it rather than reading it each time.
576# Enable this feature.
577${FWLIB}: CFLAGS += -DCOPY_BMP_DATA
578endif
579
580ifeq (${FIRMWARE_ARCH},)
581# Disable rollback TPM when compiling locally, since otherwise
582# load_kernel_test attempts to talk to the TPM.
583${FWLIB}: CFLAGS += -DDISABLE_ROLLBACK_TPM
584endif
585
586.PHONY: fwlib
587fwlib: ${FWLIB} $(if ${FIRMWARE_ARCH},,${BUILD}/firmware/linktest/main)
588
589${FWLIB}: ${FWLIB_OBJS}
590 @printf " RM $(subst ${BUILD}/,,$@)\n"
591 ${Q}rm -f $@
592 @printf " AR $(subst ${BUILD}/,,$@)\n"
593 ${Q}ar qc $@ $^
594
595# ----------------------------------------------------------------------------
596# Host library
597
598.PHONY: hostlib
599hostlib: ${HOSTLIB} ${BUILD}/host/linktest/main
600
601${BUILD}/host/% ${HOSTLIB}: INCLUDES += \
602 -Ihost/include\
603 -Ihost/arch/${ARCH}/include
604
605# TODO: better way to make .a than duplicating this recipe each time?
606${HOSTLIB}: ${HOSTLIB_OBJS} ${FWLIB_OBJS}
607 @printf " RM $(subst ${BUILD}/,,$@)\n"
608 ${Q}rm -f $@
609 @printf " AR $(subst ${BUILD}/,,$@)\n"
610 ${Q}ar qc $@ $^
611
612# ----------------------------------------------------------------------------
613# CGPT library and utility
614
615.PHONY: cgpt
616cgpt: ${CGPT}
617
618${CGPT}: LDFLAGS += -static
619${CGPT}: LDLIBS += -luuid
620
621${CGPT}: ${CGPT_OBJS} ${LIBS}
622 @printf " LDcgpt $(subst ${BUILD}/,,$@)\n"
623 ${Q}${LD} -o ${CGPT} ${CFLAGS} $^ ${LDFLAGS} ${LDLIBS}
624
625.PHONY: cgpt_install
626cgpt_install: ${CGPT}
627 @printf " INSTALL CGPT\n"
628 ${Q}mkdir -p ${C_DESTDIR}
629 ${Q}${INSTALL} -t ${C_DESTDIR} $^
630
631# ----------------------------------------------------------------------------
632# Utilities
633
634# These have their own headers too.
635${BUILD}/utility/%: INCLUDES += -Ihost/include -Iutility/include
636
637# Utilities for auto-update toolkits must be statically linked.
638${UTIL_BINS_STATIC}: LDFLAGS += -static
639
640.PHONY: utils
641utils: ${UTIL_BINS} ${UTIL_SCRIPTS}
642# TODO: change ebuild to pull scripts directly out of utility dir
643 ${Q}cp -f ${UTIL_SCRIPTS} ${BUILD}/utility
644 ${Q}chmod a+rx $(patsubst %,${BUILD}/%,${UTIL_SCRIPTS})
645
646.PHONY: utils_install
647utils_install: ${UTIL_BINS} ${UTIL_SCRIPTS}
648 @printf " INSTALL UTILS\n"
649 ${Q}mkdir -p ${U_DESTDIR}
650 ${Q}${INSTALL} -t ${U_DESTDIR} $^
651
652# ----------------------------------------------------------------------------
653# new Firmware Utility
654
655.PHONY: futil
656futil: ${FUTIL_BIN}
657
658${FUTIL_BIN}: ${FUTIL_LDS} ${FUTIL_OBJS}
659 @printf " LD $(subst ${BUILD}/,,$@)\n"
660 ${Q}${LD} -o $@ ${CFLAGS} $^ ${LDFLAGS} ${LDLIBS}
661
662.PHONY: futil_install
663futil_install: ${FUTIL_BIN}
664 @printf " INSTALL futility\n"
665 ${Q}mkdir -p ${F_DESTDIR}
666 ${Q}${INSTALL} -t ${F_DESTDIR} $^
667
668
669# ----------------------------------------------------------------------------
670# Mount-encrypted utility for cryptohome
671
672# TODO: mount-encrypted should move to cryptohome and just link against
673# vboot-host.a for tlcl and crossystem.
674
675# The embedded libcrypto conflicts with the shipped openssl,
676# so mount-* builds without the common CFLAGS (and those includes).
677
678${BUILD}/utility/mount-helpers.o: \
679 utility/mount-helpers.c \
680 utility/mount-helpers.h \
681 utility/mount-encrypted.h
682 @printf " CCm-e $(subst ${BUILD}/,,$@)\n"
683 ${Q}${CC} -Wall -Werror -O2 -D_FORTIFY_SOURCE=2 -fstack-protector \
684 ${COV_FLAGS} \
685 $(shell ${PKG_CONFIG} --cflags glib-2.0 openssl) \
686 -c $< -o $@
687
688${BUILD}/utility/mount-encrypted: \
689 utility/mount-encrypted.c \
690 utility/mount-encrypted.h \
691 ${BUILD}/utility/mount-helpers.o ${LIBS}
692 @printf " CCm-exe $(subst ${BUILD}/,,$@)\n"
693 ${Q}${CC} -Wall -Werror -O2 -D_FORTIFY_SOURCE=2 -fstack-protector \
694 $(shell ${PKG_CONFIG} --cflags glib-2.0 openssl) \
695 -Ifirmware/include \
696 -Ihost/include \
697 ${COV_FLAGS} \
698 ${LDFLAGS} \
699 $< -o $@ \
700 ${BUILD}/utility/mount-helpers.o ${LIBS} \
701 $(shell ${PKG_CONFIG} --libs glib-2.0 openssl) \
702 -lm
703ifneq (${COV},)
704 ${Q}mv -f mount-encrypted.gcno ${BUILD}/utility
705endif
706
707# ----------------------------------------------------------------------------
708# Utility to generate TLCL structure definition header file.
709
710${BUILD}/utility/tlcl_generator: CFLAGS += -fpack-struct
711
712STRUCTURES_TMP=${BUILD}/tlcl_structures.tmp
713STRUCTURES_SRC=firmware/lib/tpm_lite/include/tlcl_structures.h
714
715.PHONY: update_tlcl_structures
716update_tlcl_structures: ${BUILD}/utility/tlcl_generator
717 @printf " Rebuilding TLCL structures\n"
718 ${Q}${BUILD}/utility/tlcl_generator > ${STRUCTURES_TMP}
719 ${Q}cmp -s ${STRUCTURES_TMP} ${STRUCTURES_SRC} || \
720 ( echo "%% Updating structures.h %%" && \
721 cp ${STRUCTURES_TMP} ${STRUCTURES_SRC} )
722
723# ----------------------------------------------------------------------------
724# Library to dump kernel config
725# Used by platform/installer, as well as standalone utility.
726
727.PHONY: libdump_kernel_config
728libdump_kernel_config: ${DUMPKERNELCONFIGLIB}
729
730${DUMPKERNELCONFIGLIB}: ${BUILD}/utility/dump_kernel_config_lib.o
731 @printf " RM $(subst ${BUILD}/,,$@)\n"
732 ${Q}rm -f $@
733 @printf " AR $(subst ${BUILD}/,,$@)\n"
734 ${Q}ar qc $@ $^
735
736# ----------------------------------------------------------------------------
737# And this thing.
738
739.PHONY: libcgpt_cc
740libcgpt_cc: ${AU_CGPTLIB}
741
742${AU_CGPTLIB}: INCLUDES += -Ifirmware/lib/cgptlib/include
743${AU_CGPTLIB}: ${AU_CGPTLIB_OBJS}
744 @printf " RM $(subst ${BUILD}/,,$@)\n"
745 ${Q}rm -f $@
746 @printf " AR $(subst ${BUILD}/,,$@)\n"
747 ${Q}ar qc $@ $^
748
749# ----------------------------------------------------------------------------
750# Tests
751
752.PHONY: tests
753tests: ${TEST_BINS}
754
755${TEST_BINS}: ${TESTLIB}
756
757${TESTLIB}: ${TESTLIB_OBJS}
758 @printf " RM $(subst ${BUILD}/,,$@)\n"
759 ${Q}rm -f $@
760 @printf " AR $(subst ${BUILD}/,,$@)\n"
761 ${Q}ar qc $@ $^
762
763
764# ----------------------------------------------------------------------------
765# Generic build rules. LIBS and OBJS can be overridden to tweak the generic
766# rules for specific targets.
767
768${BUILD}/%: ${BUILD}/%.o ${OBJS} ${LIBS}
769 @printf " LD $(subst ${BUILD}/,,$@)\n"
770 ${Q}${LD} -o $@ ${CFLAGS} $< ${OBJS} ${LIBS} ${LDFLAGS} ${LDLIBS}
771
772${BUILD}/%.o: %.c
773 @printf " CC $(subst ${BUILD}/,,$@)\n"
774 ${Q}${CC} ${CFLAGS} ${INCLUDES} -c -o $@ $<
775
776# Rules to recompile a single source file for library and test
777# TODO: is there a tidier way to do this?
778${BUILD}/%_for_lib.o: CFLAGS += -DFOR_LIBRARY
779${BUILD}/%_for_lib.o: %.c
780 @printf " CC-for-lib $(subst ${BUILD}/,,$@)\n"
781 ${Q}${CC} ${CFLAGS} ${INCLUDES} -c -o $@ $<
782
783${BUILD}/%_for_test.o: CFLAGS += -DFOR_TEST
784${BUILD}/%_for_test.o: %.c
785 @printf " CC-for-test $(subst ${BUILD}/,,$@)\n"
786 ${Q}${CC} ${CFLAGS} ${INCLUDES} -c -o $@ $<
787
788# TODO: C++ files don't belong in vboot reference at all. Convert to C.
789${BUILD}/%.o: %.cc
790 @printf " CXX $(subst ${BUILD}/,,$@)\n"
791 ${Q}${CXX} ${CFLAGS} ${INCLUDES} -c -o $@ $<
792
793# ----------------------------------------------------------------------------
794# Here are the special tweaks to the generic rules.
795
796# Linktest ensures firmware lib doesn't rely on outside libraries
797${BUILD}/firmware/linktest/main: LIBS = ${FWLIB}
798
799# Specific dependency here.
800${BUILD}/utility/dump_kernel_config: LIBS += ${DUMPKERNELCONFIGLIB}
801${BUILD}/utility/dump_kernel_config: ${DUMPKERNELCONFIGLIB}
802
803# GBB utility needs C++ linker. TODO: It shouldn't.
804${BUILD}/utility/gbb_utility: LD = ${CXX}
805
806# Some utilities need external crypto functions
807${BUILD}/utility/dumpRSAPublicKey: LDLIBS += ${CRYPTO_LIBS}
808${BUILD}/utility/pad_digest_utility: LDLIBS += ${CRYPTO_LIBS}
809${BUILD}/utility/signature_digest_utility: LDLIBS += ${CRYPTO_LIBS}
810${BUILD}/utility/dev_sign_file: LDLIBS += ${CRYPTO_LIBS}
811${BUILD}/utility/vbutil_ec: LDLIBS += ${CRYPTO_LIBS}
812${BUILD}/utility/vbutil_firmware: LDLIBS += ${CRYPTO_LIBS}
813${BUILD}/utility/vbutil_kernel: LDLIBS += ${CRYPTO_LIBS}
814${BUILD}/utility/vbutil_key: LDLIBS += ${CRYPTO_LIBS}
815${BUILD}/utility/vbutil_keyblock: LDLIBS += ${CRYPTO_LIBS}
816
817${BUILD}/host/linktest/main: LDLIBS += ${CRYPTO_LIBS}
818${BUILD}/tests/vboot_common2_tests: LDLIBS += ${CRYPTO_LIBS}
819${BUILD}/tests/vboot_common3_tests: LDLIBS += ${CRYPTO_LIBS}
820${BUILD}/tests/vboot_ec_tests: LDLIBS += ${CRYPTO_LIBS}
821
822
823${BUILD}/utility/bmpblk_utility: LD = ${CXX}
824${BUILD}/utility/bmpblk_utility: LDLIBS = -llzma -lyaml
825
826BMPBLK_UTILITY_DEPS = \
827 ${BUILD}/utility/bmpblk_util.o \
828 ${BUILD}/utility/image_types.o \
829 ${BUILD}/utility/eficompress_for_lib.o \
830 ${BUILD}/utility/efidecompress_for_lib.o
831${BUILD}/utility/bmpblk_utility: OBJS = ${BMPBLK_UTILITY_DEPS}
832${BUILD}/utility/bmpblk_utility: ${BMPBLK_UTILITY_DEPS}
833
834${BUILD}/utility/bmpblk_font: OBJS += ${BUILD}/utility/image_types.o
835${BUILD}/utility/bmpblk_font: ${BUILD}/utility/image_types.o
836
837# Allow multiple definitions, so tests can mock functions from other libraries
838${BUILD}/tests/%: CFLAGS += -Xlinker --allow-multiple-definition
839${BUILD}/tests/%: INCLUDES += -Ihost/include
840${BUILD}/tests/%: LDLIBS += -lrt -luuid
841${BUILD}/tests/%: LIBS += ${TESTLIB}
842
843${BUILD}/tests/rollback_index2_tests: OBJS += \
844 ${BUILD}/firmware/lib/rollback_index_for_test.o
845${BUILD}/tests/rollback_index2_tests: \
846 ${BUILD}/firmware/lib/rollback_index_for_test.o
847
848${BUILD}/tests/vboot_audio_tests: OBJS += \
849 ${BUILD}/firmware/lib/vboot_audio_for_test.o
850${BUILD}/tests/vboot_audio_tests: \
851 ${BUILD}/firmware/lib/vboot_audio_for_test.o
852
853.PHONY: cgptmanager_tests
854cgptmanager_tests: ${BUILD}/tests/CgptManagerTests
855
856${BUILD}/tests/CgptManagerTests: CFLAGS += ${PC_CFLAGS}
857${BUILD}/tests/CgptManagerTests: LD = ${CXX}
858${BUILD}/tests/CgptManagerTests: LDLIBS += -lgtest -lgflags ${PC_LDLIBS}
859${BUILD}/tests/CgptManagerTests: LIBS = ${AU_CGPTLIB}
860${BUILD}/tests/CgptManagerTests: ${AU_CGPTLIB}
861
862${BUILD}/tests/rollback_index_test: INCLUDES += -I/usr/include
863${BUILD}/tests/rollback_index_test: LIBS += -ltlcl
864
865${TLCL_TEST_BINS}: OBJS += ${BUILD}/tests/tpm_lite/tlcl_tests.o
866${TLCL_TEST_BINS}: ${BUILD}/tests/tpm_lite/tlcl_tests.o
867
868##############################################################################
869# Targets that exist just to run tests
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800870
871# Frequently-run tests
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800872.PHONY: test_targets
873test_targets:: runcgpttests runmisctests
Randall Spangler844bce52013-01-15 16:16:43 -0800874
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800875ifeq (${MINIMAL},)
Randall Spangler844bce52013-01-15 16:16:43 -0800876# Bitmap utility isn't compiled for minimal variant
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800877test_targets:: runbmptests
Randall Spangler844bce52013-01-15 16:16:43 -0800878# Scripts don't work under qemu testing
879# TODO: convert scripts to makefile so they can be called directly
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800880test_targets:: runtestscripts
Randall Spangler844bce52013-01-15 16:16:43 -0800881endif
882
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800883.PHONY: test_setup
884test_setup:: cgpt utils futil tests
885
Randall Spangler844bce52013-01-15 16:16:43 -0800886# Qemu setup for cross-compiled tests. Need to copy qemu binary into the
887# sysroot.
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800888ifneq (${QEMU_ARCH},)
889test_setup:: qemu_install
Randall Spangler844bce52013-01-15 16:16:43 -0800890
891.PHONY: qemu_install
892qemu_install:
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800893ifeq (${SYSROOT},)
894 $(error SYSROOT must be set to the top of the target-specific root \
895when cross-compiling for qemu-based tests to run properly.)
896endif
Randall Spangler844bce52013-01-15 16:16:43 -0800897 @printf " Copying qemu binary.\n"
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800898 ${Q}cp -fu /usr/bin/${QEMU_BIN} ${BUILD}/${QEMU_BIN}
899 ${Q}chmod a+rx ${BUILD}/${QEMU_BIN}
Randall Spangler844bce52013-01-15 16:16:43 -0800900endif
901
Bill Richardsonacb2ee92013-01-11 22:53:00 -0800902.PHONY: runtests
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800903runtests: test_targets
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800904
905# Generate test keys
Bill Richardsonacb2ee92013-01-11 22:53:00 -0800906.PHONY: genkeys
Randall Spangler844bce52013-01-15 16:16:43 -0800907genkeys: utils
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800908 tests/gen_test_keys.sh
909
910# Generate test cases for fuzzing
Bill Richardsonacb2ee92013-01-11 22:53:00 -0800911.PHONY: genfuzztestcases
Randall Spanglera808dc92013-01-14 12:59:05 -0800912genfuzztestcases: utils
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800913 tests/gen_fuzz_test_cases.sh
914
Bill Richardsonacb2ee92013-01-11 22:53:00 -0800915.PHONY: runbmptests
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800916runbmptests: test_setup
917 cd tests/bitmaps && BMPBLK=${BUILD_RUN}/utility/bmpblk_utility \
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800918 ./TestBmpBlock.py -v
919
Bill Richardsonacb2ee92013-01-11 22:53:00 -0800920.PHONY: runcgpttests
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800921runcgpttests: test_setup
922 ${RUNTEST} ${BUILD_RUN}/tests/cgptlib_test
923# HEY - elsewhere
924ifneq (${IN_CHROOT},)
925 ${RUNTEST} ${BUILD_RUN}/tests/CgptManagerTests --v=1
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800926endif
927
Randall Spangler844bce52013-01-15 16:16:43 -0800928.PHONY: runtestscripts
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800929runtestscripts: test_setup genfuzztestcases
930 tests/run_cgpt_tests.sh ${BUILD_RUN}/cgpt/cgpt
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800931 tests/run_preamble_tests.sh
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800932 tests/run_rsa_tests.sh
933 tests/run_vboot_common_tests.sh
Randall Spangler844bce52013-01-15 16:16:43 -0800934 tests/run_vbutil_kernel_arg_tests.sh
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800935 tests/run_vbutil_tests.sh
936
Randall Spangler844bce52013-01-15 16:16:43 -0800937.PHONY: runmisctests
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800938runmisctests: test_setup
939 ${RUNTEST} ${BUILD_RUN}/tests/rollback_index2_tests
940 ${RUNTEST} ${BUILD_RUN}/tests/rsa_utility_tests
941 ${RUNTEST} ${BUILD_RUN}/tests/sha_tests
942 ${RUNTEST} ${BUILD_RUN}/tests/stateful_util_tests
943 ${RUNTEST} ${BUILD_RUN}/tests/tpm_bootmode_tests
944 ${RUNTEST} ${BUILD_RUN}/tests/utility_string_tests
945 ${RUNTEST} ${BUILD_RUN}/tests/utility_tests
946 ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_devmode_tests
947 ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_init_tests
948 ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_firmware_tests
949 ${RUNTEST} ${BUILD_RUN}/tests/vboot_audio_tests
950 ${RUNTEST} ${BUILD_RUN}/tests/vboot_firmware_tests
951
952.PHONY: runfutiltests
953runfutiltests: DESTDIR := ${TEST_INSTALL_DIR}
954runfutiltests: test_setup install
955 @echo "$@ passed"
Randall Spangler844bce52013-01-15 16:16:43 -0800956
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800957# Run long tests, including all permutations of encryption keys (instead of
958# just the ones we use) and tests of currently-unused code (e.g. vboot_ec).
959# Not run by automated build.
Bill Richardsonacb2ee92013-01-11 22:53:00 -0800960.PHONY: runlongtests
Bill Richardsoneecc18f2013-01-17 15:28:17 -0800961runlongtests: test_setup genkeys genfuzztestcases
Randall Spangler5d9bbf22013-01-08 10:44:23 -0800962 tests/run_preamble_tests.sh --all
963 tests/run_vboot_common_tests.sh --all
964 tests/run_vboot_ec_tests.sh
965 tests/run_vbutil_tests.sh --all
966
967# TODO: tests to run when ported to new API
968# ./run_image_verification_tests.sh
969# # Splicing tests
970# ${BUILD}/tests/firmware_splicing_tests
971# ${BUILD}/tests/kernel_splicing_tests
972# # Rollback Tests
973# ${BUILD}/tests/firmware_rollback_tests
974# ${BUILD}/tests/kernel_rollback_tests
975