Randall Spangler | e8cfa31 | 2013-01-02 16:49:38 -0800 | [diff] [blame] | 1 | # Copyright (c) 2013 The Chromium OS Authors. All rights reserved. |
Gaurav Shah | 322536d | 2010-01-28 15:01:23 -0800 | [diff] [blame] | 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
Simon Glass | 6d696e5 | 2011-11-14 13:46:33 -0800 | [diff] [blame] | 5 | # This Makefile normally builds in a 'build' subdir, but use |
| 6 | # |
| 7 | # make BUILD=<dir> |
| 8 | # |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 9 | # 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 | |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 38 | # We should only run pwd once, not every time we refer to ${BUILD}. |
Randall Spangler | e061a25 | 2013-01-22 15:34:07 -0800 | [diff] [blame] | 39 | SRCDIR := $(shell pwd) |
Bill Richardson | feb2518 | 2013-03-07 12:54:29 -0800 | [diff] [blame] | 40 | BUILD = $(SRCDIR)/build |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 41 | export BUILD |
Simon Glass | 6d696e5 | 2011-11-14 13:46:33 -0800 | [diff] [blame] | 42 | |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 43 | # Stuff for 'make install' |
Bill Richardson | feb2518 | 2013-03-07 12:54:29 -0800 | [diff] [blame] | 44 | INSTALL = install |
| 45 | DESTDIR = /usr/local/bin |
| 46 | OLDDIR = old_bins |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 47 | |
Bill Richardson | feb2518 | 2013-03-07 12:54:29 -0800 | [diff] [blame] | 48 | # Where exactly do the pieces go? |
| 49 | # FT_DIR = futility target directory - where it will be on the target |
| 50 | # F_DIR = futility install directory - where it gets put right now |
| 51 | # UB_DIR = userspace binary directory for futility's exec() targets |
| 52 | # VB_DIR = target vboot directory - for dev-mode-only helpers, keys, etc. |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 53 | ifeq (${MINIMAL},) |
| 54 | # Host install just puts everything in one place |
Bill Richardson | feb2518 | 2013-03-07 12:54:29 -0800 | [diff] [blame] | 55 | FT_DIR=${DESTDIR} |
| 56 | F_DIR=${DESTDIR} |
| 57 | UB_DIR=${DESTDIR}/${OLDDIR} |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 58 | else |
| 59 | # Target install puts things into DESTDIR subdirectories |
Bill Richardson | feb2518 | 2013-03-07 12:54:29 -0800 | [diff] [blame] | 60 | FT_DIR=/usr/bin |
| 61 | F_DIR=${DESTDIR}${FT_DIR} |
| 62 | UB_DIR=${F_DIR}/${OLDDIR} |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 63 | VB_DIR=${DESTDIR}/usr/share/vboot/bin |
| 64 | endif |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 65 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 66 | # Where to install the (exportable) executables for testing? |
| 67 | TEST_INSTALL_DIR = ${BUILD}/install_for_test |
| 68 | |
| 69 | # Verbose? Use V=1 |
| 70 | ifeq (${V},) |
| 71 | Q := @ |
| 72 | endif |
| 73 | |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 74 | # Quiet? Use QUIET=1 |
| 75 | ifeq ($(QUIET),) |
| 76 | PRINTF := printf |
| 77 | else |
| 78 | PRINTF := : |
| 79 | endif |
| 80 | |
Randall Spangler | 61a2eb3 | 2013-01-23 10:20:16 -0800 | [diff] [blame] | 81 | # Architecture detection |
| 82 | _machname := $(shell uname -m) |
| 83 | HOST_ARCH ?= ${_machname} |
| 84 | |
| 85 | # ARCH and/or FIRMWARE_ARCH are defined by the Chromium OS ebuild. |
| 86 | # Pick a sane target architecture if none is defined. |
| 87 | ifeq (${ARCH},) |
| 88 | ARCH := ${HOST_ARCH} |
| 89 | else ifeq (${ARCH},i386) |
| 90 | override ARCH := x86 |
| 91 | else ifeq (${ARCH},amd64) |
| 92 | override ARCH := x86_64 |
| 93 | endif |
| 94 | |
| 95 | # FIRMWARE_ARCH is only defined by the Chromium OS ebuild if compiling |
| 96 | # for a firmware target (such as u-boot or depthcharge). It must map |
| 97 | # to the same consistent set of architectures as the host. |
| 98 | ifeq (${FIRMWARE_ARCH},i386) |
| 99 | override FIRMWARE_ARCH := x86 |
| 100 | else ifeq (${FIRMWARE_ARCH},amd64) |
| 101 | override FIRMWARE_ARCH := x86_64 |
| 102 | endif |
| 103 | |
Simon Glass | b265c34 | 2011-11-16 15:09:51 -0800 | [diff] [blame] | 104 | # Provide default CC and CFLAGS for firmware builds; if you have any -D flags, |
| 105 | # please add them after this point (e.g., -DVBOOT_DEBUG). |
Che-Liang Chiou | 74359b7 | 2011-06-21 15:25:51 -0700 | [diff] [blame] | 106 | # |
Che-Liang Chiou | 6b0003c | 2011-10-14 11:11:28 +0800 | [diff] [blame] | 107 | # TODO(crosbug.com/16808) We hard-code u-boot's compiler flags here just |
| 108 | # temporarily. As we are still investigating which flags are necessary for |
| 109 | # maintaining a compatible ABI, etc. between u-boot and vboot_reference. |
Che-Liang Chiou | 74359b7 | 2011-06-21 15:25:51 -0700 | [diff] [blame] | 110 | # |
Simon Glass | b265c34 | 2011-11-16 15:09:51 -0800 | [diff] [blame] | 111 | # As a first step, this makes the setting of CC and CFLAGS here optional, to |
| 112 | # permit a calling script or Makefile to set these. |
Che-Liang Chiou | 74359b7 | 2011-06-21 15:25:51 -0700 | [diff] [blame] | 113 | # |
Simon Glass | b265c34 | 2011-11-16 15:09:51 -0800 | [diff] [blame] | 114 | # Flag ordering: arch, then -f, then -m, then -W |
| 115 | DEBUG_FLAGS := $(if ${DEBUG},-g -O0,-Os) |
| 116 | COMMON_FLAGS := -nostdinc -pipe \ |
| 117 | -ffreestanding -fno-builtin -fno-stack-protector \ |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 118 | -Werror -Wall -Wstrict-prototypes ${DEBUG_FLAGS} |
Simon Glass | b265c34 | 2011-11-16 15:09:51 -0800 | [diff] [blame] | 119 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 120 | # Note: FIRMWARE_ARCH is defined by the Chromium OS ebuild. |
| 121 | ifeq (${FIRMWARE_ARCH}, arm) |
Simon Glass | b265c34 | 2011-11-16 15:09:51 -0800 | [diff] [blame] | 122 | CC ?= armv7a-cros-linux-gnueabi-gcc |
| 123 | CFLAGS ?= -march=armv5 \ |
| 124 | -fno-common -ffixed-r8 \ |
Doug Anderson | d50b27d | 2012-05-11 12:08:02 -0700 | [diff] [blame] | 125 | -mfloat-abi=hard -marm -mabi=aapcs-linux -mno-thumb-interwork \ |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 126 | ${COMMON_FLAGS} |
Randall Spangler | 61a2eb3 | 2013-01-23 10:20:16 -0800 | [diff] [blame] | 127 | else ifeq (${FIRMWARE_ARCH}, x86) |
Simon Glass | b265c34 | 2011-11-16 15:09:51 -0800 | [diff] [blame] | 128 | CC ?= i686-pc-linux-gnu-gcc |
| 129 | # Drop -march=i386 to permit use of SSE instructions |
| 130 | CFLAGS ?= \ |
| 131 | -ffunction-sections -fvisibility=hidden -fno-strict-aliasing \ |
| 132 | -fomit-frame-pointer -fno-toplevel-reorder -fno-dwarf2-cfi-asm \ |
| 133 | -mpreferred-stack-boundary=2 -mregparm=3 \ |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 134 | ${COMMON_FLAGS} |
| 135 | else ifeq (${FIRMWARE_ARCH}, x86_64) |
| 136 | CFLAGS ?= ${COMMON_FLAGS} \ |
Simon Glass | 8e85e98 | 2011-11-22 13:54:50 -0800 | [diff] [blame] | 137 | -fvisibility=hidden -fno-strict-aliasing -fomit-frame-pointer |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 138 | else |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 139 | # FIRMWARE_ARCH not defined; assuming local compile. |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 140 | CC ?= gcc |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 141 | CFLAGS += -DCHROMEOS_ENVIRONMENT -Wall -Werror # HEY: always want last two? |
Che-Liang Chiou | 34be827 | 2011-01-27 16:44:36 +0800 | [diff] [blame] | 142 | endif |
| 143 | |
Bill Richardson | feb2518 | 2013-03-07 12:54:29 -0800 | [diff] [blame] | 144 | ifneq (${OLDDIR},) |
| 145 | CFLAGS += -DOLDDIR=${OLDDIR} |
| 146 | endif |
| 147 | |
Che-Liang Chiou | 34be827 | 2011-01-27 16:44:36 +0800 | [diff] [blame] | 148 | ifneq (${DEBUG},) |
| 149 | CFLAGS += -DVBOOT_DEBUG |
vbendeb | b2b0fcc | 2010-07-15 15:09:47 -0700 | [diff] [blame] | 150 | endif |
Che-Liang Chiou | 0a0e8d0 | 2010-11-30 09:30:45 +0800 | [diff] [blame] | 151 | |
vbendeb | b2b0fcc | 2010-07-15 15:09:47 -0700 | [diff] [blame] | 152 | ifeq (${DISABLE_NDEBUG},) |
| 153 | CFLAGS += -DNDEBUG |
| 154 | endif |
| 155 | |
Bill Richardson | feb2518 | 2013-03-07 12:54:29 -0800 | [diff] [blame] | 156 | ifneq (${FORCE_LOGGING_ON},) |
| 157 | CFLAGS += -DFORCE_LOGGING_ON=${FORCE_LOGGING_ON} |
| 158 | endif |
| 159 | |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 160 | # Create / use dependency files |
| 161 | CFLAGS += -MMD -MF $@.d |
Simon Glass | b265c34 | 2011-11-16 15:09:51 -0800 | [diff] [blame] | 162 | |
Bill Richardson | 0c3ba24 | 2013-03-29 11:09:30 -0700 | [diff] [blame] | 163 | # These are required to access large disks and files on 32-bit systems. |
| 164 | CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 |
| 165 | |
Randall Spangler | 59d7508 | 2013-01-23 09:29:54 -0800 | [diff] [blame] | 166 | # Code coverage |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 167 | ifneq (${COV},) |
Randall Spangler | 59d7508 | 2013-01-23 09:29:54 -0800 | [diff] [blame] | 168 | COV_FLAGS = -O0 --coverage |
| 169 | CFLAGS += ${COV_FLAGS} |
| 170 | LDFLAGS += ${COV_FLAGS} |
| 171 | COV_INFO = ${BUILD}/coverage.info |
Che-Liang Chiou | 0a0e8d0 | 2010-11-30 09:30:45 +0800 | [diff] [blame] | 172 | endif |
Gaurav Shah | 322536d | 2010-01-28 15:01:23 -0800 | [diff] [blame] | 173 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 174 | # And a few more default utilities |
| 175 | LD = ${CC} |
| 176 | CXX ?= g++ # HEY: really? |
| 177 | PKG_CONFIG ?= pkg-config |
| 178 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 179 | # Determine QEMU architecture needed, if any |
| 180 | ifeq (${ARCH},${HOST_ARCH}) |
| 181 | # Same architecture; no need for QEMU |
| 182 | QEMU_ARCH := |
Randall Spangler | 61a2eb3 | 2013-01-23 10:20:16 -0800 | [diff] [blame] | 183 | else ifeq (${HOST_ARCH}-${ARCH},x86_64-x86) |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 184 | # 64-bit host can run 32-bit targets directly |
| 185 | QEMU_ARCH := |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 186 | else |
| 187 | QEMU_ARCH := ${ARCH} |
| 188 | endif |
| 189 | |
| 190 | # The top of the chroot for qemu must be passed in via the SYSROOT environment |
| 191 | # variable. In the Chromium OS chroot, this is done automatically by the |
| 192 | # ebuild. |
| 193 | |
| 194 | ifeq (${QEMU_ARCH},) |
| 195 | # Path to build output for running tests is same as for building |
| 196 | BUILD_RUN = ${BUILD} |
Randall Spangler | e061a25 | 2013-01-22 15:34:07 -0800 | [diff] [blame] | 197 | SRC_RUN = ${SRCDIR} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 198 | else |
| 199 | $(info Using qemu for testing.) |
| 200 | # Path to build output for running tests is different in the chroot |
| 201 | BUILD_RUN = $(subst ${SYSROOT},,${BUILD}) |
Randall Spangler | e061a25 | 2013-01-22 15:34:07 -0800 | [diff] [blame] | 202 | SRC_RUN = $(subst ${SYSROOT},,${SRCDIR}) |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 203 | |
| 204 | QEMU_BIN = qemu-${QEMU_ARCH} |
Randall Spangler | e061a25 | 2013-01-22 15:34:07 -0800 | [diff] [blame] | 205 | QEMU_RUN = ${BUILD_RUN}/${QEMU_BIN} |
| 206 | export QEMU_RUN |
| 207 | |
| 208 | RUNTEST = tests/test_using_qemu.sh |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 209 | endif |
| 210 | |
Randall Spangler | e061a25 | 2013-01-22 15:34:07 -0800 | [diff] [blame] | 211 | export BUILD_RUN |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 212 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 213 | ############################################################################## |
| 214 | # Now we need to describe everything we might want or need to build |
| 215 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 216 | # Everything wants these headers. |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 217 | INCLUDES += \ |
| 218 | -Ifirmware/include \ |
| 219 | -Ifirmware/lib/include \ |
| 220 | -Ifirmware/lib/cgptlib/include \ |
| 221 | -Ifirmware/lib/cryptolib/include \ |
| 222 | -Ifirmware/lib/tpm_lite/include |
Bill Richardson | 0b8f35c | 2010-05-26 09:18:38 -0700 | [diff] [blame] | 223 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 224 | # If we're not building for a specific target, just stub out things like the |
| 225 | # TPM commands and various external functions that are provided by the BIOS. |
| 226 | ifeq (${FIRMWARE_ARCH},) |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 227 | INCLUDES += -Ifirmware/stub/include |
Che-Liang Chiou | 0a0e8d0 | 2010-11-30 09:30:45 +0800 | [diff] [blame] | 228 | else |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 229 | INCLUDES += -Ifirmware/arch/${FIRMWARE_ARCH}/include |
Che-Liang Chiou | 0a0e8d0 | 2010-11-30 09:30:45 +0800 | [diff] [blame] | 230 | endif |
Gaurav Shah | 322536d | 2010-01-28 15:01:23 -0800 | [diff] [blame] | 231 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 232 | # Firmware library. TODO: Do we still need to export this? |
| 233 | FWLIB = ${BUILD}/vboot_fw.a |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 234 | |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 235 | # Firmware library sources needed by VbInit() call |
| 236 | VBINIT_SRCS = \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 237 | firmware/lib/crc8.c \ |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 238 | firmware/lib/utility.c \ |
| 239 | firmware/lib/vboot_api_init.c \ |
| 240 | firmware/lib/vboot_common_init.c \ |
| 241 | firmware/lib/vboot_nvstorage.c \ |
Simon Glass | 527ba81 | 2013-07-25 08:48:47 -0600 | [diff] [blame^] | 242 | firmware/lib/region-init.c \ |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 243 | |
| 244 | # Additional firmware library sources needed by VbSelectFirmware() call |
| 245 | VBSF_SRCS = \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 246 | firmware/lib/cryptolib/padding.c \ |
| 247 | firmware/lib/cryptolib/rsa.c \ |
| 248 | firmware/lib/cryptolib/rsa_utility.c \ |
| 249 | firmware/lib/cryptolib/sha1.c \ |
| 250 | firmware/lib/cryptolib/sha256.c \ |
| 251 | firmware/lib/cryptolib/sha512.c \ |
| 252 | firmware/lib/cryptolib/sha_utility.c \ |
| 253 | firmware/lib/stateful_util.c \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 254 | firmware/lib/vboot_api_firmware.c \ |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 255 | firmware/lib/vboot_common.c \ |
Simon Glass | 527ba81 | 2013-07-25 08:48:47 -0600 | [diff] [blame^] | 256 | firmware/lib/vboot_firmware.c \ |
| 257 | firmware/lib/region-fw.c \ |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 258 | |
| 259 | # Additional firmware library sources needed by VbSelectAndLoadKernel() call |
| 260 | VBSLK_SRCS = \ |
| 261 | firmware/lib/cgptlib/cgptlib.c \ |
| 262 | firmware/lib/cgptlib/cgptlib_internal.c \ |
| 263 | firmware/lib/cgptlib/crc32.c \ |
Albert Chaulk | 5c9e453 | 2013-03-20 16:03:49 -0700 | [diff] [blame] | 264 | firmware/lib/cgptlib/mtdlib.c \ |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 265 | firmware/lib/utility_string.c \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 266 | firmware/lib/vboot_api_kernel.c \ |
| 267 | firmware/lib/vboot_audio.c \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 268 | firmware/lib/vboot_display.c \ |
Simon Glass | 527ba81 | 2013-07-25 08:48:47 -0600 | [diff] [blame^] | 269 | firmware/lib/vboot_kernel.c \ |
| 270 | firmware/lib/region-kernel.c \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 271 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 272 | # Support real TPM unless BIOS sets MOCK_TPM |
| 273 | ifeq (${MOCK_TPM},) |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 274 | VBINIT_SRCS += \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 275 | firmware/lib/rollback_index.c \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 276 | firmware/lib/tpm_lite/tlcl.c |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 277 | |
| 278 | VBSF_SRCS += \ |
| 279 | firmware/lib/tpm_bootmode.c |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 280 | else |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 281 | VBINIT_SRCS += \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 282 | firmware/lib/mocked_rollback_index.c \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 283 | firmware/lib/tpm_lite/mocked_tlcl.c |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 284 | |
| 285 | VBSF_SRCS += \ |
| 286 | firmware/lib/mocked_tpm_bootmode.c |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 287 | endif |
| 288 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 289 | ifeq (${FIRMWARE_ARCH},) |
| 290 | # Include BIOS stubs in the firmware library when compiling for host |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 291 | # TODO: split out other stub funcs too |
| 292 | VBINIT_SRCS += \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 293 | firmware/stub/tpm_lite_stub.c \ |
| 294 | firmware/stub/utility_stub.c \ |
Simon Glass | 527ba81 | 2013-07-25 08:48:47 -0600 | [diff] [blame^] | 295 | firmware/stub/vboot_api_stub_init.c \ |
| 296 | firmware/stub/vboot_api_stub_region.c |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 297 | |
| 298 | VBSF_SRCS += \ |
| 299 | firmware/stub/vboot_api_stub_sf.c |
| 300 | |
| 301 | VBSLK_SRCS += \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 302 | firmware/stub/vboot_api_stub.c \ |
| 303 | firmware/stub/vboot_api_stub_disk.c |
| 304 | endif |
| 305 | |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 306 | VBSF_SRCS += ${VBINIT_SRCS} |
| 307 | FWLIB_SRCS += ${VBSF_SRCS} ${VBSLK_SRCS} |
| 308 | |
| 309 | VBINIT_OBJS = ${VBINIT_SRCS:%.c=${BUILD}/%.o} |
| 310 | VBSF_OBJS = ${VBSF_SRCS:%.c=${BUILD}/%.o} |
| 311 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 312 | FWLIB_OBJS = ${FWLIB_SRCS:%.c=${BUILD}/%.o} |
Bill Richardson | 1912bba | 2013-04-04 21:08:50 -0700 | [diff] [blame] | 313 | |
| 314 | ALL_OBJS += ${FWLIB_OBJS} ${VBINIT_OBJS} ${VBSF_OBJS} |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 315 | |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 316 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 317 | # Library to build the utilities. "HOST" mostly means "userspace". |
Bill Richardson | c7c6e5d | 2013-02-28 10:10:29 -0800 | [diff] [blame] | 318 | HOSTLIB = ${BUILD}/libvboot_host.a |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 319 | |
| 320 | HOSTLIB_SRCS = \ |
Bill Richardson | 81a0b3d | 2013-02-28 13:53:09 -0800 | [diff] [blame] | 321 | cgpt/cgpt_create.c \ |
| 322 | cgpt/cgpt_add.c \ |
| 323 | cgpt/cgpt_boot.c \ |
| 324 | cgpt/cgpt_show.c \ |
| 325 | cgpt/cgpt_repair.c \ |
| 326 | cgpt/cgpt_prioritize.c \ |
| 327 | cgpt/cgpt_common.c \ |
Albert Chaulk | 534723a | 2013-03-20 14:46:50 -0700 | [diff] [blame] | 328 | cgpt/flash_ts_drv.c \ |
Albert Chaulk | b334e65 | 2013-03-28 15:25:33 -0700 | [diff] [blame] | 329 | firmware/lib/cgptlib/mtdlib.c \ |
Albert Chaulk | 534723a | 2013-03-20 14:46:50 -0700 | [diff] [blame] | 330 | firmware/lib/flash_ts.c \ |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 331 | host/arch/${ARCH}/lib/crossystem_arch.c \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 332 | host/lib/crossystem.c \ |
| 333 | host/lib/file_keys.c \ |
| 334 | host/lib/fmap.c \ |
| 335 | host/lib/host_common.c \ |
| 336 | host/lib/host_key.c \ |
| 337 | host/lib/host_keyblock.c \ |
| 338 | host/lib/host_misc.c \ |
| 339 | host/lib/host_signature.c \ |
Bill Richardson | 81a0b3d | 2013-02-28 13:53:09 -0800 | [diff] [blame] | 340 | host/lib/signature_digest.c \ |
| 341 | utility/dump_kernel_config_lib.c |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 342 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 343 | HOSTLIB_OBJS = ${HOSTLIB_SRCS:%.c=${BUILD}/%.o} |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 344 | ALL_OBJS += ${HOSTLIB_OBJS} |
| 345 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 346 | # Might need this too. |
| 347 | CRYPTO_LIBS := $(shell ${PKG_CONFIG} --libs libcrypto) |
| 348 | |
Bill Richardson | 81a0b3d | 2013-02-28 13:53:09 -0800 | [diff] [blame] | 349 | # Sigh. For historical reasons, the autoupdate installer must sometimes be a |
| 350 | # 32-bit executable, even when everything else is 64-bit. But it only needs a |
| 351 | # few functions, so let's just build those. |
| 352 | TINYHOSTLIB = ${BUILD}/libtinyvboot_host.a |
| 353 | |
| 354 | TINYHOSTLIB_SRCS = \ |
| 355 | cgpt/cgpt_create.c \ |
| 356 | cgpt/cgpt_add.c \ |
| 357 | cgpt/cgpt_boot.c \ |
| 358 | cgpt/cgpt_show.c \ |
| 359 | cgpt/cgpt_repair.c \ |
| 360 | cgpt/cgpt_prioritize.c \ |
| 361 | cgpt/cgpt_common.c \ |
Albert Chaulk | 534723a | 2013-03-20 14:46:50 -0700 | [diff] [blame] | 362 | cgpt/flash_ts_drv.c \ |
Albert Chaulk | b334e65 | 2013-03-28 15:25:33 -0700 | [diff] [blame] | 363 | firmware/lib/cgptlib/mtdlib.c \ |
Albert Chaulk | 534723a | 2013-03-20 14:46:50 -0700 | [diff] [blame] | 364 | firmware/lib/flash_ts.c \ |
Bill Richardson | 81a0b3d | 2013-02-28 13:53:09 -0800 | [diff] [blame] | 365 | utility/dump_kernel_config_lib.c \ |
| 366 | firmware/lib/cgptlib/crc32.c \ |
| 367 | firmware/lib/cgptlib/cgptlib_internal.c \ |
Bill Richardson | 5fed2a6 | 2013-03-04 15:11:38 -0800 | [diff] [blame] | 368 | firmware/lib/utility_string.c \ |
Bill Richardson | 81a0b3d | 2013-02-28 13:53:09 -0800 | [diff] [blame] | 369 | firmware/stub/utility_stub.c |
| 370 | |
| 371 | TINYHOSTLIB_OBJS = ${TINYHOSTLIB_SRCS:%.c=${BUILD}/%.o} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 372 | |
| 373 | # ---------------------------------------------------------------------------- |
| 374 | # Now for the userspace binaries |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 375 | |
| 376 | CGPT = ${BUILD}/cgpt/cgpt |
| 377 | |
| 378 | CGPT_SRCS = \ |
| 379 | cgpt/cgpt.c \ |
| 380 | cgpt/cgpt_add.c \ |
| 381 | cgpt/cgpt_boot.c \ |
| 382 | cgpt/cgpt_common.c \ |
| 383 | cgpt/cgpt_create.c \ |
| 384 | cgpt/cgpt_find.c \ |
| 385 | cgpt/cgpt_legacy.c \ |
| 386 | cgpt/cgpt_prioritize.c \ |
| 387 | cgpt/cgpt_repair.c \ |
| 388 | cgpt/cgpt_show.c \ |
| 389 | cgpt/cmd_add.c \ |
| 390 | cgpt/cmd_boot.c \ |
| 391 | cgpt/cmd_create.c \ |
| 392 | cgpt/cmd_find.c \ |
| 393 | cgpt/cmd_legacy.c \ |
| 394 | cgpt/cmd_prioritize.c \ |
| 395 | cgpt/cmd_repair.c \ |
Albert Chaulk | 534723a | 2013-03-20 14:46:50 -0700 | [diff] [blame] | 396 | cgpt/cmd_show.c \ |
| 397 | cgpt/flash_ts_drv.c \ |
| 398 | firmware/lib/flash_ts.c |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 399 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 400 | CGPT_OBJS = ${CGPT_SRCS:%.c=${BUILD}/%.o} |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 401 | ALL_OBJS += ${CGPT_OBJS} |
| 402 | |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 403 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 404 | # Scripts to install directly (not compiled) |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 405 | UTIL_SCRIPTS = \ |
| 406 | utility/dev_debug_vboot \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 407 | utility/enable_dev_usb_boot \ |
| 408 | utility/vbutil_what_keys |
| 409 | |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 410 | ifeq (${MINIMAL},) |
| 411 | UTIL_SCRIPTS += \ |
| 412 | utility/dev_make_keypair |
| 413 | endif |
| 414 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 415 | # These utilities should be linked statically. |
| 416 | UTIL_NAMES_STATIC = \ |
Bill Richardson | 339f7e0 | 2013-04-05 09:49:24 -0700 | [diff] [blame] | 417 | utility/crossystem \ |
Bill Richardson | 339f7e0 | 2013-04-05 09:49:24 -0700 | [diff] [blame] | 418 | utility/gbb_utility |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 419 | |
| 420 | UTIL_NAMES = ${UTIL_NAMES_STATIC} \ |
Bill Richardson | 339f7e0 | 2013-04-05 09:49:24 -0700 | [diff] [blame] | 421 | utility/dev_sign_file \ |
| 422 | utility/dump_kernel_config \ |
| 423 | utility/dumpRSAPublicKey \ |
| 424 | utility/tpm_init_temp_fix \ |
| 425 | utility/tpmc \ |
| 426 | utility/vbutil_firmware \ |
| 427 | utility/vbutil_kernel \ |
| 428 | utility/vbutil_key \ |
| 429 | utility/vbutil_keyblock \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 430 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 431 | ifeq (${MINIMAL},) |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 432 | UTIL_NAMES += \ |
Bill Richardson | 339f7e0 | 2013-04-05 09:49:24 -0700 | [diff] [blame] | 433 | utility/bmpblk_font \ |
| 434 | utility/bmpblk_utility \ |
| 435 | utility/eficompress \ |
| 436 | utility/efidecompress \ |
| 437 | utility/load_kernel_test \ |
| 438 | utility/pad_digest_utility \ |
| 439 | utility/signature_digest_utility \ |
| 440 | utility/verify_data |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 441 | endif |
| 442 | |
Bill Richardson | 339f7e0 | 2013-04-05 09:49:24 -0700 | [diff] [blame] | 443 | UTIL_BINS_STATIC := $(addprefix ${BUILD}/,${UTIL_NAMES_STATIC}) |
| 444 | UTIL_BINS = $(addprefix ${BUILD}/,${UTIL_NAMES}) |
Bill Richardson | 1912bba | 2013-04-04 21:08:50 -0700 | [diff] [blame] | 445 | ALL_OBJS += $(addsuffix .o,${UTIL_BINS} ${UTIL_BINS_STATIC}) |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 446 | |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 447 | |
| 448 | # Scripts for signing stuff. |
| 449 | SIGNING_SCRIPTS = \ |
| 450 | utility/tpm-nvsize \ |
| 451 | utility/chromeos-tpm-recovery |
| 452 | |
| 453 | # These go in a different place. |
| 454 | SIGNING_SCRIPTS_DEV = \ |
| 455 | scripts/image_signing/resign_firmwarefd.sh \ |
| 456 | scripts/image_signing/make_dev_firmware.sh \ |
| 457 | scripts/image_signing/make_dev_ssd.sh \ |
| 458 | scripts/image_signing/set_gbb_flags.sh |
| 459 | |
| 460 | # Installed, but not made executable. |
| 461 | SIGNING_COMMON = scripts/image_signing/common_minimal.sh |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 462 | |
Bill Richardson | 826db09 | 2013-01-14 12:37:15 -0800 | [diff] [blame] | 463 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 464 | # The unified firmware utility will eventually replace all the others |
| 465 | FUTIL_BIN = ${BUILD}/futility/futility |
Bill Richardson | 6db8c75 | 2013-04-05 13:30:43 -0700 | [diff] [blame] | 466 | # But we still need both static (tiny) and dynamic (with openssl) versions. |
| 467 | FUTIL_STATIC_BIN = ${FUTIL_BIN}_s |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 468 | |
Bill Richardson | feb2518 | 2013-03-07 12:54:29 -0800 | [diff] [blame] | 469 | # These are the others it will replace. |
Bill Richardson | 20807b6 | 2013-04-09 10:15:26 -0700 | [diff] [blame] | 470 | FUTIL_OLD = bmpblk_font bmpblk_utility cgpt chromeos-tpm-recovery crossystem \ |
| 471 | dev_debug_vboot dev_make_keypair dev_sign_file dumpRSAPublicKey \ |
| 472 | dump_fmap dump_kernel_config eficompress efidecompress \ |
| 473 | enable_dev_usb_boot gbb_utility load_kernel_test \ |
| 474 | make_dev_firmware.sh make_dev_ssd.sh pad_digest_utility \ |
| 475 | resign_firmwarefd.sh set_gbb_flags.sh signature_digest_utility \ |
| 476 | tpm-nvsize tpm_init_temp_fix tpmc vbutil_firmware vbutil_kernel \ |
| 477 | vbutil_key vbutil_keyblock vbutil_what_keys verify_data |
Bill Richardson | feb2518 | 2013-03-07 12:54:29 -0800 | [diff] [blame] | 478 | |
Bill Richardson | 6db8c75 | 2013-04-05 13:30:43 -0700 | [diff] [blame] | 479 | FUTIL_STATIC_SRCS = \ |
Bill Richardson | feb2518 | 2013-03-07 12:54:29 -0800 | [diff] [blame] | 480 | futility/futility.c \ |
Bill Richardson | 20807b6 | 2013-04-09 10:15:26 -0700 | [diff] [blame] | 481 | futility/cmd_dump_fmap.c \ |
Bill Richardson | feb2518 | 2013-03-07 12:54:29 -0800 | [diff] [blame] | 482 | futility/cmd_foo.c |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 483 | |
Bill Richardson | 6db8c75 | 2013-04-05 13:30:43 -0700 | [diff] [blame] | 484 | FUTIL_SRCS = \ |
| 485 | $(FUTIL_STATIC_SRCS) \ |
| 486 | futility/cmd_hey.c |
| 487 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 488 | FUTIL_LDS = futility/futility.lds |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 489 | |
Bill Richardson | 6db8c75 | 2013-04-05 13:30:43 -0700 | [diff] [blame] | 490 | FUTIL_STATIC_OBJS = ${FUTIL_STATIC_SRCS:%.c=${BUILD}/%.o} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 491 | FUTIL_OBJS = ${FUTIL_SRCS:%.c=${BUILD}/%.o} |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 492 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 493 | ALL_OBJS += ${FUTIL_OBJS} |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 494 | |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 495 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 496 | # Library of handy test functions. |
| 497 | TESTLIB = ${BUILD}/tests/test.a |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 498 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 499 | TESTLIB_SRCS = \ |
| 500 | tests/test_common.c \ |
| 501 | tests/timer_utils.c \ |
| 502 | tests/crc32_test.c |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 503 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 504 | TESTLIB_OBJS = ${TESTLIB_SRCS:%.c=${BUILD}/%.o} |
| 505 | ALL_OBJS += ${TESTLIB_OBJS} |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 506 | |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 507 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 508 | # And some compiled tests. |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 509 | TEST_NAMES = \ |
Bill Richardson | 339f7e0 | 2013-04-05 09:49:24 -0700 | [diff] [blame] | 510 | tests/cgptlib_test \ |
| 511 | tests/rollback_index2_tests \ |
| 512 | tests/rollback_index3_tests \ |
| 513 | tests/rsa_padding_test \ |
| 514 | tests/rsa_utility_tests \ |
| 515 | tests/rsa_verify_benchmark \ |
| 516 | tests/sha_benchmark \ |
| 517 | tests/sha_tests \ |
| 518 | tests/stateful_util_tests \ |
| 519 | tests/tlcl_tests \ |
| 520 | tests/tpm_bootmode_tests \ |
| 521 | tests/utility_string_tests \ |
| 522 | tests/utility_tests \ |
| 523 | tests/vboot_api_init_tests \ |
| 524 | tests/vboot_api_devmode_tests \ |
| 525 | tests/vboot_api_firmware_tests \ |
| 526 | tests/vboot_api_kernel_tests \ |
| 527 | tests/vboot_api_kernel2_tests \ |
| 528 | tests/vboot_api_kernel3_tests \ |
| 529 | tests/vboot_api_kernel4_tests \ |
| 530 | tests/vboot_audio_tests \ |
| 531 | tests/vboot_common_tests \ |
| 532 | tests/vboot_common2_tests \ |
| 533 | tests/vboot_common3_tests \ |
| 534 | tests/vboot_display_tests \ |
| 535 | tests/vboot_firmware_tests \ |
| 536 | tests/vboot_kernel_tests \ |
| 537 | tests/vboot_nvstorage_test \ |
| 538 | tests/futility/test_not_really |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 539 | |
Simon Glass | 527ba81 | 2013-07-25 08:48:47 -0600 | [diff] [blame^] | 540 | ifdef REGION_READ |
| 541 | TEST_NAMES += tests/vboot_region_tests |
| 542 | endif |
| 543 | |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 544 | # TODO: port these tests to new API, if not already eqivalent |
| 545 | # functionality in other tests. These don't even compile at present. |
| 546 | # |
| 547 | # big_firmware_tests |
| 548 | # big_kernel_tests |
| 549 | # firmware_image_tests |
| 550 | # firmware_rollback_tests |
| 551 | # firmware_splicing_tests |
| 552 | # firmware_verify_benchmark |
| 553 | # kernel_image_tests |
| 554 | # kernel_rollback_tests |
| 555 | # kernel_splicing_tests |
| 556 | # kernel_verify_benchmark |
| 557 | # rollback_index_test |
| 558 | # verify_firmware_fuzz_driver |
| 559 | # verify_kernel_fuzz_driver |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 560 | # utility/load_firmware_test |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 561 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 562 | # And a few more... |
Bill Richardson | 339f7e0 | 2013-04-05 09:49:24 -0700 | [diff] [blame] | 563 | TLCL_TEST_NAMES = \ |
| 564 | tests/tpm_lite/tpmtest_earlyextend \ |
| 565 | tests/tpm_lite/tpmtest_earlynvram \ |
| 566 | tests/tpm_lite/tpmtest_earlynvram2 \ |
| 567 | tests/tpm_lite/tpmtest_enable \ |
| 568 | tests/tpm_lite/tpmtest_fastenable \ |
| 569 | tests/tpm_lite/tpmtest_globallock \ |
| 570 | tests/tpm_lite/tpmtest_redefine_unowned \ |
| 571 | tests/tpm_lite/tpmtest_spaceperm \ |
| 572 | tests/tpm_lite/tpmtest_testsetup \ |
| 573 | tests/tpm_lite/tpmtest_timing \ |
| 574 | tests/tpm_lite/tpmtest_writelimit |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 575 | |
| 576 | TEST_NAMES += ${TLCL_TEST_NAMES} |
| 577 | |
Bill Richardson | 339f7e0 | 2013-04-05 09:49:24 -0700 | [diff] [blame] | 578 | # Finally |
| 579 | TEST_BINS = $(addprefix ${BUILD}/,${TEST_NAMES}) |
Bill Richardson | 1912bba | 2013-04-04 21:08:50 -0700 | [diff] [blame] | 580 | ALL_OBJS += $(addsuffix .o,${TEST_BINS}) |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 581 | |
Randall Spangler | e061a25 | 2013-01-22 15:34:07 -0800 | [diff] [blame] | 582 | # Directory containing test keys |
| 583 | TEST_KEYS = ${SRC_RUN}/tests/testkeys |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 584 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 585 | |
| 586 | ############################################################################## |
| 587 | # Finally, some targets. High-level ones first. |
| 588 | |
| 589 | # Create output directories if necessary. Do this via explicit shell commands |
| 590 | # so it happens before trying to generate/include dependencies. |
| 591 | SUBDIRS := firmware host cgpt utility futility tests tests/tpm_lite |
| 592 | _dir_create := $(foreach d, \ |
| 593 | $(shell find ${SUBDIRS} -name '*.c' -exec dirname {} \; | sort -u), \ |
| 594 | $(shell [ -d ${BUILD}/${d} ] || mkdir -p ${BUILD}/${d})) |
| 595 | |
| 596 | |
| 597 | # Default target. |
| 598 | .PHONY: all |
Randall Spangler | 59d7508 | 2013-01-23 09:29:54 -0800 | [diff] [blame] | 599 | all: fwlib $(if ${FIRMWARE_ARCH},,host_stuff) $(if ${COV},coverage) |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 600 | |
| 601 | # Host targets |
| 602 | .PHONY: host_stuff |
| 603 | host_stuff: hostlib cgpt utils futil tests |
| 604 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 605 | .PHONY: clean |
| 606 | clean: |
| 607 | ${Q}/bin/rm -rf ${BUILD} |
| 608 | |
| 609 | .PHONY: install |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 610 | install: cgpt_install utils_install signing_install futil_install |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 611 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 612 | # Don't delete intermediate object files |
| 613 | .SECONDARY: |
| 614 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 615 | |
| 616 | # ---------------------------------------------------------------------------- |
| 617 | # Firmware library |
| 618 | |
| 619 | # TPM-specific flags. These depend on the particular TPM we're targeting for. |
| 620 | # They are needed here only for compiling parts of the firmware code into |
| 621 | # user-level tests. |
| 622 | |
| 623 | # TPM_BLOCKING_CONTINUESELFTEST is defined if TPM_ContinueSelfTest blocks until |
| 624 | # the self test has completed. |
| 625 | |
Randall Spangler | 45cc0f2 | 2013-01-25 09:34:26 -0800 | [diff] [blame] | 626 | ${FWLIB_OBJS}: CFLAGS += -DTPM_BLOCKING_CONTINUESELFTEST |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 627 | |
| 628 | # TPM_MANUAL_SELFTEST is defined if the self test must be started manually |
| 629 | # (with a call to TPM_ContinueSelfTest) instead of starting automatically at |
| 630 | # power on. |
| 631 | # |
| 632 | # We sincerely hope that TPM_BLOCKING_CONTINUESELFTEST and TPM_MANUAL_SELFTEST |
| 633 | # are not both defined at the same time. (See comment in code.) |
| 634 | |
| 635 | # CFLAGS += -DTPM_MANUAL_SELFTEST |
| 636 | |
| 637 | ifeq (${FIRMWARE_ARCH},i386) |
| 638 | # Unrolling loops in cryptolib makes it faster |
Randall Spangler | 45cc0f2 | 2013-01-25 09:34:26 -0800 | [diff] [blame] | 639 | ${FWLIB_OBJS}: CFLAGS += -DUNROLL_LOOPS |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 640 | |
| 641 | # Workaround for coreboot on x86, which will power off asynchronously |
| 642 | # without giving us a chance to react. This is not an example of the Right |
| 643 | # Way to do things. See chrome-os-partner:7689, and the commit message |
| 644 | # that made this change. |
Randall Spangler | 45cc0f2 | 2013-01-25 09:34:26 -0800 | [diff] [blame] | 645 | ${FWLIB_OBJS}: CFLAGS += -DSAVE_LOCALE_IMMEDIATELY |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 646 | |
| 647 | # On x86 we don't actually read the GBB data into RAM until it is needed. |
| 648 | # Therefore it makes sense to cache it rather than reading it each time. |
| 649 | # Enable this feature. |
Randall Spangler | 45cc0f2 | 2013-01-25 09:34:26 -0800 | [diff] [blame] | 650 | ${FWLIB_OBJS}: CFLAGS += -DCOPY_BMP_DATA |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 651 | endif |
| 652 | |
Simon Glass | 527ba81 | 2013-07-25 08:48:47 -0600 | [diff] [blame^] | 653 | ifdef REGION_READ |
| 654 | ${FWLIB_OBJS}: CFLAGS += -DREGION_READ |
| 655 | endif |
| 656 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 657 | ifeq (${FIRMWARE_ARCH},) |
| 658 | # Disable rollback TPM when compiling locally, since otherwise |
| 659 | # load_kernel_test attempts to talk to the TPM. |
Randall Spangler | 45cc0f2 | 2013-01-25 09:34:26 -0800 | [diff] [blame] | 660 | ${FWLIB_OBJS}: CFLAGS += -DDISABLE_ROLLBACK_TPM |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 661 | endif |
| 662 | |
Bill Richardson | a130e0b | 2013-04-04 18:16:39 -0700 | [diff] [blame] | 663 | # Linktest ensures firmware lib doesn't rely on outside libraries |
| 664 | ${BUILD}/firmware/linktest/main_vbinit: ${VBINIT_OBJS} |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 665 | ${BUILD}/firmware/linktest/main_vbinit: OBJS = ${VBINIT_OBJS} |
Bill Richardson | 1912bba | 2013-04-04 21:08:50 -0700 | [diff] [blame] | 666 | ALL_OBJS += ${BUILD}/firmware/linktest/main_vbinit.o |
Bill Richardson | a130e0b | 2013-04-04 18:16:39 -0700 | [diff] [blame] | 667 | ${BUILD}/firmware/linktest/main_vbsf: ${VBSF_OBJS} |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 668 | ${BUILD}/firmware/linktest/main_vbsf: OBJS = ${VBSF_OBJS} |
Bill Richardson | 1912bba | 2013-04-04 21:08:50 -0700 | [diff] [blame] | 669 | ALL_OBJS += ${BUILD}/firmware/linktest/main_vbsf.o |
Bill Richardson | a130e0b | 2013-04-04 18:16:39 -0700 | [diff] [blame] | 670 | ${BUILD}/firmware/linktest/main: ${FWLIB} |
| 671 | ${BUILD}/firmware/linktest/main: LIBS = ${FWLIB} |
Bill Richardson | 1912bba | 2013-04-04 21:08:50 -0700 | [diff] [blame] | 672 | ALL_OBJS += ${BUILD}/firmware/linktest/main.o |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 673 | |
| 674 | .phony: fwlinktest |
| 675 | fwlinktest: ${FWLIB} \ |
| 676 | ${BUILD}/firmware/linktest/main_vbinit \ |
| 677 | ${BUILD}/firmware/linktest/main_vbsf \ |
| 678 | ${BUILD}/firmware/linktest/main |
| 679 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 680 | .PHONY: fwlib |
Bill Richardson | a130e0b | 2013-04-04 18:16:39 -0700 | [diff] [blame] | 681 | fwlib: $(if ${FIRMWARE_ARCH},${FWLIB},fwlinktest) |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 682 | |
| 683 | ${FWLIB}: ${FWLIB_OBJS} |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 684 | @$(PRINTF) " RM $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 685 | ${Q}rm -f $@ |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 686 | @$(PRINTF) " AR $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 687 | ${Q}ar qc $@ $^ |
| 688 | |
| 689 | # ---------------------------------------------------------------------------- |
| 690 | # Host library |
| 691 | |
Bill Richardson | a130e0b | 2013-04-04 18:16:39 -0700 | [diff] [blame] | 692 | |
| 693 | # Link tests |
| 694 | ${BUILD}/host/linktest/main: ${HOSTLIB} |
| 695 | ${BUILD}/host/linktest/main: LIBS = ${HOSTLIB} |
Bill Richardson | 1912bba | 2013-04-04 21:08:50 -0700 | [diff] [blame] | 696 | ALL_OBJS += ${BUILD}/host/linktest/main.o |
Bill Richardson | a130e0b | 2013-04-04 18:16:39 -0700 | [diff] [blame] | 697 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 698 | .PHONY: hostlib |
Bill Richardson | a130e0b | 2013-04-04 18:16:39 -0700 | [diff] [blame] | 699 | hostlib: ${BUILD}/host/linktest/main |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 700 | |
| 701 | ${BUILD}/host/% ${HOSTLIB}: INCLUDES += \ |
Bill Richardson | 0c3ba24 | 2013-03-29 11:09:30 -0700 | [diff] [blame] | 702 | -Ihost/include \ |
| 703 | -Ihost/arch/${ARCH}/include \ |
| 704 | -Ihost/lib/include |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 705 | |
| 706 | # TODO: better way to make .a than duplicating this recipe each time? |
| 707 | ${HOSTLIB}: ${HOSTLIB_OBJS} ${FWLIB_OBJS} |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 708 | @$(PRINTF) " RM $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 709 | ${Q}rm -f $@ |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 710 | @$(PRINTF) " AR $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 711 | ${Q}ar qc $@ $^ |
| 712 | |
Bill Richardson | 81a0b3d | 2013-02-28 13:53:09 -0800 | [diff] [blame] | 713 | |
| 714 | # Ugh. This is a very cut-down version of HOSTLIB just for the installer. |
| 715 | .PHONY: tinyhostlib |
| 716 | tinyhostlib: ${TINYHOSTLIB} |
| 717 | ${Q}cp -f ${TINYHOSTLIB} ${HOSTLIB} |
| 718 | |
| 719 | ${TINYHOSTLIB}: ${TINYHOSTLIB_OBJS} |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 720 | @$(PRINTF) " RM $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | 81a0b3d | 2013-02-28 13:53:09 -0800 | [diff] [blame] | 721 | ${Q}rm -f $@ |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 722 | @$(PRINTF) " AR $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | 81a0b3d | 2013-02-28 13:53:09 -0800 | [diff] [blame] | 723 | ${Q}ar qc $@ $^ |
| 724 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 725 | # ---------------------------------------------------------------------------- |
| 726 | # CGPT library and utility |
| 727 | |
| 728 | .PHONY: cgpt |
| 729 | cgpt: ${CGPT} |
| 730 | |
Bill Richardson | 0c3ba24 | 2013-03-29 11:09:30 -0700 | [diff] [blame] | 731 | ${CGPT_OBJS}: INCLUDES += -Ihost/include |
| 732 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 733 | ${CGPT}: LDFLAGS += -static |
| 734 | ${CGPT}: LDLIBS += -luuid |
| 735 | |
Bill Richardson | a130e0b | 2013-04-04 18:16:39 -0700 | [diff] [blame] | 736 | ${CGPT}: ${CGPT_OBJS} ${HOSTLIB} |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 737 | @$(PRINTF) " LDcgpt $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | 6db8c75 | 2013-04-05 13:30:43 -0700 | [diff] [blame] | 738 | ${Q}${LD} -o ${CGPT} ${CFLAGS} ${LDFLAGS} $^ ${LDLIBS} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 739 | |
| 740 | .PHONY: cgpt_install |
| 741 | cgpt_install: ${CGPT} |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 742 | @$(PRINTF) " INSTALL CGPT\n" |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 743 | ${Q}mkdir -p ${UB_DIR} |
| 744 | ${Q}${INSTALL} -t ${UB_DIR} $^ |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 745 | |
| 746 | # ---------------------------------------------------------------------------- |
| 747 | # Utilities |
| 748 | |
| 749 | # These have their own headers too. |
Bill Richardson | 0c3ba24 | 2013-03-29 11:09:30 -0700 | [diff] [blame] | 750 | ${BUILD}/utility/%: INCLUDES += \ |
| 751 | -Ihost/include \ |
| 752 | -Ihost/lib/include \ |
| 753 | -Iutility/include |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 754 | |
| 755 | # Utilities for auto-update toolkits must be statically linked. |
| 756 | ${UTIL_BINS_STATIC}: LDFLAGS += -static |
| 757 | |
Bill Richardson | a130e0b | 2013-04-04 18:16:39 -0700 | [diff] [blame] | 758 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 759 | .PHONY: utils |
Bill Richardson | c7c6e5d | 2013-02-28 10:10:29 -0800 | [diff] [blame] | 760 | utils: ${UTIL_BINS} ${UTIL_SCRIPTS} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 761 | ${Q}cp -f ${UTIL_SCRIPTS} ${BUILD}/utility |
| 762 | ${Q}chmod a+rx $(patsubst %,${BUILD}/%,${UTIL_SCRIPTS}) |
| 763 | |
Bill Richardson | a130e0b | 2013-04-04 18:16:39 -0700 | [diff] [blame] | 764 | ${UTIL_BINS} ${UTIL_BINS_STATIC}: ${HOSTLIB} |
| 765 | ${UTIL_BINS} ${UTIL_BINS_STATIC}: LIBS = ${HOSTLIB} |
| 766 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 767 | .PHONY: utils_install |
Bill Richardson | c7c6e5d | 2013-02-28 10:10:29 -0800 | [diff] [blame] | 768 | utils_install: ${UTIL_BINS} ${UTIL_SCRIPTS} |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 769 | @$(PRINTF) " INSTALL UTILS\n" |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 770 | ${Q}mkdir -p ${UB_DIR} |
| 771 | ${Q}${INSTALL} -t ${UB_DIR} ${UTIL_BINS} ${UTIL_SCRIPTS} |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 772 | |
| 773 | # And some signing stuff for the target |
| 774 | .PHONY: signing_install |
| 775 | signing_install: ${SIGNING_SCRIPTS} ${SIGNING_SCRIPTS_DEV} ${SIGNING_COMMON} |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 776 | @$(PRINTF) " INSTALL SIGNING\n" |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 777 | ${Q}mkdir -p ${UB_DIR} |
| 778 | ${Q}${INSTALL} -t ${UB_DIR} ${SIGNING_SCRIPTS} |
Bill Richardson | feb2518 | 2013-03-07 12:54:29 -0800 | [diff] [blame] | 779 | ${Q}${INSTALL} -t ${UB_DIR} ${SIGNING_SCRIPTS_DEV} |
| 780 | ${Q}${INSTALL} -t ${UB_DIR} -m 'u=rw,go=r,a-s' ${SIGNING_COMMON} |
| 781 | ifneq (${VB_DIR},) |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 782 | ${Q}mkdir -p ${VB_DIR} |
Bill Richardson | feb2518 | 2013-03-07 12:54:29 -0800 | [diff] [blame] | 783 | ${Q}for prog in $(notdir ${SIGNING_SCRIPTS_DEV}); do \ |
| 784 | ln -sf "${FT_DIR}/futility" "${VB_DIR}/$$prog"; done |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 785 | endif |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 786 | |
| 787 | # ---------------------------------------------------------------------------- |
| 788 | # new Firmware Utility |
| 789 | |
| 790 | .PHONY: futil |
Bill Richardson | 6db8c75 | 2013-04-05 13:30:43 -0700 | [diff] [blame] | 791 | futil: ${FUTIL_STATIC_BIN} ${FUTIL_BIN} |
| 792 | |
| 793 | ${FUTIL_STATIC_BIN}: ${FUTIL_LDS} ${FUTIL_STATIC_OBJS} |
| 794 | @$(PRINTF) " LD $(subst ${BUILD}/,,$@)\n" |
| 795 | ${Q}${LD} -o $@ ${CFLAGS} ${LDFLAGS} -static $^ ${LDLIBS} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 796 | |
| 797 | ${FUTIL_BIN}: ${FUTIL_LDS} ${FUTIL_OBJS} |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 798 | @$(PRINTF) " LD $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | 6db8c75 | 2013-04-05 13:30:43 -0700 | [diff] [blame] | 799 | ${Q}${LD} -o $@ ${CFLAGS} ${LDFLAGS} $^ ${LDLIBS} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 800 | |
| 801 | .PHONY: futil_install |
| 802 | futil_install: ${FUTIL_BIN} |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 803 | @$(PRINTF) " INSTALL futility\n" |
Bill Richardson | feb2518 | 2013-03-07 12:54:29 -0800 | [diff] [blame] | 804 | ${Q}mkdir -p ${F_DIR} |
Bill Richardson | 6db8c75 | 2013-04-05 13:30:43 -0700 | [diff] [blame] | 805 | ${Q}${INSTALL} -t ${F_DIR} ${FUTIL_BIN} ${FUTIL_STATIC_BIN} |
Bill Richardson | feb2518 | 2013-03-07 12:54:29 -0800 | [diff] [blame] | 806 | ${Q}for prog in ${FUTIL_OLD}; do \ |
| 807 | ln -sf futility "${F_DIR}/$$prog"; done |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 808 | |
Bill Richardson | 20807b6 | 2013-04-09 10:15:26 -0700 | [diff] [blame] | 809 | # TODO(wfrichar): This will need some refactoring (crbug.com/228932) |
| 810 | ${BUILD}/futility/% ${HOSTLIB}: INCLUDES += \ |
| 811 | -Ihost/include \ |
| 812 | -Ihost/arch/${ARCH}/include \ |
| 813 | -Ihost/lib/include |
| 814 | ${FUTIL_STATIC_BIN} ${FUTIL_BIN}: ${HOSTLIB} |
| 815 | ${FUTIL_STATIC_BIN} ${FUTIL_BIN}: LIBS = ${HOSTLIB} |
| 816 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 817 | # ---------------------------------------------------------------------------- |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 818 | # Utility to generate TLCL structure definition header file. |
| 819 | |
| 820 | ${BUILD}/utility/tlcl_generator: CFLAGS += -fpack-struct |
| 821 | |
| 822 | STRUCTURES_TMP=${BUILD}/tlcl_structures.tmp |
| 823 | STRUCTURES_SRC=firmware/lib/tpm_lite/include/tlcl_structures.h |
| 824 | |
| 825 | .PHONY: update_tlcl_structures |
| 826 | update_tlcl_structures: ${BUILD}/utility/tlcl_generator |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 827 | @$(PRINTF) " Rebuilding TLCL structures\n" |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 828 | ${Q}${BUILD}/utility/tlcl_generator > ${STRUCTURES_TMP} |
| 829 | ${Q}cmp -s ${STRUCTURES_TMP} ${STRUCTURES_SRC} || \ |
| 830 | ( echo "%% Updating structures.h %%" && \ |
| 831 | cp ${STRUCTURES_TMP} ${STRUCTURES_SRC} ) |
| 832 | |
| 833 | # ---------------------------------------------------------------------------- |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 834 | # Tests |
| 835 | |
| 836 | .PHONY: tests |
| 837 | tests: ${TEST_BINS} |
| 838 | |
Bill Richardson | a130e0b | 2013-04-04 18:16:39 -0700 | [diff] [blame] | 839 | ${TEST_BINS}: ${HOSTLIB} ${TESTLIB} |
Bill Richardson | 339f7e0 | 2013-04-05 09:49:24 -0700 | [diff] [blame] | 840 | ${TEST_BINS}: INCLUDES += -Itests |
Bill Richardson | a130e0b | 2013-04-04 18:16:39 -0700 | [diff] [blame] | 841 | ${TEST_BINS}: LIBS = ${HOSTLIB} ${TESTLIB} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 842 | |
| 843 | ${TESTLIB}: ${TESTLIB_OBJS} |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 844 | @$(PRINTF) " RM $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 845 | ${Q}rm -f $@ |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 846 | @$(PRINTF) " AR $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 847 | ${Q}ar qc $@ $^ |
| 848 | |
| 849 | |
| 850 | # ---------------------------------------------------------------------------- |
| 851 | # Generic build rules. LIBS and OBJS can be overridden to tweak the generic |
| 852 | # rules for specific targets. |
| 853 | |
| 854 | ${BUILD}/%: ${BUILD}/%.o ${OBJS} ${LIBS} |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 855 | @$(PRINTF) " LD $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | 6db8c75 | 2013-04-05 13:30:43 -0700 | [diff] [blame] | 856 | ${Q}${LD} -o $@ ${CFLAGS} ${LDFLAGS} $< ${OBJS} ${LIBS} ${LDLIBS} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 857 | |
| 858 | ${BUILD}/%.o: %.c |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 859 | @$(PRINTF) " CC $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 860 | ${Q}${CC} ${CFLAGS} ${INCLUDES} -c -o $@ $< |
| 861 | |
| 862 | # Rules to recompile a single source file for library and test |
| 863 | # TODO: is there a tidier way to do this? |
| 864 | ${BUILD}/%_for_lib.o: CFLAGS += -DFOR_LIBRARY |
| 865 | ${BUILD}/%_for_lib.o: %.c |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 866 | @$(PRINTF) " CC-for-lib $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 867 | ${Q}${CC} ${CFLAGS} ${INCLUDES} -c -o $@ $< |
| 868 | |
| 869 | ${BUILD}/%_for_test.o: CFLAGS += -DFOR_TEST |
| 870 | ${BUILD}/%_for_test.o: %.c |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 871 | @$(PRINTF) " CC-for-test $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 872 | ${Q}${CC} ${CFLAGS} ${INCLUDES} -c -o $@ $< |
| 873 | |
| 874 | # TODO: C++ files don't belong in vboot reference at all. Convert to C. |
| 875 | ${BUILD}/%.o: %.cc |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 876 | @$(PRINTF) " CXX $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 877 | ${Q}${CXX} ${CFLAGS} ${INCLUDES} -c -o $@ $< |
| 878 | |
| 879 | # ---------------------------------------------------------------------------- |
| 880 | # Here are the special tweaks to the generic rules. |
| 881 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 882 | # GBB utility needs C++ linker. TODO: It shouldn't. |
| 883 | ${BUILD}/utility/gbb_utility: LD = ${CXX} |
| 884 | |
Bill Richardson | feb2518 | 2013-03-07 12:54:29 -0800 | [diff] [blame] | 885 | # Because we play some clever linker script games to add new commands without |
| 886 | # changing any header files, futility must be linked with ld.bfd, not gold. |
| 887 | ${FUTIL_BIN}: LDFLAGS += -fuse-ld=bfd |
Bill Richardson | 6db8c75 | 2013-04-05 13:30:43 -0700 | [diff] [blame] | 888 | ${FUTIL_STATIC_BIN}: LDFLAGS += -fuse-ld=bfd |
Bill Richardson | feb2518 | 2013-03-07 12:54:29 -0800 | [diff] [blame] | 889 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 890 | # Some utilities need external crypto functions |
| 891 | ${BUILD}/utility/dumpRSAPublicKey: LDLIBS += ${CRYPTO_LIBS} |
| 892 | ${BUILD}/utility/pad_digest_utility: LDLIBS += ${CRYPTO_LIBS} |
| 893 | ${BUILD}/utility/signature_digest_utility: LDLIBS += ${CRYPTO_LIBS} |
| 894 | ${BUILD}/utility/dev_sign_file: LDLIBS += ${CRYPTO_LIBS} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 895 | ${BUILD}/utility/vbutil_firmware: LDLIBS += ${CRYPTO_LIBS} |
| 896 | ${BUILD}/utility/vbutil_kernel: LDLIBS += ${CRYPTO_LIBS} |
| 897 | ${BUILD}/utility/vbutil_key: LDLIBS += ${CRYPTO_LIBS} |
| 898 | ${BUILD}/utility/vbutil_keyblock: LDLIBS += ${CRYPTO_LIBS} |
| 899 | |
| 900 | ${BUILD}/host/linktest/main: LDLIBS += ${CRYPTO_LIBS} |
| 901 | ${BUILD}/tests/vboot_common2_tests: LDLIBS += ${CRYPTO_LIBS} |
| 902 | ${BUILD}/tests/vboot_common3_tests: LDLIBS += ${CRYPTO_LIBS} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 903 | |
| 904 | ${BUILD}/utility/bmpblk_utility: LD = ${CXX} |
| 905 | ${BUILD}/utility/bmpblk_utility: LDLIBS = -llzma -lyaml |
| 906 | |
| 907 | BMPBLK_UTILITY_DEPS = \ |
| 908 | ${BUILD}/utility/bmpblk_util.o \ |
| 909 | ${BUILD}/utility/image_types.o \ |
| 910 | ${BUILD}/utility/eficompress_for_lib.o \ |
| 911 | ${BUILD}/utility/efidecompress_for_lib.o |
Bill Richardson | 1912bba | 2013-04-04 21:08:50 -0700 | [diff] [blame] | 912 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 913 | ${BUILD}/utility/bmpblk_utility: OBJS = ${BMPBLK_UTILITY_DEPS} |
| 914 | ${BUILD}/utility/bmpblk_utility: ${BMPBLK_UTILITY_DEPS} |
Bill Richardson | 1912bba | 2013-04-04 21:08:50 -0700 | [diff] [blame] | 915 | ALL_OBJS += ${BMPBLK_UTILITY_DEPS} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 916 | |
| 917 | ${BUILD}/utility/bmpblk_font: OBJS += ${BUILD}/utility/image_types.o |
| 918 | ${BUILD}/utility/bmpblk_font: ${BUILD}/utility/image_types.o |
Bill Richardson | 1912bba | 2013-04-04 21:08:50 -0700 | [diff] [blame] | 919 | ALL_OBJS += ${BUILD}/utility/image_types.o |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 920 | |
| 921 | # Allow multiple definitions, so tests can mock functions from other libraries |
| 922 | ${BUILD}/tests/%: CFLAGS += -Xlinker --allow-multiple-definition |
Bill Richardson | 0c3ba24 | 2013-03-29 11:09:30 -0700 | [diff] [blame] | 923 | ${BUILD}/tests/%: INCLUDES += -Ihost/include -Ihost/lib/include |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 924 | ${BUILD}/tests/%: LDLIBS += -lrt -luuid |
| 925 | ${BUILD}/tests/%: LIBS += ${TESTLIB} |
| 926 | |
| 927 | ${BUILD}/tests/rollback_index2_tests: OBJS += \ |
| 928 | ${BUILD}/firmware/lib/rollback_index_for_test.o |
| 929 | ${BUILD}/tests/rollback_index2_tests: \ |
| 930 | ${BUILD}/firmware/lib/rollback_index_for_test.o |
Bill Richardson | 1912bba | 2013-04-04 21:08:50 -0700 | [diff] [blame] | 931 | ALL_OBJS += ${BUILD}/firmware/lib/rollback_index_for_test.o |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 932 | |
Randall Spangler | c3d488d | 2013-01-28 16:23:48 -0800 | [diff] [blame] | 933 | ${BUILD}/tests/tlcl_tests: OBJS += \ |
| 934 | ${BUILD}/firmware/lib/tpm_lite/tlcl_for_test.o |
| 935 | ${BUILD}/tests/tlcl_tests: \ |
| 936 | ${BUILD}/firmware/lib/tpm_lite/tlcl_for_test.o |
Bill Richardson | 1912bba | 2013-04-04 21:08:50 -0700 | [diff] [blame] | 937 | ALL_OBJS += ${BUILD}/firmware/lib/tpm_lite/tlcl_for_test.o |
Randall Spangler | c3d488d | 2013-01-28 16:23:48 -0800 | [diff] [blame] | 938 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 939 | ${BUILD}/tests/vboot_audio_tests: OBJS += \ |
| 940 | ${BUILD}/firmware/lib/vboot_audio_for_test.o |
| 941 | ${BUILD}/tests/vboot_audio_tests: \ |
| 942 | ${BUILD}/firmware/lib/vboot_audio_for_test.o |
Bill Richardson | 1912bba | 2013-04-04 21:08:50 -0700 | [diff] [blame] | 943 | ALL_OBJS += ${BUILD}/firmware/lib/vboot_audio_for_test.o |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 944 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 945 | ${BUILD}/tests/rollback_index_test: INCLUDES += -I/usr/include |
| 946 | ${BUILD}/tests/rollback_index_test: LIBS += -ltlcl |
| 947 | |
Bill Richardson | 339f7e0 | 2013-04-05 09:49:24 -0700 | [diff] [blame] | 948 | TLCL_TEST_BINS = $(addprefix ${BUILD}/,${TLCL_TEST_NAMES}) |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 949 | ${TLCL_TEST_BINS}: OBJS += ${BUILD}/tests/tpm_lite/tlcl_tests.o |
| 950 | ${TLCL_TEST_BINS}: ${BUILD}/tests/tpm_lite/tlcl_tests.o |
Bill Richardson | 1912bba | 2013-04-04 21:08:50 -0700 | [diff] [blame] | 951 | ALL_OBJS += ${BUILD}/tests/tpm_lite/tlcl_tests.o |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 952 | |
| 953 | ############################################################################## |
| 954 | # Targets that exist just to run tests |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 955 | |
| 956 | # Frequently-run tests |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 957 | .PHONY: test_targets |
| 958 | test_targets:: runcgpttests runmisctests |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 959 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 960 | ifeq (${MINIMAL},) |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 961 | # Bitmap utility isn't compiled for minimal variant |
Bill Richardson | feb2518 | 2013-03-07 12:54:29 -0800 | [diff] [blame] | 962 | test_targets:: runbmptests runfutiltests |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 963 | # Scripts don't work under qemu testing |
| 964 | # TODO: convert scripts to makefile so they can be called directly |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 965 | test_targets:: runtestscripts |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 966 | endif |
| 967 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 968 | .PHONY: test_setup |
| 969 | test_setup:: cgpt utils futil tests |
| 970 | |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 971 | # Qemu setup for cross-compiled tests. Need to copy qemu binary into the |
| 972 | # sysroot. |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 973 | ifneq (${QEMU_ARCH},) |
| 974 | test_setup:: qemu_install |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 975 | |
| 976 | .PHONY: qemu_install |
| 977 | qemu_install: |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 978 | ifeq (${SYSROOT},) |
| 979 | $(error SYSROOT must be set to the top of the target-specific root \ |
| 980 | when cross-compiling for qemu-based tests to run properly.) |
| 981 | endif |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 982 | @$(PRINTF) " Copying qemu binary.\n" |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 983 | ${Q}cp -fu /usr/bin/${QEMU_BIN} ${BUILD}/${QEMU_BIN} |
| 984 | ${Q}chmod a+rx ${BUILD}/${QEMU_BIN} |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 985 | endif |
| 986 | |
Bill Richardson | acb2ee9 | 2013-01-11 22:53:00 -0800 | [diff] [blame] | 987 | .PHONY: runtests |
Bill Richardson | a130e0b | 2013-04-04 18:16:39 -0700 | [diff] [blame] | 988 | runtests: test_setup test_targets |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 989 | |
| 990 | # Generate test keys |
Bill Richardson | acb2ee9 | 2013-01-11 22:53:00 -0800 | [diff] [blame] | 991 | .PHONY: genkeys |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 992 | genkeys: utils |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 993 | tests/gen_test_keys.sh |
| 994 | |
| 995 | # Generate test cases for fuzzing |
Bill Richardson | acb2ee9 | 2013-01-11 22:53:00 -0800 | [diff] [blame] | 996 | .PHONY: genfuzztestcases |
Randall Spangler | a808dc9 | 2013-01-14 12:59:05 -0800 | [diff] [blame] | 997 | genfuzztestcases: utils |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 998 | tests/gen_fuzz_test_cases.sh |
| 999 | |
Bill Richardson | acb2ee9 | 2013-01-11 22:53:00 -0800 | [diff] [blame] | 1000 | .PHONY: runbmptests |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1001 | runbmptests: test_setup |
| 1002 | cd tests/bitmaps && BMPBLK=${BUILD_RUN}/utility/bmpblk_utility \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 1003 | ./TestBmpBlock.py -v |
| 1004 | |
Bill Richardson | acb2ee9 | 2013-01-11 22:53:00 -0800 | [diff] [blame] | 1005 | .PHONY: runcgpttests |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1006 | runcgpttests: test_setup |
| 1007 | ${RUNTEST} ${BUILD_RUN}/tests/cgptlib_test |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 1008 | |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 1009 | .PHONY: runtestscripts |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1010 | runtestscripts: test_setup genfuzztestcases |
| 1011 | tests/run_cgpt_tests.sh ${BUILD_RUN}/cgpt/cgpt |
Albert Chaulk | 42c08cb | 2013-04-02 14:38:07 -0700 | [diff] [blame] | 1012 | tests/run_cgpt_tests.sh ${BUILD_RUN}/cgpt/cgpt -N=512,32,1,3 |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 1013 | tests/run_preamble_tests.sh |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 1014 | tests/run_rsa_tests.sh |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 1015 | tests/run_vbutil_kernel_arg_tests.sh |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 1016 | tests/run_vbutil_tests.sh |
| 1017 | |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 1018 | .PHONY: runmisctests |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1019 | runmisctests: test_setup |
| 1020 | ${RUNTEST} ${BUILD_RUN}/tests/rollback_index2_tests |
Randall Spangler | a3eac79 | 2013-01-23 13:04:05 -0800 | [diff] [blame] | 1021 | ${RUNTEST} ${BUILD_RUN}/tests/rollback_index3_tests |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1022 | ${RUNTEST} ${BUILD_RUN}/tests/rsa_utility_tests |
| 1023 | ${RUNTEST} ${BUILD_RUN}/tests/sha_tests |
| 1024 | ${RUNTEST} ${BUILD_RUN}/tests/stateful_util_tests |
Randall Spangler | c3d488d | 2013-01-28 16:23:48 -0800 | [diff] [blame] | 1025 | ${RUNTEST} ${BUILD_RUN}/tests/tlcl_tests |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1026 | ${RUNTEST} ${BUILD_RUN}/tests/tpm_bootmode_tests |
| 1027 | ${RUNTEST} ${BUILD_RUN}/tests/utility_string_tests |
| 1028 | ${RUNTEST} ${BUILD_RUN}/tests/utility_tests |
| 1029 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_devmode_tests |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1030 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_firmware_tests |
Randall Spangler | 0714d9d | 2013-02-05 10:23:38 -0800 | [diff] [blame] | 1031 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_init_tests |
| 1032 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_kernel_tests |
Randall Spangler | 7f43669 | 2013-02-05 12:42:36 -0800 | [diff] [blame] | 1033 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_kernel2_tests |
| 1034 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_kernel3_tests |
| 1035 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_kernel4_tests |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1036 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_audio_tests |
Randall Spangler | e061a25 | 2013-01-22 15:34:07 -0800 | [diff] [blame] | 1037 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_common_tests |
| 1038 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_common2_tests ${TEST_KEYS} |
| 1039 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_common3_tests ${TEST_KEYS} |
Randall Spangler | 786a5dc | 2013-01-24 14:19:56 -0800 | [diff] [blame] | 1040 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_display_tests |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1041 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_firmware_tests |
Randall Spangler | 49cb0d3 | 2013-01-29 14:28:16 -0800 | [diff] [blame] | 1042 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_kernel_tests |
Randall Spangler | 6dbf9d9 | 2013-01-23 12:25:10 -0800 | [diff] [blame] | 1043 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_nvstorage_test |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1044 | |
| 1045 | .PHONY: runfutiltests |
Bill Richardson | feb2518 | 2013-03-07 12:54:29 -0800 | [diff] [blame] | 1046 | runfutiltests: override DESTDIR = ${TEST_INSTALL_DIR} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1047 | runfutiltests: test_setup install |
Bill Richardson | 339f7e0 | 2013-04-05 09:49:24 -0700 | [diff] [blame] | 1048 | tests/futility/run_test_scripts.sh ${DESTDIR} |
| 1049 | ${RUNTEST} ${BUILD_RUN}/tests/futility/test_not_really |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 1050 | |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 1051 | # Run long tests, including all permutations of encryption keys (instead of |
Randall Spangler | 786a5dc | 2013-01-24 14:19:56 -0800 | [diff] [blame] | 1052 | # just the ones we use) and tests of currently-unused code. |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 1053 | # Not run by automated build. |
Bill Richardson | acb2ee9 | 2013-01-11 22:53:00 -0800 | [diff] [blame] | 1054 | .PHONY: runlongtests |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1055 | runlongtests: test_setup genkeys genfuzztestcases |
Randall Spangler | e061a25 | 2013-01-22 15:34:07 -0800 | [diff] [blame] | 1056 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_common2_tests ${TEST_KEYS} --all |
| 1057 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_common3_tests ${TEST_KEYS} --all |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 1058 | tests/run_preamble_tests.sh --all |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 1059 | tests/run_vbutil_tests.sh --all |
| 1060 | |
| 1061 | # TODO: tests to run when ported to new API |
| 1062 | # ./run_image_verification_tests.sh |
| 1063 | # # Splicing tests |
| 1064 | # ${BUILD}/tests/firmware_splicing_tests |
| 1065 | # ${BUILD}/tests/kernel_splicing_tests |
| 1066 | # # Rollback Tests |
| 1067 | # ${BUILD}/tests/firmware_rollback_tests |
| 1068 | # ${BUILD}/tests/kernel_rollback_tests |
| 1069 | |
Randall Spangler | 59d7508 | 2013-01-23 09:29:54 -0800 | [diff] [blame] | 1070 | # Code coverage |
| 1071 | .PHONY: coverage_init |
| 1072 | coverage_init: test_setup |
| 1073 | rm -f ${COV_INFO}* |
| 1074 | lcov -c -i -d . -b . -o ${COV_INFO}.initial |
| 1075 | |
| 1076 | .PHONY: coverage_html |
| 1077 | coverage_html: |
| 1078 | lcov -c -d . -b . -o ${COV_INFO}.tests |
| 1079 | lcov -a ${COV_INFO}.initial -a ${COV_INFO}.tests -o ${COV_INFO}.total |
| 1080 | lcov -r ${COV_INFO}.total '/usr/*' '*/linktest/*' -o ${COV_INFO}.local |
| 1081 | genhtml ${COV_INFO}.local -o ${BUILD}/coverage |
| 1082 | |
| 1083 | # Generate addtional coverage stats just for firmware subdir, because the |
| 1084 | # per-directory stats for the whole project don't include their own subdirs. |
Randall Spangler | 49cb0d3 | 2013-01-29 14:28:16 -0800 | [diff] [blame] | 1085 | lcov -r ${COV_INFO}.local '*/stub/*' -o ${COV_INFO}.nostub |
| 1086 | lcov -e ${COV_INFO}.nostub '${SRCDIR}/firmware/*' \ |
Randall Spangler | 59d7508 | 2013-01-23 09:29:54 -0800 | [diff] [blame] | 1087 | -o ${COV_INFO}.firmware |
| 1088 | |
| 1089 | .PHONY: coverage |
| 1090 | ifeq (${COV},) |
| 1091 | coverage: |
| 1092 | $(error Build coverage like this: make clean && COV=1 make) |
| 1093 | else |
| 1094 | coverage: coverage_init runtests coverage_html |
| 1095 | endif |
Bill Richardson | 1912bba | 2013-04-04 21:08:50 -0700 | [diff] [blame] | 1096 | |
| 1097 | # Include generated dependencies |
| 1098 | ALL_DEPS += ${ALL_OBJS:%.o=%.o.d} |
| 1099 | -include ${ALL_DEPS} |