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