Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 1 | # Copyright 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 | 64ddad7 | 2014-08-29 23:49:23 -0700 | [diff] [blame] | 40 | export SRCDIR |
Bill Richardson | feb2518 | 2013-03-07 12:54:29 -0800 | [diff] [blame] | 41 | BUILD = $(SRCDIR)/build |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 42 | export BUILD |
Simon Glass | 6d696e5 | 2011-11-14 13:46:33 -0800 | [diff] [blame] | 43 | |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 44 | # Stuff for 'make install' |
Bill Richardson | feb2518 | 2013-03-07 12:54:29 -0800 | [diff] [blame] | 45 | INSTALL = install |
Bill Richardson | efa8756 | 2014-09-11 10:41:51 -0700 | [diff] [blame] | 46 | DESTDIR = /usr/local |
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? |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 49 | # UB_DIR = utility binary directory |
| 50 | # VB_DIR = vboot binary directory for dev-mode-only scripts |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 51 | ifeq (${MINIMAL},) |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 52 | # Host install just puts everything where it's told |
Bill Richardson | efa8756 | 2014-09-11 10:41:51 -0700 | [diff] [blame] | 53 | UB_DIR=${DESTDIR}/bin |
| 54 | VB_DIR=${DESTDIR}/bin |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 55 | else |
Bill Richardson | efa8756 | 2014-09-11 10:41:51 -0700 | [diff] [blame] | 56 | # Target install puts things into different places |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 57 | UB_DIR=${DESTDIR}/usr/bin |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 58 | VB_DIR=${DESTDIR}/usr/share/vboot/bin |
| 59 | endif |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 60 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 61 | # Where to install the (exportable) executables for testing? |
| 62 | TEST_INSTALL_DIR = ${BUILD}/install_for_test |
| 63 | |
| 64 | # Verbose? Use V=1 |
| 65 | ifeq (${V},) |
| 66 | Q := @ |
| 67 | endif |
| 68 | |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 69 | # Quiet? Use QUIET=1 |
| 70 | ifeq ($(QUIET),) |
| 71 | PRINTF := printf |
| 72 | else |
| 73 | PRINTF := : |
| 74 | endif |
| 75 | |
Randall Spangler | 61a2eb3 | 2013-01-23 10:20:16 -0800 | [diff] [blame] | 76 | # Architecture detection |
| 77 | _machname := $(shell uname -m) |
| 78 | HOST_ARCH ?= ${_machname} |
| 79 | |
| 80 | # ARCH and/or FIRMWARE_ARCH are defined by the Chromium OS ebuild. |
| 81 | # Pick a sane target architecture if none is defined. |
| 82 | ifeq (${ARCH},) |
| 83 | ARCH := ${HOST_ARCH} |
| 84 | else ifeq (${ARCH},i386) |
| 85 | override ARCH := x86 |
| 86 | else ifeq (${ARCH},amd64) |
| 87 | override ARCH := x86_64 |
| 88 | endif |
| 89 | |
| 90 | # FIRMWARE_ARCH is only defined by the Chromium OS ebuild if compiling |
| 91 | # for a firmware target (such as u-boot or depthcharge). It must map |
| 92 | # to the same consistent set of architectures as the host. |
| 93 | ifeq (${FIRMWARE_ARCH},i386) |
| 94 | override FIRMWARE_ARCH := x86 |
| 95 | else ifeq (${FIRMWARE_ARCH},amd64) |
| 96 | override FIRMWARE_ARCH := x86_64 |
Stefan Reinauer | d96b25d | 2013-09-19 14:24:29 -0700 | [diff] [blame] | 97 | else ifeq (${FIRMWARE_ARCH},armv7) |
| 98 | override FIRMWARE_ARCH := arm |
Randall Spangler | 61a2eb3 | 2013-01-23 10:20:16 -0800 | [diff] [blame] | 99 | endif |
| 100 | |
Simon Glass | b265c34 | 2011-11-16 15:09:51 -0800 | [diff] [blame] | 101 | # Provide default CC and CFLAGS for firmware builds; if you have any -D flags, |
| 102 | # please add them after this point (e.g., -DVBOOT_DEBUG). |
Che-Liang Chiou | 74359b7 | 2011-06-21 15:25:51 -0700 | [diff] [blame] | 103 | # |
Che-Liang Chiou | 6b0003c | 2011-10-14 11:11:28 +0800 | [diff] [blame] | 104 | # TODO(crosbug.com/16808) We hard-code u-boot's compiler flags here just |
| 105 | # temporarily. As we are still investigating which flags are necessary for |
| 106 | # maintaining a compatible ABI, etc. between u-boot and vboot_reference. |
Che-Liang Chiou | 74359b7 | 2011-06-21 15:25:51 -0700 | [diff] [blame] | 107 | # |
Simon Glass | b265c34 | 2011-11-16 15:09:51 -0800 | [diff] [blame] | 108 | # As a first step, this makes the setting of CC and CFLAGS here optional, to |
| 109 | # permit a calling script or Makefile to set these. |
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 | # Flag ordering: arch, then -f, then -m, then -W |
| 112 | DEBUG_FLAGS := $(if ${DEBUG},-g -O0,-Os) |
| 113 | COMMON_FLAGS := -nostdinc -pipe \ |
| 114 | -ffreestanding -fno-builtin -fno-stack-protector \ |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 115 | -Werror -Wall -Wstrict-prototypes ${DEBUG_FLAGS} |
Simon Glass | b265c34 | 2011-11-16 15:09:51 -0800 | [diff] [blame] | 116 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 117 | # Note: FIRMWARE_ARCH is defined by the Chromium OS ebuild. |
| 118 | ifeq (${FIRMWARE_ARCH}, arm) |
Simon Glass | b265c34 | 2011-11-16 15:09:51 -0800 | [diff] [blame] | 119 | CC ?= armv7a-cros-linux-gnueabi-gcc |
| 120 | CFLAGS ?= -march=armv5 \ |
| 121 | -fno-common -ffixed-r8 \ |
Doug Anderson | d50b27d | 2012-05-11 12:08:02 -0700 | [diff] [blame] | 122 | -mfloat-abi=hard -marm -mabi=aapcs-linux -mno-thumb-interwork \ |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 123 | ${COMMON_FLAGS} |
Randall Spangler | 61a2eb3 | 2013-01-23 10:20:16 -0800 | [diff] [blame] | 124 | else ifeq (${FIRMWARE_ARCH}, x86) |
Simon Glass | b265c34 | 2011-11-16 15:09:51 -0800 | [diff] [blame] | 125 | CC ?= i686-pc-linux-gnu-gcc |
| 126 | # Drop -march=i386 to permit use of SSE instructions |
| 127 | CFLAGS ?= \ |
| 128 | -ffunction-sections -fvisibility=hidden -fno-strict-aliasing \ |
| 129 | -fomit-frame-pointer -fno-toplevel-reorder -fno-dwarf2-cfi-asm \ |
Gabe Black | 46e00e6 | 2013-12-18 18:23:24 -0800 | [diff] [blame] | 130 | -mpreferred-stack-boundary=2 \ |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 131 | ${COMMON_FLAGS} |
| 132 | else ifeq (${FIRMWARE_ARCH}, x86_64) |
| 133 | CFLAGS ?= ${COMMON_FLAGS} \ |
Simon Glass | 8e85e98 | 2011-11-22 13:54:50 -0800 | [diff] [blame] | 134 | -fvisibility=hidden -fno-strict-aliasing -fomit-frame-pointer |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 135 | else |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 136 | # FIRMWARE_ARCH not defined; assuming local compile. |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 137 | CC ?= gcc |
Bill Richardson | d462101 | 2014-07-09 23:31:13 -0700 | [diff] [blame] | 138 | CFLAGS += -DCHROMEOS_ENVIRONMENT -Wall -Werror ${DEBUG_FLAGS} |
Che-Liang Chiou | 34be827 | 2011-01-27 16:44:36 +0800 | [diff] [blame] | 139 | endif |
| 140 | |
| 141 | ifneq (${DEBUG},) |
| 142 | CFLAGS += -DVBOOT_DEBUG |
vbendeb | b2b0fcc | 2010-07-15 15:09:47 -0700 | [diff] [blame] | 143 | endif |
Che-Liang Chiou | 0a0e8d0 | 2010-11-30 09:30:45 +0800 | [diff] [blame] | 144 | |
vbendeb | b2b0fcc | 2010-07-15 15:09:47 -0700 | [diff] [blame] | 145 | ifeq (${DISABLE_NDEBUG},) |
| 146 | CFLAGS += -DNDEBUG |
| 147 | endif |
| 148 | |
Bill Richardson | feb2518 | 2013-03-07 12:54:29 -0800 | [diff] [blame] | 149 | ifneq (${FORCE_LOGGING_ON},) |
| 150 | CFLAGS += -DFORCE_LOGGING_ON=${FORCE_LOGGING_ON} |
| 151 | endif |
| 152 | |
Randall Spangler | 6014c04 | 2014-07-22 14:42:58 -0700 | [diff] [blame] | 153 | ifneq (${PD_SYNC},) |
| 154 | CFLAGS += -DPD_SYNC |
| 155 | endif |
| 156 | |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 157 | # Create / use dependency files |
| 158 | CFLAGS += -MMD -MF $@.d |
Simon Glass | b265c34 | 2011-11-16 15:09:51 -0800 | [diff] [blame] | 159 | |
Bertrand SIMONNET | f8f807a | 2014-06-30 09:41:13 -0700 | [diff] [blame] | 160 | ifeq (${FIRMWARE_ARCH},) |
| 161 | # Creates position independent code for non firmware target. |
| 162 | CFLAGS += -fPIE |
| 163 | endif |
| 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},) |
Bill Richardson | d2d08b2 | 2014-07-08 16:31:40 -0700 | [diff] [blame] | 170 | COV_FLAGS = -O0 --coverage -DCOVERAGE |
Randall Spangler | 59d7508 | 2013-01-23 09:29:54 -0800 | [diff] [blame] | 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} |
Bill Richardson | 6df3e33 | 2014-10-02 18:50:33 -0700 | [diff] [blame] | 178 | CXX ?= g++ |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 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 \ |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 224 | -Ifirmware/lib/tpm_lite/include \ |
| 225 | -Ifirmware/2lib/include |
Bill Richardson | 0b8f35c | 2010-05-26 09:18:38 -0700 | [diff] [blame] | 226 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 227 | # If we're not building for a specific target, just stub out things like the |
| 228 | # TPM commands and various external functions that are provided by the BIOS. |
| 229 | ifeq (${FIRMWARE_ARCH},) |
Bill Richardson | 0e6ae29 | 2014-08-26 10:34:40 -0700 | [diff] [blame] | 230 | INCLUDES += -Ihost/include -Ihost/lib/include |
Che-Liang Chiou | 0a0e8d0 | 2010-11-30 09:30:45 +0800 | [diff] [blame] | 231 | endif |
Gaurav Shah | 322536d | 2010-01-28 15:01:23 -0800 | [diff] [blame] | 232 | |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 233 | # Firmware library, used by the other firmware components (depthcharge, |
| 234 | # coreboot, etc.). It doesn't need exporting to some other place; they'll build |
| 235 | # this source tree locally and link to it directly. |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 236 | FWLIB = ${BUILD}/vboot_fw.a |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 237 | |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 238 | # Smaller firmware library. TODO: Do we still need to export this? |
Randall Spangler | aaaff86 | 2014-12-01 15:40:08 -0800 | [diff] [blame] | 239 | FWLIB20 = ${BUILD}/vboot_fw2.a |
Randall Spangler | a5b69b0 | 2014-12-02 13:41:29 -0800 | [diff] [blame] | 240 | FWLIB21 = ${BUILD}/vboot_fw21.a |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 241 | |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 242 | # Firmware library sources needed by VbInit() call |
| 243 | VBINIT_SRCS = \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 244 | firmware/lib/crc8.c \ |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 245 | firmware/lib/utility.c \ |
| 246 | firmware/lib/vboot_api_init.c \ |
| 247 | firmware/lib/vboot_common_init.c \ |
| 248 | firmware/lib/vboot_nvstorage.c \ |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 249 | firmware/lib/vboot_nvstorage_rollback.c \ |
Simon Glass | 527ba81 | 2013-07-25 08:48:47 -0600 | [diff] [blame] | 250 | firmware/lib/region-init.c \ |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 251 | |
| 252 | # Additional firmware library sources needed by VbSelectFirmware() call |
| 253 | VBSF_SRCS = \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 254 | firmware/lib/cryptolib/padding.c \ |
| 255 | firmware/lib/cryptolib/rsa.c \ |
| 256 | firmware/lib/cryptolib/rsa_utility.c \ |
| 257 | firmware/lib/cryptolib/sha1.c \ |
| 258 | firmware/lib/cryptolib/sha256.c \ |
| 259 | firmware/lib/cryptolib/sha512.c \ |
| 260 | firmware/lib/cryptolib/sha_utility.c \ |
| 261 | firmware/lib/stateful_util.c \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 262 | firmware/lib/vboot_api_firmware.c \ |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 263 | firmware/lib/vboot_common.c \ |
Simon Glass | 527ba81 | 2013-07-25 08:48:47 -0600 | [diff] [blame] | 264 | firmware/lib/vboot_firmware.c \ |
| 265 | firmware/lib/region-fw.c \ |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 266 | |
| 267 | # Additional firmware library sources needed by VbSelectAndLoadKernel() call |
| 268 | VBSLK_SRCS = \ |
| 269 | firmware/lib/cgptlib/cgptlib.c \ |
| 270 | firmware/lib/cgptlib/cgptlib_internal.c \ |
| 271 | firmware/lib/cgptlib/crc32.c \ |
Dan Ehrenberg | 7c2beb0 | 2014-10-21 16:15:54 -0700 | [diff] [blame] | 272 | firmware/lib/gpt_misc.c \ |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 273 | firmware/lib/utility_string.c \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 274 | firmware/lib/vboot_api_kernel.c \ |
| 275 | firmware/lib/vboot_audio.c \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 276 | firmware/lib/vboot_display.c \ |
Simon Glass | 527ba81 | 2013-07-25 08:48:47 -0600 | [diff] [blame] | 277 | firmware/lib/vboot_kernel.c \ |
| 278 | firmware/lib/region-kernel.c \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 279 | |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 280 | # Firmware library source needed for smaller library 2 |
Randall Spangler | aaaff86 | 2014-12-01 15:40:08 -0800 | [diff] [blame] | 281 | FWLIB20_SRCS = \ |
Randall Spangler | a7ab8b5 | 2014-06-10 17:05:08 -0700 | [diff] [blame] | 282 | firmware/2lib/2api.c \ |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 283 | firmware/2lib/2common.c \ |
Randall Spangler | 3333e57 | 2014-05-14 11:37:52 -0700 | [diff] [blame] | 284 | firmware/2lib/2crc8.c \ |
| 285 | firmware/2lib/2misc.c \ |
| 286 | firmware/2lib/2nvstorage.c \ |
Randall Spangler | f18038b | 2014-10-23 15:55:21 -0700 | [diff] [blame] | 287 | firmware/2lib/2packed_key.c \ |
Randall Spangler | e166d04 | 2014-05-13 09:24:52 -0700 | [diff] [blame] | 288 | firmware/2lib/2rsa.c \ |
Randall Spangler | 3333e57 | 2014-05-14 11:37:52 -0700 | [diff] [blame] | 289 | firmware/2lib/2secdata.c \ |
Randall Spangler | e166d04 | 2014-05-13 09:24:52 -0700 | [diff] [blame] | 290 | firmware/2lib/2sha1.c \ |
| 291 | firmware/2lib/2sha256.c \ |
| 292 | firmware/2lib/2sha512.c \ |
Randall Spangler | a5b69b0 | 2014-12-02 13:41:29 -0800 | [diff] [blame] | 293 | firmware/2lib/2sha_utility.c |
| 294 | |
| 295 | FWLIB21_SRCS = \ |
| 296 | firmware/lib21/api.c \ |
| 297 | firmware/lib21/common.c \ |
| 298 | firmware/lib21/misc.c \ |
| 299 | firmware/lib21/packed_key.c |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 300 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 301 | # Support real TPM unless BIOS sets MOCK_TPM |
| 302 | ifeq (${MOCK_TPM},) |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 303 | VBINIT_SRCS += \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 304 | firmware/lib/rollback_index.c \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 305 | firmware/lib/tpm_lite/tlcl.c |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 306 | |
| 307 | VBSF_SRCS += \ |
| 308 | firmware/lib/tpm_bootmode.c |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 309 | else |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 310 | VBINIT_SRCS += \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 311 | firmware/lib/mocked_rollback_index.c \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 312 | firmware/lib/tpm_lite/mocked_tlcl.c |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 313 | |
| 314 | VBSF_SRCS += \ |
| 315 | firmware/lib/mocked_tpm_bootmode.c |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 316 | endif |
| 317 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 318 | ifeq (${FIRMWARE_ARCH},) |
| 319 | # Include BIOS stubs in the firmware library when compiling for host |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 320 | # TODO: split out other stub funcs too |
| 321 | VBINIT_SRCS += \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 322 | firmware/stub/tpm_lite_stub.c \ |
| 323 | firmware/stub/utility_stub.c \ |
Simon Glass | 527ba81 | 2013-07-25 08:48:47 -0600 | [diff] [blame] | 324 | firmware/stub/vboot_api_stub_init.c \ |
| 325 | firmware/stub/vboot_api_stub_region.c |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 326 | |
| 327 | VBSF_SRCS += \ |
| 328 | firmware/stub/vboot_api_stub_sf.c |
| 329 | |
| 330 | VBSLK_SRCS += \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 331 | firmware/stub/vboot_api_stub.c \ |
Dan Ehrenberg | 5dc75d1 | 2014-10-07 14:55:37 -0700 | [diff] [blame] | 332 | firmware/stub/vboot_api_stub_disk.c \ |
| 333 | firmware/stub/vboot_api_stub_stream.c |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 334 | |
Randall Spangler | aaaff86 | 2014-12-01 15:40:08 -0800 | [diff] [blame] | 335 | FWLIB20_SRCS += \ |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 336 | firmware/2lib/2stub.c |
| 337 | |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 338 | endif |
| 339 | |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 340 | VBSF_SRCS += ${VBINIT_SRCS} |
| 341 | FWLIB_SRCS += ${VBSF_SRCS} ${VBSLK_SRCS} |
| 342 | |
| 343 | VBINIT_OBJS = ${VBINIT_SRCS:%.c=${BUILD}/%.o} |
| 344 | VBSF_OBJS = ${VBSF_SRCS:%.c=${BUILD}/%.o} |
Randall Spangler | a5b69b0 | 2014-12-02 13:41:29 -0800 | [diff] [blame] | 345 | ALL_OBJS += ${VBINIT_OBJS} ${VBSF_OBJS} |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 346 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 347 | FWLIB_OBJS = ${FWLIB_SRCS:%.c=${BUILD}/%.o} |
Randall Spangler | aaaff86 | 2014-12-01 15:40:08 -0800 | [diff] [blame] | 348 | FWLIB20_OBJS = ${FWLIB20_SRCS:%.c=${BUILD}/%.o} |
Randall Spangler | a5b69b0 | 2014-12-02 13:41:29 -0800 | [diff] [blame] | 349 | FWLIB21_OBJS = ${FWLIB21_SRCS:%.c=${BUILD}/%.o} |
| 350 | ALL_OBJS += ${FWLIB_OBJS} ${FWLIB20_OBJS} ${FWLIB21_OBJS} |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 351 | |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 352 | # Intermediate library for the vboot_reference utilities to link against. |
| 353 | UTILLIB = ${BUILD}/libvboot_util.a |
Randall Spangler | a5b69b0 | 2014-12-02 13:41:29 -0800 | [diff] [blame] | 354 | UTILLIB21 = ${BUILD}/libvboot_util20.a |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 355 | |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 356 | UTILLIB_SRCS = \ |
Bill Richardson | 81a0b3d | 2013-02-28 13:53:09 -0800 | [diff] [blame] | 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 \ |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 364 | futility/dump_kernel_config_lib.c \ |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 365 | host/arch/${ARCH}/lib/crossystem_arch.c \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 366 | host/lib/crossystem.c \ |
| 367 | host/lib/file_keys.c \ |
| 368 | host/lib/fmap.c \ |
| 369 | host/lib/host_common.c \ |
| 370 | host/lib/host_key.c \ |
| 371 | host/lib/host_keyblock.c \ |
| 372 | host/lib/host_misc.c \ |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 373 | host/lib/util_misc.c \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 374 | host/lib/host_signature.c \ |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 375 | host/lib/signature_digest.c |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 376 | |
Randall Spangler | aaaff86 | 2014-12-01 15:40:08 -0800 | [diff] [blame] | 377 | UTILLIB_OBJS = ${UTILLIB_SRCS:%.c=${BUILD}/%.o} |
| 378 | ALL_OBJS += ${UTILLIB_OBJS} |
| 379 | |
Randall Spangler | a5b69b0 | 2014-12-02 13:41:29 -0800 | [diff] [blame] | 380 | UTILLIB21_SRCS += \ |
| 381 | host/lib21/host_fw_preamble.c \ |
| 382 | host/lib21/host_key.c \ |
| 383 | host/lib21/host_keyblock.c \ |
| 384 | host/lib21/host_misc.c \ |
| 385 | host/lib21/host_signature.c |
Randall Spangler | 02e11b3 | 2014-11-19 12:48:36 -0800 | [diff] [blame] | 386 | |
Randall Spangler | a5b69b0 | 2014-12-02 13:41:29 -0800 | [diff] [blame] | 387 | UTILLIB21_OBJS = ${UTILLIB21_SRCS:%.c=${BUILD}/%.o} |
| 388 | ALL_OBJS += ${UTILLIB21_OBJS} |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 389 | |
| 390 | # Externally exported library for some target userspace apps to link with |
| 391 | # (cryptohome, updater, etc.) |
| 392 | HOSTLIB = ${BUILD}/libvboot_host.a |
| 393 | |
| 394 | HOSTLIB_SRCS = \ |
| 395 | cgpt/cgpt_add.c \ |
| 396 | cgpt/cgpt_boot.c \ |
| 397 | cgpt/cgpt_common.c \ |
| 398 | cgpt/cgpt_create.c \ |
| 399 | cgpt/cgpt_prioritize.c \ |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 400 | firmware/lib/cgptlib/cgptlib_internal.c \ |
| 401 | firmware/lib/cgptlib/crc32.c \ |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 402 | firmware/lib/crc8.c \ |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 403 | firmware/lib/tpm_lite/tlcl.c \ |
| 404 | firmware/lib/utility_string.c \ |
| 405 | firmware/lib/vboot_nvstorage.c \ |
| 406 | firmware/stub/tpm_lite_stub.c \ |
| 407 | firmware/stub/utility_stub.c \ |
| 408 | firmware/stub/vboot_api_stub_init.c \ |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 409 | futility/dump_kernel_config_lib.c \ |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 410 | host/arch/${ARCH}/lib/crossystem_arch.c \ |
| 411 | host/lib/crossystem.c \ |
Nam T. Nguyen | 6ee52d9 | 2014-10-24 13:20:39 -0700 | [diff] [blame] | 412 | host/lib/fmap.c \ |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 413 | host/lib/host_misc.c |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 414 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 415 | HOSTLIB_OBJS = ${HOSTLIB_SRCS:%.c=${BUILD}/%.o} |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 416 | ALL_OBJS += ${HOSTLIB_OBJS} |
| 417 | |
Bill Richardson | 81a0b3d | 2013-02-28 13:53:09 -0800 | [diff] [blame] | 418 | # Sigh. For historical reasons, the autoupdate installer must sometimes be a |
| 419 | # 32-bit executable, even when everything else is 64-bit. But it only needs a |
| 420 | # few functions, so let's just build those. |
| 421 | TINYHOSTLIB = ${BUILD}/libtinyvboot_host.a |
| 422 | |
| 423 | TINYHOSTLIB_SRCS = \ |
Bill Richardson | 81a0b3d | 2013-02-28 13:53:09 -0800 | [diff] [blame] | 424 | cgpt/cgpt_add.c \ |
| 425 | cgpt/cgpt_boot.c \ |
Bill Richardson | 81a0b3d | 2013-02-28 13:53:09 -0800 | [diff] [blame] | 426 | cgpt/cgpt_common.c \ |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 427 | cgpt/cgpt_create.c \ |
| 428 | cgpt/cgpt_prioritize.c \ |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 429 | firmware/lib/cgptlib/cgptlib_internal.c \ |
| 430 | firmware/lib/cgptlib/crc32.c \ |
Bill Richardson | 5fed2a6 | 2013-03-04 15:11:38 -0800 | [diff] [blame] | 431 | firmware/lib/utility_string.c \ |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 432 | firmware/stub/utility_stub.c \ |
Nam T. Nguyen | ab89959 | 2014-11-13 19:30:46 -0800 | [diff] [blame] | 433 | futility/dump_kernel_config_lib.c |
Bill Richardson | 81a0b3d | 2013-02-28 13:53:09 -0800 | [diff] [blame] | 434 | |
| 435 | TINYHOSTLIB_OBJS = ${TINYHOSTLIB_SRCS:%.c=${BUILD}/%.o} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 436 | |
| 437 | # ---------------------------------------------------------------------------- |
| 438 | # Now for the userspace binaries |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 439 | |
| 440 | CGPT = ${BUILD}/cgpt/cgpt |
| 441 | |
| 442 | CGPT_SRCS = \ |
| 443 | cgpt/cgpt.c \ |
| 444 | cgpt/cgpt_add.c \ |
| 445 | cgpt/cgpt_boot.c \ |
| 446 | cgpt/cgpt_common.c \ |
| 447 | cgpt/cgpt_create.c \ |
| 448 | cgpt/cgpt_find.c \ |
| 449 | cgpt/cgpt_legacy.c \ |
| 450 | cgpt/cgpt_prioritize.c \ |
| 451 | cgpt/cgpt_repair.c \ |
| 452 | cgpt/cgpt_show.c \ |
| 453 | cgpt/cmd_add.c \ |
| 454 | cgpt/cmd_boot.c \ |
| 455 | cgpt/cmd_create.c \ |
| 456 | cgpt/cmd_find.c \ |
| 457 | cgpt/cmd_legacy.c \ |
| 458 | cgpt/cmd_prioritize.c \ |
| 459 | cgpt/cmd_repair.c \ |
Nam T. Nguyen | 8577b53 | 2014-11-25 13:26:53 -0800 | [diff] [blame] | 460 | cgpt/cmd_show.c |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 461 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 462 | CGPT_OBJS = ${CGPT_SRCS:%.c=${BUILD}/%.o} |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 463 | ALL_OBJS += ${CGPT_OBJS} |
| 464 | |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 465 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 466 | # Scripts to install directly (not compiled) |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 467 | UTIL_SCRIPTS = \ |
| 468 | utility/dev_debug_vboot \ |
Bill Richardson | 4d49d34 | 2014-10-02 10:52:41 -0700 | [diff] [blame] | 469 | utility/enable_dev_usb_boot |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 470 | |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 471 | ifeq (${MINIMAL},) |
| 472 | UTIL_SCRIPTS += \ |
Bill Richardson | 4d49d34 | 2014-10-02 10:52:41 -0700 | [diff] [blame] | 473 | utility/dev_make_keypair \ |
| 474 | utility/vbutil_what_keys |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 475 | endif |
| 476 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 477 | # These utilities should be linked statically. |
| 478 | UTIL_NAMES_STATIC = \ |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 479 | utility/crossystem |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 480 | |
| 481 | UTIL_NAMES = ${UTIL_NAMES_STATIC} \ |
Bill Richardson | 339f7e0 | 2013-04-05 09:49:24 -0700 | [diff] [blame] | 482 | utility/tpm_init_temp_fix \ |
Duncan Laurie | 0f07867 | 2014-09-19 14:39:09 -0700 | [diff] [blame] | 483 | utility/dumpRSAPublicKey \ |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 484 | utility/tpmc |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 485 | |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 486 | # TODO: Do we still need eficompress and efidecompress for anything? |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 487 | ifeq (${MINIMAL},) |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 488 | UTIL_NAMES += \ |
Bill Richardson | 339f7e0 | 2013-04-05 09:49:24 -0700 | [diff] [blame] | 489 | utility/bmpblk_font \ |
| 490 | utility/bmpblk_utility \ |
| 491 | utility/eficompress \ |
| 492 | utility/efidecompress \ |
| 493 | utility/load_kernel_test \ |
| 494 | utility/pad_digest_utility \ |
| 495 | utility/signature_digest_utility \ |
| 496 | utility/verify_data |
Randall Spangler | a7ab8b5 | 2014-06-10 17:05:08 -0700 | [diff] [blame] | 497 | |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 498 | endif |
| 499 | |
Bill Richardson | 339f7e0 | 2013-04-05 09:49:24 -0700 | [diff] [blame] | 500 | UTIL_BINS_STATIC := $(addprefix ${BUILD}/,${UTIL_NAMES_STATIC}) |
| 501 | UTIL_BINS = $(addprefix ${BUILD}/,${UTIL_NAMES}) |
Bill Richardson | 1912bba | 2013-04-04 21:08:50 -0700 | [diff] [blame] | 502 | ALL_OBJS += $(addsuffix .o,${UTIL_BINS} ${UTIL_BINS_STATIC}) |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 503 | |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 504 | |
| 505 | # Scripts for signing stuff. |
| 506 | SIGNING_SCRIPTS = \ |
| 507 | utility/tpm-nvsize \ |
| 508 | utility/chromeos-tpm-recovery |
| 509 | |
| 510 | # These go in a different place. |
| 511 | SIGNING_SCRIPTS_DEV = \ |
| 512 | scripts/image_signing/resign_firmwarefd.sh \ |
| 513 | scripts/image_signing/make_dev_firmware.sh \ |
| 514 | scripts/image_signing/make_dev_ssd.sh \ |
| 515 | scripts/image_signing/set_gbb_flags.sh |
| 516 | |
| 517 | # Installed, but not made executable. |
| 518 | SIGNING_COMMON = scripts/image_signing/common_minimal.sh |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 519 | |
Bill Richardson | 826db09 | 2013-01-14 12:37:15 -0800 | [diff] [blame] | 520 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 521 | # The unified firmware utility will eventually replace all the others |
| 522 | FUTIL_BIN = ${BUILD}/futility/futility |
Bill Richardson | 6db8c75 | 2013-04-05 13:30:43 -0700 | [diff] [blame] | 523 | # But we still need both static (tiny) and dynamic (with openssl) versions. |
| 524 | FUTIL_STATIC_BIN = ${FUTIL_BIN}_s |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 525 | |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 526 | # These are the executables that are now built in to futility. We'll create |
| 527 | # symlinks for these so the old names will still work. |
| 528 | # TODO: Do we still need dev_sign_file for anything? |
Bill Richardson | a1d9fe6 | 2014-09-05 12:52:27 -0700 | [diff] [blame] | 529 | FUTIL_SYMLINKS = \ |
Bill Richardson | e155044 | 2014-07-17 11:32:17 -0700 | [diff] [blame] | 530 | dev_sign_file \ |
Bill Richardson | e155044 | 2014-07-17 11:32:17 -0700 | [diff] [blame] | 531 | dump_fmap \ |
| 532 | dump_kernel_config \ |
Bill Richardson | e155044 | 2014-07-17 11:32:17 -0700 | [diff] [blame] | 533 | gbb_utility \ |
Bill Richardson | e155044 | 2014-07-17 11:32:17 -0700 | [diff] [blame] | 534 | vbutil_firmware \ |
| 535 | vbutil_kernel \ |
| 536 | vbutil_key \ |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 537 | vbutil_keyblock |
Bill Richardson | feb2518 | 2013-03-07 12:54:29 -0800 | [diff] [blame] | 538 | |
Bill Richardson | 6db8c75 | 2013-04-05 13:30:43 -0700 | [diff] [blame] | 539 | FUTIL_STATIC_SRCS = \ |
Bill Richardson | feb2518 | 2013-03-07 12:54:29 -0800 | [diff] [blame] | 540 | futility/futility.c \ |
Bill Richardson | 20807b6 | 2013-04-09 10:15:26 -0700 | [diff] [blame] | 541 | futility/cmd_dump_fmap.c \ |
Bill Richardson | cf6e78d | 2014-08-27 15:50:25 -0700 | [diff] [blame] | 542 | futility/cmd_gbb_utility.c \ |
| 543 | futility/misc.c |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 544 | |
Bill Richardson | 6db8c75 | 2013-04-05 13:30:43 -0700 | [diff] [blame] | 545 | FUTIL_SRCS = \ |
| 546 | $(FUTIL_STATIC_SRCS) \ |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 547 | futility/cmd_dev_sign_file.c \ |
| 548 | futility/cmd_dump_kernel_config.c \ |
Bill Richardson | 2e25e81 | 2014-09-03 11:34:27 -0700 | [diff] [blame] | 549 | futility/cmd_load_fmap.c \ |
Bill Richardson | f4f395e | 2014-10-22 17:42:20 -0700 | [diff] [blame] | 550 | futility/cmd_pcr.c \ |
Bill Richardson | f318ee2 | 2014-09-23 14:30:30 -0700 | [diff] [blame] | 551 | futility/cmd_show.c \ |
| 552 | futility/cmd_sign.c \ |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 553 | futility/cmd_vbutil_firmware.c \ |
| 554 | futility/cmd_vbutil_kernel.c \ |
Bill Richardson | f1dba02 | 2014-10-01 14:10:45 -0700 | [diff] [blame] | 555 | futility/cmd_vbutil_kernel0.c \ |
Bill Richardson | b84b81d | 2014-07-14 14:48:31 -0700 | [diff] [blame] | 556 | futility/cmd_vbutil_key.c \ |
Randall Spangler | b8ff397 | 2014-08-27 13:34:35 -0700 | [diff] [blame] | 557 | futility/cmd_vbutil_keyblock.c \ |
Bill Richardson | cf6e78d | 2014-08-27 15:50:25 -0700 | [diff] [blame] | 558 | futility/cmd_verify_kernel.c \ |
Bill Richardson | f318ee2 | 2014-09-23 14:30:30 -0700 | [diff] [blame] | 559 | futility/traversal.c \ |
| 560 | futility/vb1_helper.c |
Bill Richardson | 6db8c75 | 2013-04-05 13:30:43 -0700 | [diff] [blame] | 561 | |
Randall Spangler | 028f468 | 2014-08-19 14:42:08 -0700 | [diff] [blame] | 562 | ifneq (${VBOOT2},) |
| 563 | FUTIL_SRCS += \ |
| 564 | futility/cmd_vb2_verify_fw.c |
| 565 | endif |
| 566 | |
Alex Deymo | e08ee28 | 2014-08-29 01:07:48 -0700 | [diff] [blame] | 567 | # List of commands built in futility and futility_s. |
| 568 | FUTIL_STATIC_CMD_LIST = ${BUILD}/gen/futility_static_cmds.c |
| 569 | FUTIL_CMD_LIST = ${BUILD}/gen/futility_cmds.c |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 570 | |
Bill Richardson | 91852e7 | 2014-11-28 12:28:04 -0800 | [diff] [blame] | 571 | # Workaround for TODO(crbug.com/437107). |
| 572 | FUTIL_STATIC_WORKAROUND_SRCS = firmware/stub/vboot_api_stub_static_sf.c |
| 573 | |
Alex Deymo | e08ee28 | 2014-08-29 01:07:48 -0700 | [diff] [blame] | 574 | FUTIL_STATIC_OBJS = ${FUTIL_STATIC_SRCS:%.c=${BUILD}/%.o} \ |
Bill Richardson | 91852e7 | 2014-11-28 12:28:04 -0800 | [diff] [blame] | 575 | ${FUTIL_STATIC_WORKAROUND_SRCS:%.c=${BUILD}/%.o} \ |
Alex Deymo | e08ee28 | 2014-08-29 01:07:48 -0700 | [diff] [blame] | 576 | ${FUTIL_STATIC_CMD_LIST:%.c=%.o} |
| 577 | FUTIL_OBJS = ${FUTIL_SRCS:%.c=${BUILD}/%.o} ${FUTIL_CMD_LIST:%.c=%.o} |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 578 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 579 | ALL_OBJS += ${FUTIL_OBJS} |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 580 | |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 581 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 582 | # Library of handy test functions. |
| 583 | TESTLIB = ${BUILD}/tests/test.a |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 584 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 585 | TESTLIB_SRCS = \ |
| 586 | tests/test_common.c \ |
| 587 | tests/timer_utils.c \ |
| 588 | tests/crc32_test.c |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 589 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 590 | TESTLIB_OBJS = ${TESTLIB_SRCS:%.c=${BUILD}/%.o} |
Bill Richardson | 80872db | 2014-10-03 10:26:11 -0700 | [diff] [blame] | 591 | TEST_OBJS += ${TESTLIB_OBJS} |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 592 | |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 593 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 594 | # And some compiled tests. |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 595 | TEST_NAMES = \ |
Bill Richardson | 339f7e0 | 2013-04-05 09:49:24 -0700 | [diff] [blame] | 596 | tests/cgptlib_test \ |
| 597 | tests/rollback_index2_tests \ |
| 598 | tests/rollback_index3_tests \ |
| 599 | tests/rsa_padding_test \ |
| 600 | tests/rsa_utility_tests \ |
| 601 | tests/rsa_verify_benchmark \ |
| 602 | tests/sha_benchmark \ |
| 603 | tests/sha_tests \ |
| 604 | tests/stateful_util_tests \ |
| 605 | tests/tlcl_tests \ |
| 606 | tests/tpm_bootmode_tests \ |
| 607 | tests/utility_string_tests \ |
| 608 | tests/utility_tests \ |
| 609 | tests/vboot_api_init_tests \ |
| 610 | tests/vboot_api_devmode_tests \ |
| 611 | tests/vboot_api_firmware_tests \ |
| 612 | tests/vboot_api_kernel_tests \ |
| 613 | tests/vboot_api_kernel2_tests \ |
| 614 | tests/vboot_api_kernel3_tests \ |
| 615 | tests/vboot_api_kernel4_tests \ |
| 616 | tests/vboot_audio_tests \ |
| 617 | tests/vboot_common_tests \ |
| 618 | tests/vboot_common2_tests \ |
| 619 | tests/vboot_common3_tests \ |
| 620 | tests/vboot_display_tests \ |
| 621 | tests/vboot_firmware_tests \ |
| 622 | tests/vboot_kernel_tests \ |
| 623 | tests/vboot_nvstorage_test \ |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 624 | tests/futility/binary_editor \ |
Bill Richardson | 339f7e0 | 2013-04-05 09:49:24 -0700 | [diff] [blame] | 625 | tests/futility/test_not_really |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 626 | |
Simon Glass | 527ba81 | 2013-07-25 08:48:47 -0600 | [diff] [blame] | 627 | ifdef REGION_READ |
| 628 | TEST_NAMES += tests/vboot_region_tests |
| 629 | endif |
| 630 | |
Randall Spangler | aaaff86 | 2014-12-01 15:40:08 -0800 | [diff] [blame] | 631 | TEST20_NAMES = \ |
Randall Spangler | a7ab8b5 | 2014-06-10 17:05:08 -0700 | [diff] [blame] | 632 | tests/vb2_api_tests \ |
Randall Spangler | efa37b8 | 2014-11-12 16:20:50 -0800 | [diff] [blame] | 633 | tests/vb2_api2_tests \ |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 634 | tests/vb2_common_tests \ |
Randall Spangler | 7141d73 | 2014-05-15 15:34:54 -0700 | [diff] [blame] | 635 | tests/vb2_common2_tests \ |
| 636 | tests/vb2_common3_tests \ |
Randall Spangler | 42a8500 | 2014-11-25 10:52:59 -0800 | [diff] [blame] | 637 | tests/vb2_host_fw_preamble_tests \ |
Randall Spangler | 59c2920 | 2014-11-17 14:24:59 -0800 | [diff] [blame] | 638 | tests/vb2_host_key_tests \ |
Randall Spangler | 9328bbf | 2014-11-24 12:55:29 -0800 | [diff] [blame] | 639 | tests/vb2_host_keyblock_tests \ |
Randall Spangler | 02e11b3 | 2014-11-19 12:48:36 -0800 | [diff] [blame] | 640 | tests/vb2_host_misc_tests \ |
Randall Spangler | c644a8c | 2014-11-21 11:04:36 -0800 | [diff] [blame] | 641 | tests/vb2_host_sig_tests \ |
Randall Spangler | 3333e57 | 2014-05-14 11:37:52 -0700 | [diff] [blame] | 642 | tests/vb2_misc_tests \ |
Randall Spangler | 1803068 | 2014-06-11 16:01:08 -0700 | [diff] [blame] | 643 | tests/vb2_misc2_tests \ |
Randall Spangler | 837b408 | 2014-11-10 13:40:52 -0800 | [diff] [blame] | 644 | tests/vb2_misc3_tests \ |
Randall Spangler | 3333e57 | 2014-05-14 11:37:52 -0700 | [diff] [blame] | 645 | tests/vb2_nvstorage_tests \ |
Randall Spangler | e166d04 | 2014-05-13 09:24:52 -0700 | [diff] [blame] | 646 | tests/vb2_rsa_padding_tests \ |
| 647 | tests/vb2_rsa_utility_tests \ |
Randall Spangler | 3333e57 | 2014-05-14 11:37:52 -0700 | [diff] [blame] | 648 | tests/vb2_secdata_tests \ |
Randall Spangler | e166d04 | 2014-05-13 09:24:52 -0700 | [diff] [blame] | 649 | tests/vb2_sha_tests \ |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 650 | |
Randall Spangler | aaaff86 | 2014-12-01 15:40:08 -0800 | [diff] [blame] | 651 | ifneq (${VBOOT2},) |
| 652 | TEST_NAMES += ${TEST20_NAMES} |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 653 | endif |
| 654 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 655 | # And a few more... |
Bill Richardson | 339f7e0 | 2013-04-05 09:49:24 -0700 | [diff] [blame] | 656 | TLCL_TEST_NAMES = \ |
| 657 | tests/tpm_lite/tpmtest_earlyextend \ |
| 658 | tests/tpm_lite/tpmtest_earlynvram \ |
| 659 | tests/tpm_lite/tpmtest_earlynvram2 \ |
| 660 | tests/tpm_lite/tpmtest_enable \ |
| 661 | tests/tpm_lite/tpmtest_fastenable \ |
| 662 | tests/tpm_lite/tpmtest_globallock \ |
| 663 | tests/tpm_lite/tpmtest_redefine_unowned \ |
| 664 | tests/tpm_lite/tpmtest_spaceperm \ |
| 665 | tests/tpm_lite/tpmtest_testsetup \ |
| 666 | tests/tpm_lite/tpmtest_timing \ |
| 667 | tests/tpm_lite/tpmtest_writelimit |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 668 | |
| 669 | TEST_NAMES += ${TLCL_TEST_NAMES} |
| 670 | |
Bill Richardson | 339f7e0 | 2013-04-05 09:49:24 -0700 | [diff] [blame] | 671 | # Finally |
| 672 | TEST_BINS = $(addprefix ${BUILD}/,${TEST_NAMES}) |
Bill Richardson | 80872db | 2014-10-03 10:26:11 -0700 | [diff] [blame] | 673 | TEST_OBJS += $(addsuffix .o,${TEST_BINS}) |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 674 | |
Randall Spangler | aaaff86 | 2014-12-01 15:40:08 -0800 | [diff] [blame] | 675 | TEST20_BINS = $(addprefix ${BUILD}/,${TEST20_NAMES}) |
| 676 | |
Randall Spangler | e061a25 | 2013-01-22 15:34:07 -0800 | [diff] [blame] | 677 | # Directory containing test keys |
| 678 | TEST_KEYS = ${SRC_RUN}/tests/testkeys |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 679 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 680 | |
| 681 | ############################################################################## |
| 682 | # Finally, some targets. High-level ones first. |
| 683 | |
| 684 | # Create output directories if necessary. Do this via explicit shell commands |
| 685 | # so it happens before trying to generate/include dependencies. |
| 686 | SUBDIRS := firmware host cgpt utility futility tests tests/tpm_lite |
| 687 | _dir_create := $(foreach d, \ |
| 688 | $(shell find ${SUBDIRS} -name '*.c' -exec dirname {} \; | sort -u), \ |
| 689 | $(shell [ -d ${BUILD}/${d} ] || mkdir -p ${BUILD}/${d})) |
| 690 | |
| 691 | |
| 692 | # Default target. |
| 693 | .PHONY: all |
Randall Spangler | aaaff86 | 2014-12-01 15:40:08 -0800 | [diff] [blame] | 694 | all: fwlib \ |
Randall Spangler | a5b69b0 | 2014-12-02 13:41:29 -0800 | [diff] [blame] | 695 | $(if ${VBOOT2},fwlib2 fwlib21) \ |
Randall Spangler | aaaff86 | 2014-12-01 15:40:08 -0800 | [diff] [blame] | 696 | $(if ${FIRMWARE_ARCH},,host_stuff) \ |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 697 | $(if ${COV},coverage) |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 698 | |
| 699 | # Host targets |
| 700 | .PHONY: host_stuff |
Randall Spangler | a5b69b0 | 2014-12-02 13:41:29 -0800 | [diff] [blame] | 701 | host_stuff: utillib hostlib cgpt utils futil tests $(if ${VBOOT2},utillib21) |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 702 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 703 | .PHONY: clean |
| 704 | clean: |
| 705 | ${Q}/bin/rm -rf ${BUILD} |
| 706 | |
| 707 | .PHONY: install |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 708 | install: cgpt_install utils_install signing_install futil_install |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 709 | |
Bill Richardson | 3e3790d | 2014-07-14 15:05:54 -0700 | [diff] [blame] | 710 | .PHONY: install_for_test |
| 711 | install_for_test: override DESTDIR = ${TEST_INSTALL_DIR} |
| 712 | install_for_test: install |
| 713 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 714 | # Don't delete intermediate object files |
| 715 | .SECONDARY: |
| 716 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 717 | # ---------------------------------------------------------------------------- |
| 718 | # Firmware library |
| 719 | |
| 720 | # TPM-specific flags. These depend on the particular TPM we're targeting for. |
| 721 | # They are needed here only for compiling parts of the firmware code into |
| 722 | # user-level tests. |
| 723 | |
| 724 | # TPM_BLOCKING_CONTINUESELFTEST is defined if TPM_ContinueSelfTest blocks until |
| 725 | # the self test has completed. |
| 726 | |
Randall Spangler | 45cc0f2 | 2013-01-25 09:34:26 -0800 | [diff] [blame] | 727 | ${FWLIB_OBJS}: CFLAGS += -DTPM_BLOCKING_CONTINUESELFTEST |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 728 | |
| 729 | # TPM_MANUAL_SELFTEST is defined if the self test must be started manually |
| 730 | # (with a call to TPM_ContinueSelfTest) instead of starting automatically at |
| 731 | # power on. |
| 732 | # |
| 733 | # We sincerely hope that TPM_BLOCKING_CONTINUESELFTEST and TPM_MANUAL_SELFTEST |
| 734 | # are not both defined at the same time. (See comment in code.) |
| 735 | |
| 736 | # CFLAGS += -DTPM_MANUAL_SELFTEST |
| 737 | |
| 738 | ifeq (${FIRMWARE_ARCH},i386) |
| 739 | # Unrolling loops in cryptolib makes it faster |
Randall Spangler | 45cc0f2 | 2013-01-25 09:34:26 -0800 | [diff] [blame] | 740 | ${FWLIB_OBJS}: CFLAGS += -DUNROLL_LOOPS |
Randall Spangler | aaaff86 | 2014-12-01 15:40:08 -0800 | [diff] [blame] | 741 | ${FWLIB20_OBJS}: CFLAGS += -DUNROLL_LOOPS |
Randall Spangler | a5b69b0 | 2014-12-02 13:41:29 -0800 | [diff] [blame] | 742 | ${FWLIB21_OBJS}: CFLAGS += -DUNROLL_LOOPS |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 743 | |
| 744 | # Workaround for coreboot on x86, which will power off asynchronously |
| 745 | # without giving us a chance to react. This is not an example of the Right |
| 746 | # Way to do things. See chrome-os-partner:7689, and the commit message |
| 747 | # that made this change. |
Randall Spangler | 45cc0f2 | 2013-01-25 09:34:26 -0800 | [diff] [blame] | 748 | ${FWLIB_OBJS}: CFLAGS += -DSAVE_LOCALE_IMMEDIATELY |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 749 | |
| 750 | # On x86 we don't actually read the GBB data into RAM until it is needed. |
| 751 | # Therefore it makes sense to cache it rather than reading it each time. |
| 752 | # Enable this feature. |
Randall Spangler | 45cc0f2 | 2013-01-25 09:34:26 -0800 | [diff] [blame] | 753 | ${FWLIB_OBJS}: CFLAGS += -DCOPY_BMP_DATA |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 754 | endif |
| 755 | |
Simon Glass | 527ba81 | 2013-07-25 08:48:47 -0600 | [diff] [blame] | 756 | ifdef REGION_READ |
| 757 | ${FWLIB_OBJS}: CFLAGS += -DREGION_READ |
| 758 | endif |
| 759 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 760 | ifeq (${FIRMWARE_ARCH},) |
| 761 | # Disable rollback TPM when compiling locally, since otherwise |
| 762 | # load_kernel_test attempts to talk to the TPM. |
Randall Spangler | 45cc0f2 | 2013-01-25 09:34:26 -0800 | [diff] [blame] | 763 | ${FWLIB_OBJS}: CFLAGS += -DDISABLE_ROLLBACK_TPM |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 764 | endif |
| 765 | |
Bill Richardson | a130e0b | 2013-04-04 18:16:39 -0700 | [diff] [blame] | 766 | # Linktest ensures firmware lib doesn't rely on outside libraries |
| 767 | ${BUILD}/firmware/linktest/main_vbinit: ${VBINIT_OBJS} |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 768 | ${BUILD}/firmware/linktest/main_vbinit: OBJS = ${VBINIT_OBJS} |
Bill Richardson | 80872db | 2014-10-03 10:26:11 -0700 | [diff] [blame] | 769 | TEST_OBJS += ${BUILD}/firmware/linktest/main_vbinit.o |
Bill Richardson | a130e0b | 2013-04-04 18:16:39 -0700 | [diff] [blame] | 770 | ${BUILD}/firmware/linktest/main_vbsf: ${VBSF_OBJS} |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 771 | ${BUILD}/firmware/linktest/main_vbsf: OBJS = ${VBSF_OBJS} |
Bill Richardson | 80872db | 2014-10-03 10:26:11 -0700 | [diff] [blame] | 772 | TEST_OBJS += ${BUILD}/firmware/linktest/main_vbsf.o |
Bill Richardson | a130e0b | 2013-04-04 18:16:39 -0700 | [diff] [blame] | 773 | ${BUILD}/firmware/linktest/main: ${FWLIB} |
| 774 | ${BUILD}/firmware/linktest/main: LIBS = ${FWLIB} |
Bill Richardson | 80872db | 2014-10-03 10:26:11 -0700 | [diff] [blame] | 775 | TEST_OBJS += ${BUILD}/firmware/linktest/main.o |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 776 | |
Bill Richardson | d2d08b2 | 2014-07-08 16:31:40 -0700 | [diff] [blame] | 777 | .PHONY: fwlinktest |
| 778 | fwlinktest: \ |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 779 | ${BUILD}/firmware/linktest/main_vbinit \ |
| 780 | ${BUILD}/firmware/linktest/main_vbsf \ |
| 781 | ${BUILD}/firmware/linktest/main |
| 782 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 783 | .PHONY: fwlib |
Bill Richardson | a130e0b | 2013-04-04 18:16:39 -0700 | [diff] [blame] | 784 | fwlib: $(if ${FIRMWARE_ARCH},${FWLIB},fwlinktest) |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 785 | |
| 786 | ${FWLIB}: ${FWLIB_OBJS} |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 787 | @$(PRINTF) " RM $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 788 | ${Q}rm -f $@ |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 789 | @$(PRINTF) " AR $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 790 | ${Q}ar qc $@ $^ |
| 791 | |
Randall Spangler | a5b69b0 | 2014-12-02 13:41:29 -0800 | [diff] [blame] | 792 | .PHONY: fwlib2 |
| 793 | fwlib2: ${FWLIB20} |
| 794 | |
Randall Spangler | aaaff86 | 2014-12-01 15:40:08 -0800 | [diff] [blame] | 795 | ${FWLIB20}: ${FWLIB20_OBJS} |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 796 | @$(PRINTF) " RM $(subst ${BUILD}/,,$@)\n" |
| 797 | ${Q}rm -f $@ |
| 798 | @$(PRINTF) " AR $(subst ${BUILD}/,,$@)\n" |
| 799 | ${Q}ar qc $@ $^ |
| 800 | |
Randall Spangler | a5b69b0 | 2014-12-02 13:41:29 -0800 | [diff] [blame] | 801 | .PHONY: fwlib21 |
| 802 | fwlib21: ${FWLIB21} |
| 803 | |
| 804 | ${FWLIB21}: ${FWLIB21_OBJS} |
| 805 | @$(PRINTF) " RM $(subst ${BUILD}/,,$@)\n" |
| 806 | ${Q}rm -f $@ |
| 807 | @$(PRINTF) " AR $(subst ${BUILD}/,,$@)\n" |
| 808 | ${Q}ar qc $@ $^ |
| 809 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 810 | # ---------------------------------------------------------------------------- |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 811 | # Host library(s) |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 812 | |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 813 | # Link tests for local utilities |
| 814 | ${BUILD}/host/linktest/main: ${UTILLIB} |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 815 | ${BUILD}/host/linktest/main: LIBS = ${UTILLIB} |
Bill Richardson | 80872db | 2014-10-03 10:26:11 -0700 | [diff] [blame] | 816 | TEST_OBJS += ${BUILD}/host/linktest/main.o |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 817 | |
| 818 | .PHONY: utillib |
| 819 | utillib: ${UTILLIB} \ |
| 820 | ${BUILD}/host/linktest/main |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 821 | |
| 822 | # TODO: better way to make .a than duplicating this recipe each time? |
Randall Spangler | aaaff86 | 2014-12-01 15:40:08 -0800 | [diff] [blame] | 823 | ${UTILLIB}: ${UTILLIB_OBJS} ${FWLIB_OBJS} |
| 824 | @$(PRINTF) " RM $(subst ${BUILD}/,,$@)\n" |
| 825 | ${Q}rm -f $@ |
| 826 | @$(PRINTF) " AR $(subst ${BUILD}/,,$@)\n" |
| 827 | ${Q}ar qc $@ $^ |
| 828 | |
Randall Spangler | a5b69b0 | 2014-12-02 13:41:29 -0800 | [diff] [blame] | 829 | .PHONY: utillib21 |
| 830 | utillib21: ${UTILLIB21} |
Randall Spangler | aaaff86 | 2014-12-01 15:40:08 -0800 | [diff] [blame] | 831 | |
Randall Spangler | a5b69b0 | 2014-12-02 13:41:29 -0800 | [diff] [blame] | 832 | ${UTILLIB21}: INCLUDES += -Ihost/lib21/include |
| 833 | |
| 834 | # TODO: right now, firmware lib 2.1 isn't a complete standalone copy |
| 835 | ${UTILLIB21}: ${UTILLIB21_OBJS} ${FWLIB20_OBJS} ${FWLIB21_OBJS} |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 836 | @$(PRINTF) " RM $(subst ${BUILD}/,,$@)\n" |
| 837 | ${Q}rm -f $@ |
| 838 | @$(PRINTF) " AR $(subst ${BUILD}/,,$@)\n" |
| 839 | ${Q}ar qc $@ $^ |
| 840 | |
| 841 | |
| 842 | # Link tests for external repos |
| 843 | ${BUILD}/host/linktest/extern: ${HOSTLIB} |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 844 | ${BUILD}/host/linktest/extern: LIBS = ${HOSTLIB} |
| 845 | ${BUILD}/host/linktest/extern: LDLIBS += -static |
Bill Richardson | 80872db | 2014-10-03 10:26:11 -0700 | [diff] [blame] | 846 | TEST_OBJS += ${BUILD}/host/linktest/extern.o |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 847 | |
| 848 | .PHONY: hostlib |
| 849 | hostlib: ${HOSTLIB} \ |
| 850 | ${BUILD}/host/linktest/extern |
| 851 | |
| 852 | # TODO: better way to make .a than duplicating this recipe each time? |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 853 | ${HOSTLIB}: ${HOSTLIB_OBJS} |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 854 | @$(PRINTF) " RM $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 855 | ${Q}rm -f $@ |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 856 | @$(PRINTF) " AR $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 857 | ${Q}ar qc $@ $^ |
| 858 | |
Bill Richardson | 81a0b3d | 2013-02-28 13:53:09 -0800 | [diff] [blame] | 859 | |
| 860 | # Ugh. This is a very cut-down version of HOSTLIB just for the installer. |
| 861 | .PHONY: tinyhostlib |
| 862 | tinyhostlib: ${TINYHOSTLIB} |
| 863 | ${Q}cp -f ${TINYHOSTLIB} ${HOSTLIB} |
| 864 | |
| 865 | ${TINYHOSTLIB}: ${TINYHOSTLIB_OBJS} |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 866 | @$(PRINTF) " RM $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | 81a0b3d | 2013-02-28 13:53:09 -0800 | [diff] [blame] | 867 | ${Q}rm -f $@ |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 868 | @$(PRINTF) " AR $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | 81a0b3d | 2013-02-28 13:53:09 -0800 | [diff] [blame] | 869 | ${Q}ar qc $@ $^ |
| 870 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 871 | # ---------------------------------------------------------------------------- |
| 872 | # CGPT library and utility |
| 873 | |
| 874 | .PHONY: cgpt |
| 875 | cgpt: ${CGPT} |
| 876 | |
| 877 | ${CGPT}: LDFLAGS += -static |
| 878 | ${CGPT}: LDLIBS += -luuid |
| 879 | |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 880 | ${CGPT}: ${CGPT_OBJS} ${UTILLIB} |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 881 | @$(PRINTF) " LDcgpt $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | 6db8c75 | 2013-04-05 13:30:43 -0700 | [diff] [blame] | 882 | ${Q}${LD} -o ${CGPT} ${CFLAGS} ${LDFLAGS} $^ ${LDLIBS} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 883 | |
| 884 | .PHONY: cgpt_install |
| 885 | cgpt_install: ${CGPT} |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 886 | @$(PRINTF) " INSTALL CGPT\n" |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 887 | ${Q}mkdir -p ${UB_DIR} |
| 888 | ${Q}${INSTALL} -t ${UB_DIR} $^ |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 889 | |
| 890 | # ---------------------------------------------------------------------------- |
| 891 | # Utilities |
| 892 | |
| 893 | # These have their own headers too. |
Bill Richardson | 0f6679e | 2014-07-10 15:49:52 -0700 | [diff] [blame] | 894 | ${BUILD}/utility/%: INCLUDES += -Iutility/include |
| 895 | |
| 896 | ${UTIL_BINS} ${UTIL_BINS_STATIC}: ${UTILLIB} |
| 897 | ${UTIL_BINS} ${UTIL_BINS_STATIC}: LIBS = ${UTILLIB} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 898 | |
| 899 | # Utilities for auto-update toolkits must be statically linked. |
| 900 | ${UTIL_BINS_STATIC}: LDFLAGS += -static |
| 901 | |
Bill Richardson | a130e0b | 2013-04-04 18:16:39 -0700 | [diff] [blame] | 902 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 903 | .PHONY: utils |
Bill Richardson | c7c6e5d | 2013-02-28 10:10:29 -0800 | [diff] [blame] | 904 | utils: ${UTIL_BINS} ${UTIL_SCRIPTS} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 905 | ${Q}cp -f ${UTIL_SCRIPTS} ${BUILD}/utility |
| 906 | ${Q}chmod a+rx $(patsubst %,${BUILD}/%,${UTIL_SCRIPTS}) |
| 907 | |
| 908 | .PHONY: utils_install |
Bill Richardson | c7c6e5d | 2013-02-28 10:10:29 -0800 | [diff] [blame] | 909 | utils_install: ${UTIL_BINS} ${UTIL_SCRIPTS} |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 910 | @$(PRINTF) " INSTALL UTILS\n" |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 911 | ${Q}mkdir -p ${UB_DIR} |
| 912 | ${Q}${INSTALL} -t ${UB_DIR} ${UTIL_BINS} ${UTIL_SCRIPTS} |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 913 | |
| 914 | # And some signing stuff for the target |
| 915 | .PHONY: signing_install |
| 916 | signing_install: ${SIGNING_SCRIPTS} ${SIGNING_SCRIPTS_DEV} ${SIGNING_COMMON} |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 917 | @$(PRINTF) " INSTALL SIGNING\n" |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 918 | ${Q}mkdir -p ${UB_DIR} ${VB_DIR} |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 919 | ${Q}${INSTALL} -t ${UB_DIR} ${SIGNING_SCRIPTS} |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 920 | ${Q}${INSTALL} -t ${VB_DIR} ${SIGNING_SCRIPTS_DEV} |
| 921 | ${Q}${INSTALL} -t ${VB_DIR} -m 'u=rw,go=r,a-s' ${SIGNING_COMMON} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 922 | |
| 923 | # ---------------------------------------------------------------------------- |
| 924 | # new Firmware Utility |
| 925 | |
| 926 | .PHONY: futil |
Bill Richardson | 6db8c75 | 2013-04-05 13:30:43 -0700 | [diff] [blame] | 927 | futil: ${FUTIL_STATIC_BIN} ${FUTIL_BIN} |
| 928 | |
Randall Spangler | aaaff86 | 2014-12-01 15:40:08 -0800 | [diff] [blame] | 929 | ${FUTIL_STATIC_BIN}: ${FUTIL_STATIC_OBJS} ${UTILLIB} \ |
Randall Spangler | a5b69b0 | 2014-12-02 13:41:29 -0800 | [diff] [blame] | 930 | $(if ${VBOOT2},${UTILLIB21}) |
Bill Richardson | 6db8c75 | 2013-04-05 13:30:43 -0700 | [diff] [blame] | 931 | @$(PRINTF) " LD $(subst ${BUILD}/,,$@)\n" |
| 932 | ${Q}${LD} -o $@ ${CFLAGS} ${LDFLAGS} -static $^ ${LDLIBS} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 933 | |
Bill Richardson | b84b81d | 2014-07-14 14:48:31 -0700 | [diff] [blame] | 934 | ${FUTIL_BIN}: LDLIBS += ${CRYPTO_LIBS} |
Randall Spangler | a5b69b0 | 2014-12-02 13:41:29 -0800 | [diff] [blame] | 935 | ${FUTIL_BIN}: ${FUTIL_OBJS} ${UTILLIB} $(if ${VBOOT2},${UTILLIB21}) |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 936 | @$(PRINTF) " LD $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | 6db8c75 | 2013-04-05 13:30:43 -0700 | [diff] [blame] | 937 | ${Q}${LD} -o $@ ${CFLAGS} ${LDFLAGS} $^ ${LDLIBS} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 938 | |
| 939 | .PHONY: futil_install |
Bill Richardson | efa8756 | 2014-09-11 10:41:51 -0700 | [diff] [blame] | 940 | futil_install: ${FUTIL_BIN} ${FUTIL_STATIC_BIN} |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 941 | @$(PRINTF) " INSTALL futility\n" |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 942 | ${Q}mkdir -p ${UB_DIR} |
| 943 | ${Q}${INSTALL} -t ${UB_DIR} ${FUTIL_BIN} ${FUTIL_STATIC_BIN} |
Bill Richardson | a1d9fe6 | 2014-09-05 12:52:27 -0700 | [diff] [blame] | 944 | ${Q}for prog in ${FUTIL_SYMLINKS}; do \ |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 945 | ln -sf futility "${UB_DIR}/$$prog"; done |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 946 | |
| 947 | # ---------------------------------------------------------------------------- |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 948 | # Utility to generate TLCL structure definition header file. |
| 949 | |
| 950 | ${BUILD}/utility/tlcl_generator: CFLAGS += -fpack-struct |
| 951 | |
| 952 | STRUCTURES_TMP=${BUILD}/tlcl_structures.tmp |
| 953 | STRUCTURES_SRC=firmware/lib/tpm_lite/include/tlcl_structures.h |
| 954 | |
| 955 | .PHONY: update_tlcl_structures |
| 956 | update_tlcl_structures: ${BUILD}/utility/tlcl_generator |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 957 | @$(PRINTF) " Rebuilding TLCL structures\n" |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 958 | ${Q}${BUILD}/utility/tlcl_generator > ${STRUCTURES_TMP} |
| 959 | ${Q}cmp -s ${STRUCTURES_TMP} ${STRUCTURES_SRC} || \ |
| 960 | ( echo "%% Updating structures.h %%" && \ |
| 961 | cp ${STRUCTURES_TMP} ${STRUCTURES_SRC} ) |
| 962 | |
| 963 | # ---------------------------------------------------------------------------- |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 964 | # Tests |
| 965 | |
| 966 | .PHONY: tests |
| 967 | tests: ${TEST_BINS} |
| 968 | |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 969 | ${TEST_BINS}: ${UTILLIB} ${TESTLIB} |
Bill Richardson | 339f7e0 | 2013-04-05 09:49:24 -0700 | [diff] [blame] | 970 | ${TEST_BINS}: INCLUDES += -Itests |
Randall Spangler | efa37b8 | 2014-11-12 16:20:50 -0800 | [diff] [blame] | 971 | ${TEST_BINS}: LIBS = ${TESTLIB} ${UTILLIB} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 972 | |
Randall Spangler | a5b69b0 | 2014-12-02 13:41:29 -0800 | [diff] [blame] | 973 | ${TEST20_BINS}: ${UTILLIB21} |
| 974 | ${TEST20_BINS}: INCLUDES += -Ihost/lib21/include |
| 975 | ${TEST20_BINS}: LIBS += ${UTILLIB21} |
Randall Spangler | aaaff86 | 2014-12-01 15:40:08 -0800 | [diff] [blame] | 976 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 977 | ${TESTLIB}: ${TESTLIB_OBJS} |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 978 | @$(PRINTF) " RM $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 979 | ${Q}rm -f $@ |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 980 | @$(PRINTF) " AR $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 981 | ${Q}ar qc $@ $^ |
| 982 | |
| 983 | |
| 984 | # ---------------------------------------------------------------------------- |
| 985 | # Generic build rules. LIBS and OBJS can be overridden to tweak the generic |
| 986 | # rules for specific targets. |
| 987 | |
| 988 | ${BUILD}/%: ${BUILD}/%.o ${OBJS} ${LIBS} |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 989 | @$(PRINTF) " LD $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | 6db8c75 | 2013-04-05 13:30:43 -0700 | [diff] [blame] | 990 | ${Q}${LD} -o $@ ${CFLAGS} ${LDFLAGS} $< ${OBJS} ${LIBS} ${LDLIBS} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 991 | |
| 992 | ${BUILD}/%.o: %.c |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 993 | @$(PRINTF) " CC $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 994 | ${Q}${CC} ${CFLAGS} ${INCLUDES} -c -o $@ $< |
| 995 | |
Alex Deymo | e08ee28 | 2014-08-29 01:07:48 -0700 | [diff] [blame] | 996 | ${BUILD}/%.o: ${BUILD}/%.c |
| 997 | @$(PRINTF) " CC $(subst ${BUILD}/,,$@)\n" |
| 998 | ${Q}${CC} ${CFLAGS} ${INCLUDES} -c -o $@ $< |
| 999 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1000 | # Rules to recompile a single source file for library and test |
| 1001 | # TODO: is there a tidier way to do this? |
| 1002 | ${BUILD}/%_for_lib.o: CFLAGS += -DFOR_LIBRARY |
| 1003 | ${BUILD}/%_for_lib.o: %.c |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 1004 | @$(PRINTF) " CC-for-lib $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1005 | ${Q}${CC} ${CFLAGS} ${INCLUDES} -c -o $@ $< |
| 1006 | |
| 1007 | ${BUILD}/%_for_test.o: CFLAGS += -DFOR_TEST |
| 1008 | ${BUILD}/%_for_test.o: %.c |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 1009 | @$(PRINTF) " CC-for-test $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1010 | ${Q}${CC} ${CFLAGS} ${INCLUDES} -c -o $@ $< |
| 1011 | |
| 1012 | # TODO: C++ files don't belong in vboot reference at all. Convert to C. |
| 1013 | ${BUILD}/%.o: %.cc |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 1014 | @$(PRINTF) " CXX $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1015 | ${Q}${CXX} ${CFLAGS} ${INCLUDES} -c -o $@ $< |
| 1016 | |
| 1017 | # ---------------------------------------------------------------------------- |
| 1018 | # Here are the special tweaks to the generic rules. |
| 1019 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1020 | # Some utilities need external crypto functions |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 1021 | CRYPTO_LIBS := $(shell ${PKG_CONFIG} --libs libcrypto) |
| 1022 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1023 | ${BUILD}/utility/dumpRSAPublicKey: LDLIBS += ${CRYPTO_LIBS} |
| 1024 | ${BUILD}/utility/pad_digest_utility: LDLIBS += ${CRYPTO_LIBS} |
| 1025 | ${BUILD}/utility/signature_digest_utility: LDLIBS += ${CRYPTO_LIBS} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1026 | |
| 1027 | ${BUILD}/host/linktest/main: LDLIBS += ${CRYPTO_LIBS} |
Randall Spangler | c644a8c | 2014-11-21 11:04:36 -0800 | [diff] [blame] | 1028 | ${BUILD}/tests/vb2_api2_tests: LDLIBS += ${CRYPTO_LIBS} |
Randall Spangler | fb9a216 | 2014-11-20 11:27:38 -0800 | [diff] [blame] | 1029 | ${BUILD}/tests/vb2_common_tests: LDLIBS += ${CRYPTO_LIBS} |
Randall Spangler | 7141d73 | 2014-05-15 15:34:54 -0700 | [diff] [blame] | 1030 | ${BUILD}/tests/vb2_common2_tests: LDLIBS += ${CRYPTO_LIBS} |
| 1031 | ${BUILD}/tests/vb2_common3_tests: LDLIBS += ${CRYPTO_LIBS} |
Randall Spangler | 42a8500 | 2014-11-25 10:52:59 -0800 | [diff] [blame] | 1032 | ${BUILD}/tests/vb2_host_fw_preamble_tests: LDLIBS += ${CRYPTO_LIBS} |
Randall Spangler | 59c2920 | 2014-11-17 14:24:59 -0800 | [diff] [blame] | 1033 | ${BUILD}/tests/vb2_host_key_tests: LDLIBS += ${CRYPTO_LIBS} |
Randall Spangler | 9328bbf | 2014-11-24 12:55:29 -0800 | [diff] [blame] | 1034 | ${BUILD}/tests/vb2_host_keyblock_tests: LDLIBS += ${CRYPTO_LIBS} |
Randall Spangler | c644a8c | 2014-11-21 11:04:36 -0800 | [diff] [blame] | 1035 | ${BUILD}/tests/vb2_host_sig_tests: LDLIBS += ${CRYPTO_LIBS} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1036 | ${BUILD}/tests/vboot_common2_tests: LDLIBS += ${CRYPTO_LIBS} |
| 1037 | ${BUILD}/tests/vboot_common3_tests: LDLIBS += ${CRYPTO_LIBS} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1038 | |
| 1039 | ${BUILD}/utility/bmpblk_utility: LD = ${CXX} |
| 1040 | ${BUILD}/utility/bmpblk_utility: LDLIBS = -llzma -lyaml |
| 1041 | |
| 1042 | BMPBLK_UTILITY_DEPS = \ |
| 1043 | ${BUILD}/utility/bmpblk_util.o \ |
| 1044 | ${BUILD}/utility/image_types.o \ |
| 1045 | ${BUILD}/utility/eficompress_for_lib.o \ |
| 1046 | ${BUILD}/utility/efidecompress_for_lib.o |
Bill Richardson | 1912bba | 2013-04-04 21:08:50 -0700 | [diff] [blame] | 1047 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1048 | ${BUILD}/utility/bmpblk_utility: OBJS = ${BMPBLK_UTILITY_DEPS} |
| 1049 | ${BUILD}/utility/bmpblk_utility: ${BMPBLK_UTILITY_DEPS} |
Bill Richardson | 1912bba | 2013-04-04 21:08:50 -0700 | [diff] [blame] | 1050 | ALL_OBJS += ${BMPBLK_UTILITY_DEPS} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1051 | |
| 1052 | ${BUILD}/utility/bmpblk_font: OBJS += ${BUILD}/utility/image_types.o |
| 1053 | ${BUILD}/utility/bmpblk_font: ${BUILD}/utility/image_types.o |
Bill Richardson | 1912bba | 2013-04-04 21:08:50 -0700 | [diff] [blame] | 1054 | ALL_OBJS += ${BUILD}/utility/image_types.o |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1055 | |
| 1056 | # Allow multiple definitions, so tests can mock functions from other libraries |
| 1057 | ${BUILD}/tests/%: CFLAGS += -Xlinker --allow-multiple-definition |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1058 | ${BUILD}/tests/%: LDLIBS += -lrt -luuid |
| 1059 | ${BUILD}/tests/%: LIBS += ${TESTLIB} |
| 1060 | |
| 1061 | ${BUILD}/tests/rollback_index2_tests: OBJS += \ |
| 1062 | ${BUILD}/firmware/lib/rollback_index_for_test.o |
| 1063 | ${BUILD}/tests/rollback_index2_tests: \ |
| 1064 | ${BUILD}/firmware/lib/rollback_index_for_test.o |
Bill Richardson | 80872db | 2014-10-03 10:26:11 -0700 | [diff] [blame] | 1065 | TEST_OBJS += ${BUILD}/firmware/lib/rollback_index_for_test.o |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1066 | |
Randall Spangler | c3d488d | 2013-01-28 16:23:48 -0800 | [diff] [blame] | 1067 | ${BUILD}/tests/tlcl_tests: OBJS += \ |
| 1068 | ${BUILD}/firmware/lib/tpm_lite/tlcl_for_test.o |
| 1069 | ${BUILD}/tests/tlcl_tests: \ |
| 1070 | ${BUILD}/firmware/lib/tpm_lite/tlcl_for_test.o |
Bill Richardson | 80872db | 2014-10-03 10:26:11 -0700 | [diff] [blame] | 1071 | TEST_OBJS += ${BUILD}/firmware/lib/tpm_lite/tlcl_for_test.o |
Randall Spangler | c3d488d | 2013-01-28 16:23:48 -0800 | [diff] [blame] | 1072 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1073 | ${BUILD}/tests/vboot_audio_tests: OBJS += \ |
| 1074 | ${BUILD}/firmware/lib/vboot_audio_for_test.o |
| 1075 | ${BUILD}/tests/vboot_audio_tests: \ |
| 1076 | ${BUILD}/firmware/lib/vboot_audio_for_test.o |
Bill Richardson | 80872db | 2014-10-03 10:26:11 -0700 | [diff] [blame] | 1077 | TEST_OBJS += ${BUILD}/firmware/lib/vboot_audio_for_test.o |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1078 | |
Bill Richardson | 339f7e0 | 2013-04-05 09:49:24 -0700 | [diff] [blame] | 1079 | TLCL_TEST_BINS = $(addprefix ${BUILD}/,${TLCL_TEST_NAMES}) |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1080 | ${TLCL_TEST_BINS}: OBJS += ${BUILD}/tests/tpm_lite/tlcl_tests.o |
| 1081 | ${TLCL_TEST_BINS}: ${BUILD}/tests/tpm_lite/tlcl_tests.o |
Bill Richardson | 80872db | 2014-10-03 10:26:11 -0700 | [diff] [blame] | 1082 | TEST_OBJS += ${BUILD}/tests/tpm_lite/tlcl_tests.o |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1083 | |
Alex Deymo | e08ee28 | 2014-08-29 01:07:48 -0700 | [diff] [blame] | 1084 | # ---------------------------------------------------------------------------- |
| 1085 | # Here are the special rules that don't fit in the generic rules. |
| 1086 | |
| 1087 | # Generates the list of commands defined in futility by running grep in the |
| 1088 | # source files looking for the DECLARE_FUTIL_COMMAND() macro usage. |
| 1089 | ${FUTIL_STATIC_CMD_LIST}: ${FUTIL_STATIC_SRCS} |
| 1090 | ${FUTIL_CMD_LIST}: ${FUTIL_SRCS} |
| 1091 | ${FUTIL_CMD_LIST} ${FUTIL_STATIC_CMD_LIST}: |
| 1092 | @$(PRINTF) " GEN $(subst ${BUILD}/,,$@)\n" |
| 1093 | ${Q}rm -f $@ $@_t $@_commands |
| 1094 | ${Q}mkdir -p ${BUILD}/gen |
Bill Richardson | 779796f | 2014-09-23 11:47:40 -0700 | [diff] [blame] | 1095 | ${Q}grep -hoRE '^DECLARE_FUTIL_COMMAND\([^,]+' $^ \ |
Alex Deymo | e08ee28 | 2014-08-29 01:07:48 -0700 | [diff] [blame] | 1096 | | sed 's/DECLARE_FUTIL_COMMAND(\(.*\)/_CMD(\1)/' \ |
| 1097 | | sort >>$@_commands |
Bill Richardson | e1486c3 | 2014-10-30 17:41:51 -0700 | [diff] [blame] | 1098 | ${Q}./scripts/getversion.sh >> $@_t |
Alex Deymo | e08ee28 | 2014-08-29 01:07:48 -0700 | [diff] [blame] | 1099 | ${Q}echo '#define _CMD(NAME) extern const struct' \ |
| 1100 | 'futil_cmd_t __cmd_##NAME;' >> $@_t |
| 1101 | ${Q}cat $@_commands >> $@_t |
| 1102 | ${Q}echo '#undef _CMD' >> $@_t |
| 1103 | ${Q}echo '#define _CMD(NAME) &__cmd_##NAME,' >> $@_t |
| 1104 | ${Q}echo 'const struct futil_cmd_t *const futil_cmds[] = {' >> $@_t |
| 1105 | ${Q}cat $@_commands >> $@_t |
| 1106 | ${Q}echo '0}; /* null-terminated */' >> $@_t |
| 1107 | ${Q}echo '#undef _CMD' >> $@_t |
| 1108 | ${Q}mv $@_t $@ |
| 1109 | ${Q}rm -f $@_commands |
| 1110 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1111 | ############################################################################## |
| 1112 | # Targets that exist just to run tests |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 1113 | |
| 1114 | # Frequently-run tests |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1115 | .PHONY: test_targets |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 1116 | test_targets:: runcgpttests runmisctests $(if ${VBOOT2},run2tests) |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 1117 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1118 | ifeq (${MINIMAL},) |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 1119 | # Bitmap utility isn't compiled for minimal variant |
Bill Richardson | feb2518 | 2013-03-07 12:54:29 -0800 | [diff] [blame] | 1120 | test_targets:: runbmptests runfutiltests |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 1121 | # Scripts don't work under qemu testing |
| 1122 | # TODO: convert scripts to makefile so they can be called directly |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1123 | test_targets:: runtestscripts |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 1124 | endif |
| 1125 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1126 | .PHONY: test_setup |
Bill Richardson | 3e3790d | 2014-07-14 15:05:54 -0700 | [diff] [blame] | 1127 | test_setup:: cgpt utils futil tests install_for_test |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1128 | |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 1129 | # Qemu setup for cross-compiled tests. Need to copy qemu binary into the |
| 1130 | # sysroot. |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1131 | ifneq (${QEMU_ARCH},) |
| 1132 | test_setup:: qemu_install |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 1133 | |
| 1134 | .PHONY: qemu_install |
| 1135 | qemu_install: |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1136 | ifeq (${SYSROOT},) |
| 1137 | $(error SYSROOT must be set to the top of the target-specific root \ |
| 1138 | when cross-compiling for qemu-based tests to run properly.) |
| 1139 | endif |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 1140 | @$(PRINTF) " Copying qemu binary.\n" |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1141 | ${Q}cp -fu /usr/bin/${QEMU_BIN} ${BUILD}/${QEMU_BIN} |
| 1142 | ${Q}chmod a+rx ${BUILD}/${QEMU_BIN} |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 1143 | endif |
| 1144 | |
Bill Richardson | acb2ee9 | 2013-01-11 22:53:00 -0800 | [diff] [blame] | 1145 | .PHONY: runtests |
Bill Richardson | a130e0b | 2013-04-04 18:16:39 -0700 | [diff] [blame] | 1146 | runtests: test_setup test_targets |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 1147 | |
| 1148 | # Generate test keys |
Bill Richardson | acb2ee9 | 2013-01-11 22:53:00 -0800 | [diff] [blame] | 1149 | .PHONY: genkeys |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 1150 | genkeys: utils |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 1151 | tests/gen_test_keys.sh |
| 1152 | |
| 1153 | # Generate test cases for fuzzing |
Bill Richardson | acb2ee9 | 2013-01-11 22:53:00 -0800 | [diff] [blame] | 1154 | .PHONY: genfuzztestcases |
Randall Spangler | a808dc9 | 2013-01-14 12:59:05 -0800 | [diff] [blame] | 1155 | genfuzztestcases: utils |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 1156 | tests/gen_fuzz_test_cases.sh |
| 1157 | |
Bill Richardson | acb2ee9 | 2013-01-11 22:53:00 -0800 | [diff] [blame] | 1158 | .PHONY: runbmptests |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1159 | runbmptests: test_setup |
| 1160 | cd tests/bitmaps && BMPBLK=${BUILD_RUN}/utility/bmpblk_utility \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 1161 | ./TestBmpBlock.py -v |
| 1162 | |
Bill Richardson | acb2ee9 | 2013-01-11 22:53:00 -0800 | [diff] [blame] | 1163 | .PHONY: runcgpttests |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1164 | runcgpttests: test_setup |
| 1165 | ${RUNTEST} ${BUILD_RUN}/tests/cgptlib_test |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 1166 | |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 1167 | .PHONY: runtestscripts |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1168 | runtestscripts: test_setup genfuzztestcases |
Randall Spangler | b8ff397 | 2014-08-27 13:34:35 -0700 | [diff] [blame] | 1169 | tests/load_kernel_tests.sh |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1170 | tests/run_cgpt_tests.sh ${BUILD_RUN}/cgpt/cgpt |
Nam T. Nguyen | ab89959 | 2014-11-13 19:30:46 -0800 | [diff] [blame] | 1171 | tests/run_cgpt_tests.sh ${BUILD_RUN}/cgpt/cgpt -D 358400 |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 1172 | tests/run_preamble_tests.sh |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 1173 | tests/run_rsa_tests.sh |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 1174 | tests/run_vbutil_kernel_arg_tests.sh |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 1175 | tests/run_vbutil_tests.sh |
Randall Spangler | e166d04 | 2014-05-13 09:24:52 -0700 | [diff] [blame] | 1176 | ifneq (${VBOOT2},) |
| 1177 | tests/vb2_rsa_tests.sh |
Randall Spangler | 539cbc2 | 2014-06-18 14:15:04 -0700 | [diff] [blame] | 1178 | tests/vb2_firmware_tests.sh |
Randall Spangler | e166d04 | 2014-05-13 09:24:52 -0700 | [diff] [blame] | 1179 | endif |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 1180 | |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 1181 | .PHONY: runmisctests |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1182 | runmisctests: test_setup |
| 1183 | ${RUNTEST} ${BUILD_RUN}/tests/rollback_index2_tests |
Randall Spangler | a3eac79 | 2013-01-23 13:04:05 -0800 | [diff] [blame] | 1184 | ${RUNTEST} ${BUILD_RUN}/tests/rollback_index3_tests |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1185 | ${RUNTEST} ${BUILD_RUN}/tests/rsa_utility_tests |
| 1186 | ${RUNTEST} ${BUILD_RUN}/tests/sha_tests |
| 1187 | ${RUNTEST} ${BUILD_RUN}/tests/stateful_util_tests |
Randall Spangler | c3d488d | 2013-01-28 16:23:48 -0800 | [diff] [blame] | 1188 | ${RUNTEST} ${BUILD_RUN}/tests/tlcl_tests |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1189 | ${RUNTEST} ${BUILD_RUN}/tests/tpm_bootmode_tests |
| 1190 | ${RUNTEST} ${BUILD_RUN}/tests/utility_string_tests |
| 1191 | ${RUNTEST} ${BUILD_RUN}/tests/utility_tests |
| 1192 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_devmode_tests |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1193 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_firmware_tests |
Randall Spangler | 0714d9d | 2013-02-05 10:23:38 -0800 | [diff] [blame] | 1194 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_init_tests |
| 1195 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_kernel_tests |
Randall Spangler | 7f43669 | 2013-02-05 12:42:36 -0800 | [diff] [blame] | 1196 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_kernel2_tests |
| 1197 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_kernel3_tests |
| 1198 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_kernel4_tests |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1199 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_audio_tests |
Randall Spangler | e061a25 | 2013-01-22 15:34:07 -0800 | [diff] [blame] | 1200 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_common_tests |
| 1201 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_common2_tests ${TEST_KEYS} |
| 1202 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_common3_tests ${TEST_KEYS} |
Randall Spangler | 786a5dc | 2013-01-24 14:19:56 -0800 | [diff] [blame] | 1203 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_display_tests |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1204 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_firmware_tests |
Randall Spangler | 49cb0d3 | 2013-01-29 14:28:16 -0800 | [diff] [blame] | 1205 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_kernel_tests |
Randall Spangler | 6dbf9d9 | 2013-01-23 12:25:10 -0800 | [diff] [blame] | 1206 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_nvstorage_test |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1207 | |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 1208 | .PHONY: run2tests |
| 1209 | run2tests: test_setup |
Randall Spangler | a7ab8b5 | 2014-06-10 17:05:08 -0700 | [diff] [blame] | 1210 | ${RUNTEST} ${BUILD_RUN}/tests/vb2_api_tests |
Randall Spangler | efa37b8 | 2014-11-12 16:20:50 -0800 | [diff] [blame] | 1211 | ${RUNTEST} ${BUILD_RUN}/tests/vb2_api2_tests |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 1212 | ${RUNTEST} ${BUILD_RUN}/tests/vb2_common_tests |
Randall Spangler | 7141d73 | 2014-05-15 15:34:54 -0700 | [diff] [blame] | 1213 | ${RUNTEST} ${BUILD_RUN}/tests/vb2_common2_tests ${TEST_KEYS} |
| 1214 | ${RUNTEST} ${BUILD_RUN}/tests/vb2_common3_tests ${TEST_KEYS} |
Randall Spangler | 42a8500 | 2014-11-25 10:52:59 -0800 | [diff] [blame] | 1215 | ${RUNTEST} ${BUILD_RUN}/tests/vb2_host_fw_preamble_tests ${TEST_KEYS} |
Randall Spangler | 59c2920 | 2014-11-17 14:24:59 -0800 | [diff] [blame] | 1216 | ${RUNTEST} ${BUILD_RUN}/tests/vb2_host_key_tests ${TEST_KEYS} |
Randall Spangler | 9328bbf | 2014-11-24 12:55:29 -0800 | [diff] [blame] | 1217 | ${RUNTEST} ${BUILD_RUN}/tests/vb2_host_keyblock_tests ${TEST_KEYS} |
Randall Spangler | 02e11b3 | 2014-11-19 12:48:36 -0800 | [diff] [blame] | 1218 | ${RUNTEST} ${BUILD_RUN}/tests/vb2_host_misc_tests |
Randall Spangler | c644a8c | 2014-11-21 11:04:36 -0800 | [diff] [blame] | 1219 | ${RUNTEST} ${BUILD_RUN}/tests/vb2_host_sig_tests ${TEST_KEYS} |
Randall Spangler | 3333e57 | 2014-05-14 11:37:52 -0700 | [diff] [blame] | 1220 | ${RUNTEST} ${BUILD_RUN}/tests/vb2_misc_tests |
Randall Spangler | 1803068 | 2014-06-11 16:01:08 -0700 | [diff] [blame] | 1221 | ${RUNTEST} ${BUILD_RUN}/tests/vb2_misc2_tests |
Randall Spangler | 837b408 | 2014-11-10 13:40:52 -0800 | [diff] [blame] | 1222 | ${RUNTEST} ${BUILD_RUN}/tests/vb2_misc3_tests |
Randall Spangler | 3333e57 | 2014-05-14 11:37:52 -0700 | [diff] [blame] | 1223 | ${RUNTEST} ${BUILD_RUN}/tests/vb2_nvstorage_tests |
Randall Spangler | e166d04 | 2014-05-13 09:24:52 -0700 | [diff] [blame] | 1224 | ${RUNTEST} ${BUILD_RUN}/tests/vb2_rsa_utility_tests |
Randall Spangler | 3333e57 | 2014-05-14 11:37:52 -0700 | [diff] [blame] | 1225 | ${RUNTEST} ${BUILD_RUN}/tests/vb2_secdata_tests |
Randall Spangler | e166d04 | 2014-05-13 09:24:52 -0700 | [diff] [blame] | 1226 | ${RUNTEST} ${BUILD_RUN}/tests/vb2_sha_tests |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 1227 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1228 | .PHONY: runfutiltests |
Bill Richardson | 3e3790d | 2014-07-14 15:05:54 -0700 | [diff] [blame] | 1229 | runfutiltests: test_setup |
Bill Richardson | efa8756 | 2014-09-11 10:41:51 -0700 | [diff] [blame] | 1230 | tests/futility/run_test_scripts.sh ${TEST_INSTALL_DIR}/bin |
Bill Richardson | 339f7e0 | 2013-04-05 09:49:24 -0700 | [diff] [blame] | 1231 | ${RUNTEST} ${BUILD_RUN}/tests/futility/test_not_really |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 1232 | |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 1233 | # Run long tests, including all permutations of encryption keys (instead of |
Randall Spangler | 786a5dc | 2013-01-24 14:19:56 -0800 | [diff] [blame] | 1234 | # just the ones we use) and tests of currently-unused code. |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 1235 | # Not run by automated build. |
Bill Richardson | acb2ee9 | 2013-01-11 22:53:00 -0800 | [diff] [blame] | 1236 | .PHONY: runlongtests |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1237 | runlongtests: test_setup genkeys genfuzztestcases |
Randall Spangler | e061a25 | 2013-01-22 15:34:07 -0800 | [diff] [blame] | 1238 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_common2_tests ${TEST_KEYS} --all |
| 1239 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_common3_tests ${TEST_KEYS} --all |
Randall Spangler | 7141d73 | 2014-05-15 15:34:54 -0700 | [diff] [blame] | 1240 | ifneq (${VBOOT2},) |
| 1241 | ${RUNTEST} ${BUILD_RUN}/tests/vb2_common2_tests ${TEST_KEYS} --all |
| 1242 | ${RUNTEST} ${BUILD_RUN}/tests/vb2_common3_tests ${TEST_KEYS} --all |
| 1243 | endif |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 1244 | tests/run_preamble_tests.sh --all |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 1245 | tests/run_vbutil_tests.sh --all |
| 1246 | |
Bill Richardson | 78d59bf | 2014-08-27 16:17:04 -0700 | [diff] [blame] | 1247 | # TODO: There were a number of ancient tests that hadn't been run in years. |
| 1248 | # They were removed with https://chromium-review.googlesource.com/#/c/214610/ |
| 1249 | # Some day it might be nice to see what they were supposed to do. |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 1250 | |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 1251 | .PHONY: runalltests |
| 1252 | runalltests: runtests runfutiltests runlongtests |
| 1253 | |
Randall Spangler | 59d7508 | 2013-01-23 09:29:54 -0800 | [diff] [blame] | 1254 | # Code coverage |
| 1255 | .PHONY: coverage_init |
| 1256 | coverage_init: test_setup |
| 1257 | rm -f ${COV_INFO}* |
| 1258 | lcov -c -i -d . -b . -o ${COV_INFO}.initial |
| 1259 | |
| 1260 | .PHONY: coverage_html |
| 1261 | coverage_html: |
| 1262 | lcov -c -d . -b . -o ${COV_INFO}.tests |
| 1263 | lcov -a ${COV_INFO}.initial -a ${COV_INFO}.tests -o ${COV_INFO}.total |
| 1264 | lcov -r ${COV_INFO}.total '/usr/*' '*/linktest/*' -o ${COV_INFO}.local |
| 1265 | genhtml ${COV_INFO}.local -o ${BUILD}/coverage |
Bill Richardson | d2d08b2 | 2014-07-08 16:31:40 -0700 | [diff] [blame] | 1266 | # Generate addtional coverage stats just for firmware subdir, because the stats |
| 1267 | # for the whole project don't include subdirectory summaries. This will print |
| 1268 | # the summary for just the firmware sources. |
Randall Spangler | 49cb0d3 | 2013-01-29 14:28:16 -0800 | [diff] [blame] | 1269 | lcov -r ${COV_INFO}.local '*/stub/*' -o ${COV_INFO}.nostub |
| 1270 | lcov -e ${COV_INFO}.nostub '${SRCDIR}/firmware/*' \ |
Randall Spangler | 59d7508 | 2013-01-23 09:29:54 -0800 | [diff] [blame] | 1271 | -o ${COV_INFO}.firmware |
| 1272 | |
| 1273 | .PHONY: coverage |
| 1274 | ifeq (${COV},) |
| 1275 | coverage: |
| 1276 | $(error Build coverage like this: make clean && COV=1 make) |
| 1277 | else |
| 1278 | coverage: coverage_init runtests coverage_html |
| 1279 | endif |
Bill Richardson | 1912bba | 2013-04-04 21:08:50 -0700 | [diff] [blame] | 1280 | |
| 1281 | # Include generated dependencies |
| 1282 | ALL_DEPS += ${ALL_OBJS:%.o=%.o.d} |
Bill Richardson | 80872db | 2014-10-03 10:26:11 -0700 | [diff] [blame] | 1283 | TEST_DEPS += ${TEST_OBJS:%.o=%.o.d} |
| 1284 | |
| 1285 | # We want to use only relative paths in cscope.files, especially since the |
| 1286 | # paths inside and outside the chroot are different. |
| 1287 | SRCDIRPAT=$(subst /,\/,${SRCDIR}/) |
| 1288 | |
| 1289 | ${BUILD}/cscope.files: test_setup |
| 1290 | ${Q}rm -f $@ |
| 1291 | ${Q}cat ${ALL_DEPS} | tr -d ':\\' | tr ' ' '\012' | \ |
| 1292 | sed -e "s/${SRCDIRPAT}//" | \ |
| 1293 | egrep '\.[chS]$$' | sort | uniq > $@ |
| 1294 | |
| 1295 | cmd_etags = etags -o ${BUILD}/TAGS $(shell cat ${BUILD}/cscope.files) |
| 1296 | cmd_ctags = ctags -o ${BUILD}/tags $(shell cat ${BUILD}/cscope.files) |
| 1297 | run_if_prog = $(if $(shell which $(1) 2>/dev/null),$(2),) |
| 1298 | |
| 1299 | .PHONY: tags TAGS xrefs |
| 1300 | tags TAGS xrefs: ${BUILD}/cscope.files |
| 1301 | ${Q}\rm -f ${BUILD}/tags ${BUILD}/TAGS |
| 1302 | ${Q}$(call run_if_prog,etags,${cmd_etags}) |
| 1303 | ${Q}$(call run_if_prog,ctags,${cmd_ctags}) |