Makefile revision a3eac79f5070747e326da631c1eec155f0389919
1e8cfa31d548c069d73c304fea522b527fe7c7dd6Randall Spangler# Copyright (c) 2013 The Chromium OS Authors. All rights reserved. 2322536d2f9d30f42218cc9f2ab40574557da8a9Gaurav Shah# Use of this source code is governed by a BSD-style license that can be 3322536d2f9d30f42218cc9f2ab40574557da8a9Gaurav Shah# found in the LICENSE file. 4322536d2f9d30f42218cc9f2ab40574557da8a9Gaurav Shah 56d696e532c6a0c93ad9b915c59dad4144e6f1b33Simon Glass# This Makefile normally builds in a 'build' subdir, but use 66d696e532c6a0c93ad9b915c59dad4144e6f1b33Simon Glass# 76d696e532c6a0c93ad9b915c59dad4144e6f1b33Simon Glass# make BUILD=<dir> 86d696e532c6a0c93ad9b915c59dad4144e6f1b33Simon Glass# 9eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# to put the output somewhere else. 10eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 11eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson############################################################################## 12eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Make variables come in two flavors, immediate or deferred. 13eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# 14eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Variable definitions are parsed like this: 15eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# 16eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# IMMEDIATE = DEFERRED 17eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# or 18eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# IMMEDIATE := IMMEDIATE 19eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# 20eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Rules are parsed this way: 21eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# 22eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# IMMEDIATE : IMMEDIATE 23eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# DEFERRED 24eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# 25eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# So you can assign variables in any order if they're only to be used in 26eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# actions, but if you use a variable in either the target or prerequisite of a 27eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# rule, the rule will be constructed using only the top-down, immediate value. 28eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# 29eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# So we'll try to define all the variables first. Then the rules. 30eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# 31eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 32eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson############################################################################## 33eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Configuration variables come first. 34eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# 35eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Our convention is that we only use := for variables that will never be 36eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# changed or appended. They must be defined before being used anywhere. 37eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 38eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# we should only run pwd once, not every time we refer to ${BUILD}. 39e061a256549607a56d771eb8ddae5d0dd90d519cRandall SpanglerSRCDIR := $(shell pwd) 40e061a256549607a56d771eb8ddae5d0dd90d519cRandall SpanglerBUILD ?= $(SRCDIR)/build 41844bce57471153664c78993dab453e87891bb969Randall Spanglerexport BUILD 425d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 435d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# Target for 'make install' 445d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerDESTDIR ?= /usr/bin 45826db09fcec194951e1dc71002d6a92620fbb46bBill RichardsonINSTALL ?= install 466d696e532c6a0c93ad9b915c59dad4144e6f1b33Simon Glass 47eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Where to install the (exportable) executables for testing? 48eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonTEST_INSTALL_DIR = ${BUILD}/install_for_test 49eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 50eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Verbose? Use V=1 51eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${V},) 52eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonQ := @ 53eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonendif 54eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 5561a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler# Architecture detection 5661a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler_machname := $(shell uname -m) 5761a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall SpanglerHOST_ARCH ?= ${_machname} 5861a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler 5961a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler# ARCH and/or FIRMWARE_ARCH are defined by the Chromium OS ebuild. 6061a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler# Pick a sane target architecture if none is defined. 6161a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spanglerifeq (${ARCH},) 6261a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler ARCH := ${HOST_ARCH} 6361a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spanglerelse ifeq (${ARCH},i386) 6461a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler override ARCH := x86 6561a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spanglerelse ifeq (${ARCH},amd64) 6661a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler override ARCH := x86_64 6761a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spanglerendif 6861a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler 6961a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler# FIRMWARE_ARCH is only defined by the Chromium OS ebuild if compiling 7061a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler# for a firmware target (such as u-boot or depthcharge). It must map 7161a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler# to the same consistent set of architectures as the host. 7261a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spanglerifeq (${FIRMWARE_ARCH},i386) 7361a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler override FIRMWARE_ARCH := x86 7461a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spanglerelse ifeq (${FIRMWARE_ARCH},amd64) 7561a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler override FIRMWARE_ARCH := x86_64 7661a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spanglerendif 7761a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler 78b265c34321c01bd279f3a1df0a2fea3601f732eeSimon Glass# Provide default CC and CFLAGS for firmware builds; if you have any -D flags, 79b265c34321c01bd279f3a1df0a2fea3601f732eeSimon Glass# please add them after this point (e.g., -DVBOOT_DEBUG). 8074359b755c4a203df0fe3bf51fc53d5de87d1fbfChe-Liang Chiou# 816b0003c6381a7e69818b0b34b358c2cfb1393043Che-Liang Chiou# TODO(crosbug.com/16808) We hard-code u-boot's compiler flags here just 826b0003c6381a7e69818b0b34b358c2cfb1393043Che-Liang Chiou# temporarily. As we are still investigating which flags are necessary for 836b0003c6381a7e69818b0b34b358c2cfb1393043Che-Liang Chiou# maintaining a compatible ABI, etc. between u-boot and vboot_reference. 8474359b755c4a203df0fe3bf51fc53d5de87d1fbfChe-Liang Chiou# 85b265c34321c01bd279f3a1df0a2fea3601f732eeSimon Glass# As a first step, this makes the setting of CC and CFLAGS here optional, to 86b265c34321c01bd279f3a1df0a2fea3601f732eeSimon Glass# permit a calling script or Makefile to set these. 8774359b755c4a203df0fe3bf51fc53d5de87d1fbfChe-Liang Chiou# 88b265c34321c01bd279f3a1df0a2fea3601f732eeSimon Glass# Flag ordering: arch, then -f, then -m, then -W 89b265c34321c01bd279f3a1df0a2fea3601f732eeSimon GlassDEBUG_FLAGS := $(if ${DEBUG},-g -O0,-Os) 90b265c34321c01bd279f3a1df0a2fea3601f732eeSimon GlassCOMMON_FLAGS := -nostdinc -pipe \ 91b265c34321c01bd279f3a1df0a2fea3601f732eeSimon Glass -ffreestanding -fno-builtin -fno-stack-protector \ 92eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson -Werror -Wall -Wstrict-prototypes ${DEBUG_FLAGS} 93b265c34321c01bd279f3a1df0a2fea3601f732eeSimon Glass 94eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Note: FIRMWARE_ARCH is defined by the Chromium OS ebuild. 95eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${FIRMWARE_ARCH}, arm) 96b265c34321c01bd279f3a1df0a2fea3601f732eeSimon GlassCC ?= armv7a-cros-linux-gnueabi-gcc 97b265c34321c01bd279f3a1df0a2fea3601f732eeSimon GlassCFLAGS ?= -march=armv5 \ 98b265c34321c01bd279f3a1df0a2fea3601f732eeSimon Glass -fno-common -ffixed-r8 \ 99d50b27d15de8cc9e37410fc52d3184f17e0db5bbDoug Anderson -mfloat-abi=hard -marm -mabi=aapcs-linux -mno-thumb-interwork \ 100eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${COMMON_FLAGS} 10161a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spanglerelse ifeq (${FIRMWARE_ARCH}, x86) 102b265c34321c01bd279f3a1df0a2fea3601f732eeSimon GlassCC ?= i686-pc-linux-gnu-gcc 103b265c34321c01bd279f3a1df0a2fea3601f732eeSimon Glass# Drop -march=i386 to permit use of SSE instructions 104b265c34321c01bd279f3a1df0a2fea3601f732eeSimon GlassCFLAGS ?= \ 105b265c34321c01bd279f3a1df0a2fea3601f732eeSimon Glass -ffunction-sections -fvisibility=hidden -fno-strict-aliasing \ 106b265c34321c01bd279f3a1df0a2fea3601f732eeSimon Glass -fomit-frame-pointer -fno-toplevel-reorder -fno-dwarf2-cfi-asm \ 107b265c34321c01bd279f3a1df0a2fea3601f732eeSimon Glass -mpreferred-stack-boundary=2 -mregparm=3 \ 108eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${COMMON_FLAGS} 109eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonelse ifeq (${FIRMWARE_ARCH}, x86_64) 110eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonCFLAGS ?= ${COMMON_FLAGS} \ 1118e85e987739281161ece1dbc9ff2b73f3e8e1e35Simon Glass -fvisibility=hidden -fno-strict-aliasing -fomit-frame-pointer 112844bce57471153664c78993dab453e87891bb969Randall Spanglerelse 113eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# FIRMWARE_ARCH not defined; assuming local compile. 114eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonCC ?= gcc 115eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonCFLAGS += -DCHROMEOS_ENVIRONMENT -Wall -Werror # HEY: always want last two? 1168e85e987739281161ece1dbc9ff2b73f3e8e1e35Simon Glassendif 11734be8273e0fb80a6654deab650e581b0dc9046a4Che-Liang Chiou 118eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifneq (${DEBUG},) 119eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonCFLAGS += -DVBOOT_DEBUG 120eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonendif 121844bce57471153664c78993dab453e87891bb969Randall Spangler 122eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${DISABLE_NDEBUG},) 123eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonCFLAGS += -DNDEBUG 124eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonendif 125eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 126eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Create / use dependency files 127eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonCFLAGS += -MMD -MF $@.d 128eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 12959d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler# Code coverage 130eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifneq (${COV},) 13159d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler COV_FLAGS = -O0 --coverage 13259d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler CFLAGS += ${COV_FLAGS} 13359d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler LDFLAGS += ${COV_FLAGS} 13459d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler COV_INFO = ${BUILD}/coverage.info 135eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonendif 136eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 137eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# And a few more default utilities 138eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonLD = ${CC} 139eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonCXX ?= g++ # HEY: really? 140eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonPKG_CONFIG ?= pkg-config 141eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 142844bce57471153664c78993dab453e87891bb969Randall Spangler# Determine QEMU architecture needed, if any 143eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${ARCH},${HOST_ARCH}) 144844bce57471153664c78993dab453e87891bb969Randall Spangler # Same architecture; no need for QEMU 145844bce57471153664c78993dab453e87891bb969Randall Spangler QEMU_ARCH := 14661a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spanglerelse ifeq (${HOST_ARCH}-${ARCH},x86_64-x86) 147844bce57471153664c78993dab453e87891bb969Randall Spangler # 64-bit host can run 32-bit targets directly 148844bce57471153664c78993dab453e87891bb969Randall Spangler QEMU_ARCH := 149844bce57471153664c78993dab453e87891bb969Randall Spanglerelse 150eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson QEMU_ARCH := ${ARCH} 151844bce57471153664c78993dab453e87891bb969Randall Spanglerendif 152844bce57471153664c78993dab453e87891bb969Randall Spangler 153844bce57471153664c78993dab453e87891bb969Randall Spangler# The top of the chroot for qemu must be passed in via the SYSROOT environment 154844bce57471153664c78993dab453e87891bb969Randall Spangler# variable. In the Chromium OS chroot, this is done automatically by the 155844bce57471153664c78993dab453e87891bb969Randall Spangler# ebuild. 156844bce57471153664c78993dab453e87891bb969Randall Spangler 157eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${QEMU_ARCH},) 158844bce57471153664c78993dab453e87891bb969Randall Spangler # Path to build output for running tests is same as for building 159eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson BUILD_RUN = ${BUILD} 160e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spangler SRC_RUN = ${SRCDIR} 161844bce57471153664c78993dab453e87891bb969Randall Spanglerelse 162844bce57471153664c78993dab453e87891bb969Randall Spangler $(info Using qemu for testing.) 163844bce57471153664c78993dab453e87891bb969Randall Spangler # Path to build output for running tests is different in the chroot 164eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson BUILD_RUN = $(subst ${SYSROOT},,${BUILD}) 165e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spangler SRC_RUN = $(subst ${SYSROOT},,${SRCDIR}) 166844bce57471153664c78993dab453e87891bb969Randall Spangler 167eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson QEMU_BIN = qemu-${QEMU_ARCH} 168e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spangler QEMU_RUN = ${BUILD_RUN}/${QEMU_BIN} 169e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spangler export QEMU_RUN 170287beaed7f8ceff679c57664d4da008c6234edfdRandall Spangler 171e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spangler RUNTEST = tests/test_using_qemu.sh 172e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spanglerendif 1735d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 174e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spanglerexport BUILD_RUN 1755d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 176eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Some things only compile inside the Chromium OS chroot. 177eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# TODO: Those things should be in their own repo, not part of vboot_reference 178eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# TODO: Is there a better way to detect this? 179eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifneq (${CROS_WORKON_SRCROOT},) 180eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonIN_CHROOT := yes 18134be8273e0fb80a6654deab650e581b0dc9046a4Che-Liang Chiouendif 18234be8273e0fb80a6654deab650e581b0dc9046a4Che-Liang Chiou 183eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# TODO: Move to separate repo. 184eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifneq (${IN_CHROOT},) 185eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonPC_BASE_VER ?= 125070 186eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonPC_DEPS := libchrome-${PC_BASE_VER} 187eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonPC_CFLAGS := $(shell ${PKG_CONFIG} --cflags ${PC_DEPS}) 188eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonPC_LDLIBS := $(shell ${PKG_CONFIG} --libs ${PC_DEPS}) 189b2b0fcc0f62fadce6f854bf14826a9778c0f7632vbendebendif 1900a0e8d0bb26c951a895c5034a4c1c12f3d4e8707Che-Liang Chiou 191b2b0fcc0f62fadce6f854bf14826a9778c0f7632vbendeb 192eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson############################################################################## 193eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Now we need to describe everything we might want or need to build 194b265c34321c01bd279f3a1df0a2fea3601f732eeSimon Glass 195eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# TODO: This should go in its own repo. 196eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonAU_CGPTLIB = ${BUILD}/cgpt/libcgpt-cc.a 197eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# This is just ... Gah. There's no good place for it. 198eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonDUMPKERNELCONFIGLIB = ${BUILD}/libdump_kernel_config.a 199322536d2f9d30f42218cc9f2ab40574557da8a9Gaurav Shah 200eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Everything wants these headers. 2015d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerINCLUDES += \ 2025d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler -Ifirmware/include \ 2035d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler -Ifirmware/lib/include \ 2045d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler -Ifirmware/lib/cgptlib/include \ 2055d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler -Ifirmware/lib/cryptolib/include \ 2065d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler -Ifirmware/lib/tpm_lite/include 2070b8f35c6a56a0e645254dd7f07ca68e01c8ee629Bill Richardson 208eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# If we're not building for a specific target, just stub out things like the 209eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# TPM commands and various external functions that are provided by the BIOS. 210eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${FIRMWARE_ARCH},) 2115d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerINCLUDES += -Ifirmware/stub/include 2120a0e8d0bb26c951a895c5034a4c1c12f3d4e8707Che-Liang Chiouelse 213eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonINCLUDES += -Ifirmware/arch/${FIRMWARE_ARCH}/include 2145d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spanglerendif 2155d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 216eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Firmware library. TODO: Do we still need to export this? 217eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonFWLIB = ${BUILD}/vboot_fw.a 2185d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 2195d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# find lib -iname '*.c' | sort 2205d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerFWLIB_SRCS = \ 2215d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/cgptlib/cgptlib.c \ 2225d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/cgptlib/cgptlib_internal.c \ 2235d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/cgptlib/crc32.c \ 2245d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/crc8.c \ 2255d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/cryptolib/padding.c \ 2265d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/cryptolib/rsa.c \ 2275d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/cryptolib/rsa_utility.c \ 2285d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/cryptolib/sha1.c \ 2295d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/cryptolib/sha256.c \ 2305d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/cryptolib/sha512.c \ 2315d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/cryptolib/sha_utility.c \ 2325d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/stateful_util.c \ 2335d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/utility.c \ 2345d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/utility_string.c \ 2355d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/vboot_api_init.c \ 2365d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/vboot_api_firmware.c \ 2375d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/vboot_api_kernel.c \ 2385d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/vboot_audio.c \ 2395d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/vboot_common.c \ 2405d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/vboot_display.c \ 2415d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/vboot_firmware.c \ 2425d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/vboot_kernel.c \ 2435d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/vboot_nvstorage.c 2445d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 245eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Support real TPM unless BIOS sets MOCK_TPM 246eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${MOCK_TPM},) 2475d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerFWLIB_SRCS += \ 2485d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/rollback_index.c \ 2495d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/tpm_bootmode.c \ 2505d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/tpm_lite/tlcl.c 2515d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spanglerelse 2525d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerFWLIB_SRCS += \ 2535d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/mocked_rollback_index.c \ 2545d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/mocked_tpm_bootmode.c \ 2555d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/tpm_lite/mocked_tlcl.c 2565d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spanglerendif 2575d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 258eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${FIRMWARE_ARCH},) 259eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Include BIOS stubs in the firmware library when compiling for host 2605d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerFWLIB_SRCS += \ 2615d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/stub/tpm_lite_stub.c \ 2625d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/stub/utility_stub.c \ 2635d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/stub/vboot_api_stub.c \ 2645d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/stub/vboot_api_stub_disk.c 2655d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spanglerendif 2665d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 267eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonFWLIB_OBJS = ${FWLIB_SRCS:%.c=${BUILD}/%.o} 2685d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerALL_OBJS += ${FWLIB_OBJS} 2695d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 2705d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 271eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Library to build the utilities. "HOST" mostly means "userspace". 272eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonHOSTLIB = ${BUILD}/vboot_host.a 2735d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 2745d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerHOSTLIB_SRCS = \ 275eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson host/arch/${ARCH}/lib/crossystem_arch.c \ 2765d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler host/lib/crossystem.c \ 2775d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler host/lib/file_keys.c \ 2785d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler host/lib/fmap.c \ 2795d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler host/lib/host_common.c \ 2805d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler host/lib/host_key.c \ 2815d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler host/lib/host_keyblock.c \ 2825d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler host/lib/host_misc.c \ 2835d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler host/lib/host_signature.c \ 2845d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler host/lib/signature_digest.c 2855d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 286eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonHOSTLIB_OBJS = ${HOSTLIB_SRCS:%.c=${BUILD}/%.o} 2875d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerALL_OBJS += ${HOSTLIB_OBJS} 2885d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 2895d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 290eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Link with hostlib by default 291eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonLIBS = $(HOSTLIB) 292eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 293eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Might need this too. 294eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonCRYPTO_LIBS := $(shell ${PKG_CONFIG} --libs libcrypto) 295eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 296eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 297eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 298eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Now for the userspace binaries 2995d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 3005d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerCGPT = ${BUILD}/cgpt/cgpt 3015d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 3025d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerCGPT_SRCS = \ 3035d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt.c \ 3045d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt_add.c \ 3055d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt_boot.c \ 3065d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt_common.c \ 3075d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt_create.c \ 3085d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt_find.c \ 3095d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt_legacy.c \ 3105d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt_prioritize.c \ 3115d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt_repair.c \ 3125d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt_show.c \ 3135d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cmd_add.c \ 3145d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cmd_boot.c \ 3155d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cmd_create.c \ 3165d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cmd_find.c \ 3175d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cmd_legacy.c \ 3185d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cmd_prioritize.c \ 3195d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cmd_repair.c \ 3205d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cmd_show.c 3215d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 322eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonCGPT_OBJS = ${CGPT_SRCS:%.c=${BUILD}/%.o} 3235d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerALL_OBJS += ${CGPT_OBJS} 3245d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 325eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonC_DESTDIR = ${DESTDIR} 3265d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 3275d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 328eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Scripts to install directly (not compiled) 3295d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerUTIL_SCRIPTS = \ 3305d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler utility/dev_debug_vboot \ 3315d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler utility/dev_make_keypair \ 3325d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler utility/enable_dev_usb_boot \ 3335d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler utility/vbutil_what_keys 3345d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 335eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# These utilities should be linked statically. 336eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonUTIL_NAMES_STATIC = \ 337eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson crossystem \ 338eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson dump_fmap \ 339eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson gbb_utility 340eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 341eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonUTIL_NAMES = ${UTIL_NAMES_STATIC} \ 3425d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler dev_sign_file \ 3435d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler dump_kernel_config \ 3445d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler dumpRSAPublicKey \ 3455d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler load_kernel_test \ 3465d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler pad_digest_utility \ 3475d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler signature_digest_utility \ 3485d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler tpm_init_temp_fix \ 3495d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler tpmc \ 3505d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler vbutil_ec \ 3515d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler vbutil_firmware \ 3525d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler vbutil_kernel \ 3535d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler vbutil_key \ 3545d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler vbutil_keyblock \ 3555d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler verify_data 3565d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 357eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifneq (${IN_CHROOT},) 3585d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerUTIL_NAMES += mount-encrypted 3595d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spanglerendif 3605d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 361eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${MINIMAL},) 3625d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerUTIL_NAMES += \ 3635d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler bmpblk_font \ 3645d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler bmpblk_utility \ 3655d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler eficompress \ 3665d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler efidecompress 3675d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spanglerendif 3685d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 369eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonUTIL_BINS_STATIC := $(addprefix ${BUILD}/utility/,${UTIL_NAMES_STATIC}) 370eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonUTIL_BINS = $(addprefix ${BUILD}/utility/,${UTIL_NAMES}) 3715d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerALL_DEPS += $(addsuffix .d,${UTIL_BINS}) 3725d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 373eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonU_DESTDIR = ${DESTDIR} 374eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 375eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 376eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# The unified firmware utility will eventually replace all the others 377eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonFUTIL_BIN = ${BUILD}/futility/futility 378eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 379eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonFUTIL_SRCS = \ 380eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson futility/IGNOREME.c 381eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 382eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonFUTIL_LDS = futility/futility.lds 383eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 384eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonFUTIL_OBJS = ${FUTIL_SRCS:%.c=${BUILD}/%.o} 385eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 386eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonALL_DEPS += $(addsuffix .d,${FUTIL_BIN}) 387eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonALL_OBJS += ${FUTIL_OBJS} 388eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 389eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonF_DESTDIR = ${DESTDIR} 390eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 391eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 392eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Library of handy test functions. 393eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonTESTLIB = ${BUILD}/tests/test.a 394eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 395eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonTESTLIB_SRCS = \ 396eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson tests/test_common.c \ 397eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson tests/timer_utils.c \ 398eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson tests/crc32_test.c 399eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 400eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonTESTLIB_OBJS = ${TESTLIB_SRCS:%.c=${BUILD}/%.o} 401eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonALL_OBJS += ${TESTLIB_OBJS} 402eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 403eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 404eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# And some compiled tests. 405eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonTEST_NAMES = \ 406eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson cgptlib_test \ 407eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson rollback_index2_tests \ 408a3eac79f5070747e326da631c1eec155f0389919Randall Spangler rollback_index3_tests \ 409eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson rsa_padding_test \ 410eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson rsa_utility_tests \ 411eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson rsa_verify_benchmark \ 412eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson sha_benchmark \ 413eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson sha_tests \ 414eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson stateful_util_tests \ 415eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson tpm_bootmode_tests \ 416eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson utility_string_tests \ 417eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson utility_tests \ 418eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson vboot_api_init_tests \ 419eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson vboot_api_devmode_tests \ 420eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson vboot_api_firmware_tests \ 421eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson vboot_api_kernel_tests \ 422eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson vboot_audio_tests \ 423eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson vboot_common_tests \ 424eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson vboot_common2_tests \ 425eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson vboot_common3_tests \ 426eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson vboot_ec_tests \ 4276dbf9d9160b2927d76017d0f51919e0880f9b2ccRandall Spangler vboot_firmware_tests \ 4286dbf9d9160b2927d76017d0f51919e0880f9b2ccRandall Spangler vboot_nvstorage_test 429eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 430eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Grrr 431eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifneq (${IN_CHROOT},) 432eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonTEST_NAMES += CgptManagerTests 433eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonendif 434eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 435eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# TODO: port these tests to new API, if not already eqivalent 436eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# functionality in other tests. These don't even compile at present. 437eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# 438eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# big_firmware_tests 439eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# big_kernel_tests 440eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# firmware_image_tests 441eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# firmware_rollback_tests 442eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# firmware_splicing_tests 443eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# firmware_verify_benchmark 444eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# kernel_image_tests 445eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# kernel_rollback_tests 446eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# kernel_splicing_tests 447eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# kernel_verify_benchmark 448eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# rollback_index_test 449eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# verify_firmware_fuzz_driver 450eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# verify_kernel_fuzz_driver 451eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# utility/load_firmware_test 452eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 453eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# And a few more... 454eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonTLCL_TESTS = \ 455eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson tpmtest_earlyextend \ 456eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson tpmtest_earlynvram \ 457eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson tpmtest_earlynvram2 \ 458eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson tpmtest_enable \ 459eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson tpmtest_fastenable \ 460eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson tpmtest_globallock \ 461eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson tpmtest_redefine_unowned \ 462eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson tpmtest_spaceperm \ 463eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson tpmtest_testsetup \ 464eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson tpmtest_timing \ 465eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson tpmtest_writelimit 466eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonTLCL_TEST_NAMES = $(addprefix tpm_lite/,${TLCL_TESTS}) 467eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonTLCL_TEST_BINS = $(addprefix ${BUILD}/tests/,${TLCL_TEST_NAMES}) 468eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 469eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonTEST_NAMES += ${TLCL_TEST_NAMES} 470eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 471eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonTEST_BINS = $(addprefix ${BUILD}/tests/,${TEST_NAMES}) 472eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonALL_DEPS += $(addsuffix .d,${TEST_BINS}) 473eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 474e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spangler# Directory containing test keys 475e061a256549607a56d771eb8ddae5d0dd90d519cRandall SpanglerTEST_KEYS = ${SRC_RUN}/tests/testkeys 476eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 477eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 478eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# TODO: why not make this include *all* the cgpt files, and simply have 479eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# cgpt link against it? 480eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# TODO: CgptManager.cc should move to the installer project. Shouldn't be 481eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# in libcgpt-cc.a. 482eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonAU_CGPTLIB_SRCS = \ 483eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson cgpt/CgptManager.cc \ 484eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson cgpt/cgpt_create.c \ 485eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson cgpt/cgpt_add.c \ 486eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson cgpt/cgpt_boot.c \ 487eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson cgpt/cgpt_show.c \ 488eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson cgpt/cgpt_repair.c \ 489eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson cgpt/cgpt_prioritize.c \ 490eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson cgpt/cgpt_common.c \ 491eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson firmware/lib/cgptlib/crc32.c \ 492eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson firmware/lib/cgptlib/cgptlib_internal.c \ 493eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson firmware/stub/utility_stub.c 494eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 495eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonAU_CGPTLIB_OBJS = $(filter %.o, \ 496eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${AU_CGPTLIB_SRCS:%.c=${BUILD}/%.o} \ 497eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${AU_CGPTLIB_SRCS:%.cc=${BUILD}/%.o}) 498eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonALL_OBJS += ${AU_CGPTLIB_OBJS} 499eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 500eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 501eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson############################################################################## 502eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Finally, some targets. High-level ones first. 503eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 504eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Create output directories if necessary. Do this via explicit shell commands 505eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# so it happens before trying to generate/include dependencies. 506eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonSUBDIRS := firmware host cgpt utility futility tests tests/tpm_lite 507eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson_dir_create := $(foreach d, \ 508eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson $(shell find ${SUBDIRS} -name '*.c' -exec dirname {} \; | sort -u), \ 509eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson $(shell [ -d ${BUILD}/${d} ] || mkdir -p ${BUILD}/${d})) 510eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 511eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 512eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Default target. 513eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: all 51459d7508c2261a8371715b28f663b8b2efbb5a895Randall Spanglerall: fwlib $(if ${FIRMWARE_ARCH},,host_stuff) $(if ${COV},coverage) 515eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 516eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Host targets 517eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: host_stuff 518eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonhost_stuff: hostlib cgpt utils futil tests 519eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 520eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# AU targets 521eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: au_stuff 522eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonau_stuff: libcgpt_cc libdump_kernel_config cgptmanager_tests 523eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 524eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: clean 525eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonclean: 526eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}/bin/rm -rf ${BUILD} 527eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 528eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: install 529eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsoninstall: cgpt_install utils_install futil_install 530eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 531eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Don't delete intermediate object files 532eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.SECONDARY: 533eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 534eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# TODO: I suspect this is missing some object files. Make a temp 535eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# target which cleans all known obj/exe's and see what's left; those 536eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# are the files which need deps. 537eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonALL_DEPS += ${ALL_OBJS:%.o=%.o.d} 538eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson-include ${ALL_DEPS} 539eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 540eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 541eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Firmware library 542eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 543eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# TPM-specific flags. These depend on the particular TPM we're targeting for. 544eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# They are needed here only for compiling parts of the firmware code into 545eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# user-level tests. 546eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 547eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# TPM_BLOCKING_CONTINUESELFTEST is defined if TPM_ContinueSelfTest blocks until 548eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# the self test has completed. 549eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 550eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${FWLIB}: CFLAGS += -DTPM_BLOCKING_CONTINUESELFTEST 551eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 552eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# TPM_MANUAL_SELFTEST is defined if the self test must be started manually 553eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# (with a call to TPM_ContinueSelfTest) instead of starting automatically at 554eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# power on. 555eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# 556eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# We sincerely hope that TPM_BLOCKING_CONTINUESELFTEST and TPM_MANUAL_SELFTEST 557eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# are not both defined at the same time. (See comment in code.) 558eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 559eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# CFLAGS += -DTPM_MANUAL_SELFTEST 560eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 561eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${FIRMWARE_ARCH},i386) 562eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Unrolling loops in cryptolib makes it faster 563eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${FWLIB}: CFLAGS += -DUNROLL_LOOPS 564eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 565eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Workaround for coreboot on x86, which will power off asynchronously 566eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# without giving us a chance to react. This is not an example of the Right 567eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Way to do things. See chrome-os-partner:7689, and the commit message 568eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# that made this change. 569eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${FWLIB}: CFLAGS += -DSAVE_LOCALE_IMMEDIATELY 570eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 571eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# On x86 we don't actually read the GBB data into RAM until it is needed. 572eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Therefore it makes sense to cache it rather than reading it each time. 573eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Enable this feature. 574eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${FWLIB}: CFLAGS += -DCOPY_BMP_DATA 575eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonendif 576eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 577eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${FIRMWARE_ARCH},) 578eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Disable rollback TPM when compiling locally, since otherwise 579eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# load_kernel_test attempts to talk to the TPM. 580eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${FWLIB}: CFLAGS += -DDISABLE_ROLLBACK_TPM 581eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonendif 582eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 583eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: fwlib 584eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonfwlib: ${FWLIB} $(if ${FIRMWARE_ARCH},,${BUILD}/firmware/linktest/main) 585eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 586eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${FWLIB}: ${FWLIB_OBJS} 587eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson @printf " RM $(subst ${BUILD}/,,$@)\n" 588eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}rm -f $@ 589eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson @printf " AR $(subst ${BUILD}/,,$@)\n" 590eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}ar qc $@ $^ 591eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 592eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 593eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Host library 594eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 595eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: hostlib 596eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonhostlib: ${HOSTLIB} ${BUILD}/host/linktest/main 597eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 598eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/host/% ${HOSTLIB}: INCLUDES += \ 599eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson -Ihost/include\ 600eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson -Ihost/arch/${ARCH}/include 601eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 602eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# TODO: better way to make .a than duplicating this recipe each time? 603eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${HOSTLIB}: ${HOSTLIB_OBJS} ${FWLIB_OBJS} 604eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson @printf " RM $(subst ${BUILD}/,,$@)\n" 605eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}rm -f $@ 606eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson @printf " AR $(subst ${BUILD}/,,$@)\n" 607eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}ar qc $@ $^ 608eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 609eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 610eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# CGPT library and utility 611eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 612eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: cgpt 613eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsoncgpt: ${CGPT} 614eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 615eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${CGPT}: LDFLAGS += -static 616eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${CGPT}: LDLIBS += -luuid 617eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 618eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${CGPT}: ${CGPT_OBJS} ${LIBS} 619eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson @printf " LDcgpt $(subst ${BUILD}/,,$@)\n" 620eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}${LD} -o ${CGPT} ${CFLAGS} $^ ${LDFLAGS} ${LDLIBS} 621eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 622eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: cgpt_install 623eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsoncgpt_install: ${CGPT} 624eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson @printf " INSTALL CGPT\n" 625eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}mkdir -p ${C_DESTDIR} 626eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}${INSTALL} -t ${C_DESTDIR} $^ 627eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 628eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 629eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Utilities 630eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 631eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# These have their own headers too. 632eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/%: INCLUDES += -Ihost/include -Iutility/include 633eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 634eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Utilities for auto-update toolkits must be statically linked. 635eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${UTIL_BINS_STATIC}: LDFLAGS += -static 636eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 637acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson.PHONY: utils 638eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonutils: ${UTIL_BINS} ${UTIL_SCRIPTS} 6395d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# TODO: change ebuild to pull scripts directly out of utility dir 640eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}cp -f ${UTIL_SCRIPTS} ${BUILD}/utility 641eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}chmod a+rx $(patsubst %,${BUILD}/%,${UTIL_SCRIPTS}) 642826db09fcec194951e1dc71002d6a92620fbb46bBill Richardson 643acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson.PHONY: utils_install 644eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonutils_install: ${UTIL_BINS} ${UTIL_SCRIPTS} 645826db09fcec194951e1dc71002d6a92620fbb46bBill Richardson @printf " INSTALL UTILS\n" 646eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}mkdir -p ${U_DESTDIR} 647eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}${INSTALL} -t ${U_DESTDIR} $^ 6485d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 649eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 650eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# new Firmware Utility 6515d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 652eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: futil 653eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonfutil: ${FUTIL_BIN} 6545d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 655eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${FUTIL_BIN}: ${FUTIL_LDS} ${FUTIL_OBJS} 656eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson @printf " LD $(subst ${BUILD}/,,$@)\n" 657eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}${LD} -o $@ ${CFLAGS} $^ ${LDFLAGS} ${LDLIBS} 6585d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 659eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: futil_install 660eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonfutil_install: ${FUTIL_BIN} 661eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson @printf " INSTALL futility\n" 662eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}mkdir -p ${F_DESTDIR} 663eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}${INSTALL} -t ${F_DESTDIR} $^ 6645d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 6655d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 666eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 6675d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# Mount-encrypted utility for cryptohome 6685d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 6695d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# TODO: mount-encrypted should move to cryptohome and just link against 6705d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# vboot-host.a for tlcl and crossystem. 6715d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 6725d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# The embedded libcrypto conflicts with the shipped openssl, 6735d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# so mount-* builds without the common CFLAGS (and those includes). 6745d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 6755d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler${BUILD}/utility/mount-helpers.o: \ 6765d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler utility/mount-helpers.c \ 6775d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler utility/mount-helpers.h \ 6785d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler utility/mount-encrypted.h 679eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson @printf " CCm-e $(subst ${BUILD}/,,$@)\n" 680eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}${CC} -Wall -Werror -O2 -D_FORTIFY_SOURCE=2 -fstack-protector \ 681eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${COV_FLAGS} \ 682eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson $(shell ${PKG_CONFIG} --cflags glib-2.0 openssl) \ 6835d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler -c $< -o $@ 6845d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 6855d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler${BUILD}/utility/mount-encrypted: \ 6865d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler utility/mount-encrypted.c \ 6875d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler utility/mount-encrypted.h \ 688eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${BUILD}/utility/mount-helpers.o ${LIBS} 689eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson @printf " CCm-exe $(subst ${BUILD}/,,$@)\n" 690eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}${CC} -Wall -Werror -O2 -D_FORTIFY_SOURCE=2 -fstack-protector \ 691eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson $(shell ${PKG_CONFIG} --cflags glib-2.0 openssl) \ 6925d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler -Ifirmware/include \ 6935d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler -Ihost/include \ 694eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${COV_FLAGS} \ 695eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${LDFLAGS} \ 6965d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler $< -o $@ \ 697eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${BUILD}/utility/mount-helpers.o ${LIBS} \ 698eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson $(shell ${PKG_CONFIG} --libs glib-2.0 openssl) \ 6995d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler -lm 7005d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spanglerifneq (${COV},) 701eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}mv -f mount-encrypted.gcno ${BUILD}/utility 7025d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spanglerendif 7035d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 704eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 7055d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# Utility to generate TLCL structure definition header file. 7065d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 707acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson${BUILD}/utility/tlcl_generator: CFLAGS += -fpack-struct 7085d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 7095d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerSTRUCTURES_TMP=${BUILD}/tlcl_structures.tmp 7105d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerSTRUCTURES_SRC=firmware/lib/tpm_lite/include/tlcl_structures.h 7115d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 712acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson.PHONY: update_tlcl_structures 7135d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spanglerupdate_tlcl_structures: ${BUILD}/utility/tlcl_generator 7145d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler @printf " Rebuilding TLCL structures\n" 715eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}${BUILD}/utility/tlcl_generator > ${STRUCTURES_TMP} 716eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}cmp -s ${STRUCTURES_TMP} ${STRUCTURES_SRC} || \ 7175d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler ( echo "%% Updating structures.h %%" && \ 718eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson cp ${STRUCTURES_TMP} ${STRUCTURES_SRC} ) 7195d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 720eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 7215d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# Library to dump kernel config 722eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Used by platform/installer, as well as standalone utility. 7235d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 724acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson.PHONY: libdump_kernel_config 725eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonlibdump_kernel_config: ${DUMPKERNELCONFIGLIB} 726eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 727eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${DUMPKERNELCONFIGLIB}: ${BUILD}/utility/dump_kernel_config_lib.o 728eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson @printf " RM $(subst ${BUILD}/,,$@)\n" 729eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}rm -f $@ 730eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson @printf " AR $(subst ${BUILD}/,,$@)\n" 731eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}ar qc $@ $^ 732eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 733eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 734eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# And this thing. 7355d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 736eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: libcgpt_cc 737eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonlibcgpt_cc: ${AU_CGPTLIB} 738eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 739eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${AU_CGPTLIB}: INCLUDES += -Ifirmware/lib/cgptlib/include 740eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${AU_CGPTLIB}: ${AU_CGPTLIB_OBJS} 741eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson @printf " RM $(subst ${BUILD}/,,$@)\n" 742eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}rm -f $@ 743eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson @printf " AR $(subst ${BUILD}/,,$@)\n" 744eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}ar qc $@ $^ 7455d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 746eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 7475d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# Tests 7485d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 749eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: tests 750eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsontests: ${TEST_BINS} 7515d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 752eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${TEST_BINS}: ${TESTLIB} 7535d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 754eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${TESTLIB}: ${TESTLIB_OBJS} 755eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson @printf " RM $(subst ${BUILD}/,,$@)\n" 756eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}rm -f $@ 757eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson @printf " AR $(subst ${BUILD}/,,$@)\n" 758eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}ar qc $@ $^ 7595d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 7605d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 761eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 762eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Generic build rules. LIBS and OBJS can be overridden to tweak the generic 763eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# rules for specific targets. 7645d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 765eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/%: ${BUILD}/%.o ${OBJS} ${LIBS} 766eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson @printf " LD $(subst ${BUILD}/,,$@)\n" 767eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}${LD} -o $@ ${CFLAGS} $< ${OBJS} ${LIBS} ${LDFLAGS} ${LDLIBS} 768eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 769eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/%.o: %.c 770eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson @printf " CC $(subst ${BUILD}/,,$@)\n" 771eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}${CC} ${CFLAGS} ${INCLUDES} -c -o $@ $< 772eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 773eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Rules to recompile a single source file for library and test 774eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# TODO: is there a tidier way to do this? 775eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/%_for_lib.o: CFLAGS += -DFOR_LIBRARY 776eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/%_for_lib.o: %.c 777eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson @printf " CC-for-lib $(subst ${BUILD}/,,$@)\n" 778eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}${CC} ${CFLAGS} ${INCLUDES} -c -o $@ $< 779eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 780eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/%_for_test.o: CFLAGS += -DFOR_TEST 781eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/%_for_test.o: %.c 782eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson @printf " CC-for-test $(subst ${BUILD}/,,$@)\n" 783eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}${CC} ${CFLAGS} ${INCLUDES} -c -o $@ $< 784eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 785eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# TODO: C++ files don't belong in vboot reference at all. Convert to C. 786eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/%.o: %.cc 787eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson @printf " CXX $(subst ${BUILD}/,,$@)\n" 788eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}${CXX} ${CFLAGS} ${INCLUDES} -c -o $@ $< 789eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 790eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 791eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Here are the special tweaks to the generic rules. 792eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 793eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Linktest ensures firmware lib doesn't rely on outside libraries 794eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/firmware/linktest/main: LIBS = ${FWLIB} 795eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 796eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Specific dependency here. 797eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/dump_kernel_config: LIBS += ${DUMPKERNELCONFIGLIB} 798eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/dump_kernel_config: ${DUMPKERNELCONFIGLIB} 7995d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 800eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# GBB utility needs C++ linker. TODO: It shouldn't. 801eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/gbb_utility: LD = ${CXX} 802eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 803eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Some utilities need external crypto functions 804eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/dumpRSAPublicKey: LDLIBS += ${CRYPTO_LIBS} 805eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/pad_digest_utility: LDLIBS += ${CRYPTO_LIBS} 806eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/signature_digest_utility: LDLIBS += ${CRYPTO_LIBS} 807eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/dev_sign_file: LDLIBS += ${CRYPTO_LIBS} 808eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/vbutil_ec: LDLIBS += ${CRYPTO_LIBS} 809eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/vbutil_firmware: LDLIBS += ${CRYPTO_LIBS} 810eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/vbutil_kernel: LDLIBS += ${CRYPTO_LIBS} 811eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/vbutil_key: LDLIBS += ${CRYPTO_LIBS} 812eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/vbutil_keyblock: LDLIBS += ${CRYPTO_LIBS} 813eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 814eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/host/linktest/main: LDLIBS += ${CRYPTO_LIBS} 815eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/tests/vboot_common2_tests: LDLIBS += ${CRYPTO_LIBS} 816eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/tests/vboot_common3_tests: LDLIBS += ${CRYPTO_LIBS} 817eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/tests/vboot_ec_tests: LDLIBS += ${CRYPTO_LIBS} 818eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 819eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 820eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/bmpblk_utility: LD = ${CXX} 821eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/bmpblk_utility: LDLIBS = -llzma -lyaml 822eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 823eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonBMPBLK_UTILITY_DEPS = \ 824eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${BUILD}/utility/bmpblk_util.o \ 825eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${BUILD}/utility/image_types.o \ 826eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${BUILD}/utility/eficompress_for_lib.o \ 827eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${BUILD}/utility/efidecompress_for_lib.o 828eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/bmpblk_utility: OBJS = ${BMPBLK_UTILITY_DEPS} 829eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/bmpblk_utility: ${BMPBLK_UTILITY_DEPS} 830eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 831eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/bmpblk_font: OBJS += ${BUILD}/utility/image_types.o 832eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/bmpblk_font: ${BUILD}/utility/image_types.o 833eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 834eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Allow multiple definitions, so tests can mock functions from other libraries 835eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/tests/%: CFLAGS += -Xlinker --allow-multiple-definition 836eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/tests/%: INCLUDES += -Ihost/include 837eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/tests/%: LDLIBS += -lrt -luuid 838eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/tests/%: LIBS += ${TESTLIB} 8395d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 8405d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler${BUILD}/tests/rollback_index2_tests: OBJS += \ 84117f8d341099120da78a6ca71165834eefb0960edRandall Spangler ${BUILD}/firmware/lib/rollback_index_for_test.o 842eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/tests/rollback_index2_tests: \ 843eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${BUILD}/firmware/lib/rollback_index_for_test.o 8445d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 8455d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler${BUILD}/tests/vboot_audio_tests: OBJS += \ 84617f8d341099120da78a6ca71165834eefb0960edRandall Spangler ${BUILD}/firmware/lib/vboot_audio_for_test.o 847eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/tests/vboot_audio_tests: \ 848eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${BUILD}/firmware/lib/vboot_audio_for_test.o 8495d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 850acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson.PHONY: cgptmanager_tests 8515d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spanglercgptmanager_tests: ${BUILD}/tests/CgptManagerTests 8525d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 853eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/tests/CgptManagerTests: CFLAGS += ${PC_CFLAGS} 854eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/tests/CgptManagerTests: LD = ${CXX} 855eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/tests/CgptManagerTests: LDLIBS += -lgtest -lgflags ${PC_LDLIBS} 856eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/tests/CgptManagerTests: LIBS = ${AU_CGPTLIB} 857eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/tests/CgptManagerTests: ${AU_CGPTLIB} 8585d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 859acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson${BUILD}/tests/rollback_index_test: INCLUDES += -I/usr/include 860acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson${BUILD}/tests/rollback_index_test: LIBS += -ltlcl 8615d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 862eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${TLCL_TEST_BINS}: OBJS += ${BUILD}/tests/tpm_lite/tlcl_tests.o 863eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${TLCL_TEST_BINS}: ${BUILD}/tests/tpm_lite/tlcl_tests.o 8645d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 865eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson############################################################################## 866eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Targets that exist just to run tests 8675d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 8685d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# Frequently-run tests 869eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: test_targets 870eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsontest_targets:: runcgpttests runmisctests 871844bce57471153664c78993dab453e87891bb969Randall Spangler 872eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${MINIMAL},) 873844bce57471153664c78993dab453e87891bb969Randall Spangler# Bitmap utility isn't compiled for minimal variant 874eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsontest_targets:: runbmptests 875844bce57471153664c78993dab453e87891bb969Randall Spangler# Scripts don't work under qemu testing 876844bce57471153664c78993dab453e87891bb969Randall Spangler# TODO: convert scripts to makefile so they can be called directly 877eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsontest_targets:: runtestscripts 878844bce57471153664c78993dab453e87891bb969Randall Spanglerendif 879844bce57471153664c78993dab453e87891bb969Randall Spangler 880eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: test_setup 881eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsontest_setup:: cgpt utils futil tests 882eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 883844bce57471153664c78993dab453e87891bb969Randall Spangler# Qemu setup for cross-compiled tests. Need to copy qemu binary into the 884844bce57471153664c78993dab453e87891bb969Randall Spangler# sysroot. 885eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifneq (${QEMU_ARCH},) 886eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsontest_setup:: qemu_install 887844bce57471153664c78993dab453e87891bb969Randall Spangler 888844bce57471153664c78993dab453e87891bb969Randall Spangler.PHONY: qemu_install 889844bce57471153664c78993dab453e87891bb969Randall Spanglerqemu_install: 890eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${SYSROOT},) 891eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson $(error SYSROOT must be set to the top of the target-specific root \ 892eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonwhen cross-compiling for qemu-based tests to run properly.) 893eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonendif 894844bce57471153664c78993dab453e87891bb969Randall Spangler @printf " Copying qemu binary.\n" 895eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}cp -fu /usr/bin/${QEMU_BIN} ${BUILD}/${QEMU_BIN} 896eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}chmod a+rx ${BUILD}/${QEMU_BIN} 897844bce57471153664c78993dab453e87891bb969Randall Spanglerendif 898844bce57471153664c78993dab453e87891bb969Randall Spangler 899acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson.PHONY: runtests 900eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonruntests: test_targets 9015d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 9025d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# Generate test keys 903acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson.PHONY: genkeys 904844bce57471153664c78993dab453e87891bb969Randall Spanglergenkeys: utils 9055d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler tests/gen_test_keys.sh 9065d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 9075d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# Generate test cases for fuzzing 908acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson.PHONY: genfuzztestcases 909a808dc944284e6eba39a8f19ddb46bc61c34de8aRandall Spanglergenfuzztestcases: utils 9105d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler tests/gen_fuzz_test_cases.sh 9115d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 912acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson.PHONY: runbmptests 913eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonrunbmptests: test_setup 914eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson cd tests/bitmaps && BMPBLK=${BUILD_RUN}/utility/bmpblk_utility \ 9155d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler ./TestBmpBlock.py -v 9165d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 917acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson.PHONY: runcgpttests 918eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonruncgpttests: test_setup 919eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/cgptlib_test 920eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# HEY - elsewhere 921eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifneq (${IN_CHROOT},) 922eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/CgptManagerTests --v=1 9235d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spanglerendif 9245d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 925844bce57471153664c78993dab453e87891bb969Randall Spangler.PHONY: runtestscripts 926eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonruntestscripts: test_setup genfuzztestcases 927eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson tests/run_cgpt_tests.sh ${BUILD_RUN}/cgpt/cgpt 9285d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler tests/run_preamble_tests.sh 9295d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler tests/run_rsa_tests.sh 930844bce57471153664c78993dab453e87891bb969Randall Spangler tests/run_vbutil_kernel_arg_tests.sh 9315d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler tests/run_vbutil_tests.sh 9325d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 933844bce57471153664c78993dab453e87891bb969Randall Spangler.PHONY: runmisctests 934eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonrunmisctests: test_setup 935eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/rollback_index2_tests 936a3eac79f5070747e326da631c1eec155f0389919Randall Spangler ${RUNTEST} ${BUILD_RUN}/tests/rollback_index3_tests 937eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/rsa_utility_tests 938eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/sha_tests 939eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/stateful_util_tests 940eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/tpm_bootmode_tests 941eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/utility_string_tests 942eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/utility_tests 943eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_devmode_tests 944eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_init_tests 945eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_firmware_tests 946eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/vboot_audio_tests 947e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_common_tests 948e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_common2_tests ${TEST_KEYS} 949e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_common3_tests ${TEST_KEYS} 950eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/vboot_firmware_tests 9516dbf9d9160b2927d76017d0f51919e0880f9b2ccRandall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_nvstorage_test 952eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 953eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: runfutiltests 954eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonrunfutiltests: DESTDIR := ${TEST_INSTALL_DIR} 955eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonrunfutiltests: test_setup install 956eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson @echo "$@ passed" 957844bce57471153664c78993dab453e87891bb969Randall Spangler 9585d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# Run long tests, including all permutations of encryption keys (instead of 9595d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# just the ones we use) and tests of currently-unused code (e.g. vboot_ec). 9605d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# Not run by automated build. 961acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson.PHONY: runlongtests 962eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonrunlongtests: test_setup genkeys genfuzztestcases 963e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_common2_tests ${TEST_KEYS} --all 964e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_common3_tests ${TEST_KEYS} --all 9655d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler tests/run_preamble_tests.sh --all 9665d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler tests/run_vboot_ec_tests.sh 9675d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler tests/run_vbutil_tests.sh --all 9685d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 9695d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# TODO: tests to run when ported to new API 9705d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# ./run_image_verification_tests.sh 9715d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# # Splicing tests 9725d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# ${BUILD}/tests/firmware_splicing_tests 9735d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# ${BUILD}/tests/kernel_splicing_tests 9745d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# # Rollback Tests 9755d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# ${BUILD}/tests/firmware_rollback_tests 9765d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# ${BUILD}/tests/kernel_rollback_tests 9775d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 97859d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler# Code coverage 97959d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler.PHONY: coverage_init 98059d7508c2261a8371715b28f663b8b2efbb5a895Randall Spanglercoverage_init: test_setup 98159d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler rm -f ${COV_INFO}* 98259d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler lcov -c -i -d . -b . -o ${COV_INFO}.initial 98359d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler 98459d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler.PHONY: coverage_html 98559d7508c2261a8371715b28f663b8b2efbb5a895Randall Spanglercoverage_html: 98659d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler lcov -c -d . -b . -o ${COV_INFO}.tests 98759d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler lcov -a ${COV_INFO}.initial -a ${COV_INFO}.tests -o ${COV_INFO}.total 98859d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler lcov -r ${COV_INFO}.total '/usr/*' '*/linktest/*' -o ${COV_INFO}.local 98959d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler genhtml ${COV_INFO}.local -o ${BUILD}/coverage 99059d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler 99159d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler# Generate addtional coverage stats just for firmware subdir, because the 99259d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler# per-directory stats for the whole project don't include their own subdirs. 99359d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler lcov -e ${COV_INFO}.local '${SRCDIR}/firmware/*' \ 99459d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler -o ${COV_INFO}.firmware 99559d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler 99659d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler.PHONY: coverage 99759d7508c2261a8371715b28f663b8b2efbb5a895Randall Spanglerifeq (${COV},) 99859d7508c2261a8371715b28f663b8b2efbb5a895Randall Spanglercoverage: 99959d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler $(error Build coverage like this: make clean && COV=1 make) 100059d7508c2261a8371715b28f663b8b2efbb5a895Randall Spanglerelse 100159d7508c2261a8371715b28f663b8b2efbb5a895Randall Spanglercoverage: coverage_init runtests coverage_html 100259d7508c2261a8371715b28f663b8b2efbb5a895Randall Spanglerendif 100359d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler 1004