Makefile revision 108d991c678f80c99967bd07035de7418c81a072
16f3961507e73f90cec665896dece884e86be560aBill Richardson# Copyright 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 38c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson# We should only run pwd once, not every time we refer to ${BUILD}. 39e061a256549607a56d771eb8ddae5d0dd90d519cRandall SpanglerSRCDIR := $(shell pwd) 4064ddad77e58b9892c72f49977f479a585dce095cBill Richardsonexport SRCDIR 41feb2518166b1cd181e607c611cbb610f0c7300daBill RichardsonBUILD = $(SRCDIR)/build 42844bce57471153664c78993dab453e87891bb969Randall Spanglerexport BUILD 435d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 44c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson# Stuff for 'make install' 45feb2518166b1cd181e607c611cbb610f0c7300daBill RichardsonINSTALL = install 46efa8756c5e7068e57f5e98f0e7f2f42fb8d969d6Bill RichardsonDESTDIR = /usr/local 47feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson 48feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson# Where exactly do the pieces go? 496f3961507e73f90cec665896dece884e86be560aBill Richardson# UB_DIR = utility binary directory 506f3961507e73f90cec665896dece884e86be560aBill Richardson# VB_DIR = vboot binary directory for dev-mode-only scripts 51c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardsonifeq (${MINIMAL},) 526f3961507e73f90cec665896dece884e86be560aBill Richardson# Host install just puts everything where it's told 53efa8756c5e7068e57f5e98f0e7f2f42fb8d969d6Bill RichardsonUB_DIR=${DESTDIR}/bin 54efa8756c5e7068e57f5e98f0e7f2f42fb8d969d6Bill RichardsonVB_DIR=${DESTDIR}/bin 55c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardsonelse 56efa8756c5e7068e57f5e98f0e7f2f42fb8d969d6Bill Richardson# Target install puts things into different places 576f3961507e73f90cec665896dece884e86be560aBill RichardsonUB_DIR=${DESTDIR}/usr/bin 58c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill RichardsonVB_DIR=${DESTDIR}/usr/share/vboot/bin 59c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardsonendif 606d696e532c6a0c93ad9b915c59dad4144e6f1b33Simon Glass 61eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Where to install the (exportable) executables for testing? 62eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonTEST_INSTALL_DIR = ${BUILD}/install_for_test 63eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 64eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Verbose? Use V=1 65eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${V},) 66eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonQ := @ 67eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonendif 68eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 69661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass# Quiet? Use QUIET=1 70661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glassifeq ($(QUIET),) 71661ae9e9cbaad430b87b443712d2608f9ce59883Simon GlassPRINTF := printf 72661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glasselse 73661ae9e9cbaad430b87b443712d2608f9ce59883Simon GlassPRINTF := : 74661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glassendif 75661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass 7661a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler# Architecture detection 7761a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler_machname := $(shell uname -m) 7861a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall SpanglerHOST_ARCH ?= ${_machname} 7961a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler 8061a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler# ARCH and/or FIRMWARE_ARCH are defined by the Chromium OS ebuild. 8161a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler# Pick a sane target architecture if none is defined. 8261a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spanglerifeq (${ARCH},) 8361a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler ARCH := ${HOST_ARCH} 8461a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spanglerelse ifeq (${ARCH},i386) 8561a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler override ARCH := x86 8661a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spanglerelse ifeq (${ARCH},amd64) 8761a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler override ARCH := x86_64 8861a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spanglerendif 8961a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler 9061a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler# FIRMWARE_ARCH is only defined by the Chromium OS ebuild if compiling 9161a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler# for a firmware target (such as u-boot or depthcharge). It must map 9261a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler# to the same consistent set of architectures as the host. 9361a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spanglerifeq (${FIRMWARE_ARCH},i386) 9461a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler override FIRMWARE_ARCH := x86 9561a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spanglerelse ifeq (${FIRMWARE_ARCH},amd64) 9661a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler override FIRMWARE_ARCH := x86_64 97d96b25d0c0a739d351b8f09b128782ca12b7b0e1Stefan Reinauerelse ifeq (${FIRMWARE_ARCH},armv7) 98d96b25d0c0a739d351b8f09b128782ca12b7b0e1Stefan Reinauer override FIRMWARE_ARCH := arm 9961a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spanglerendif 10061a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler 101b265c34321c01bd279f3a1df0a2fea3601f732eeSimon Glass# Provide default CC and CFLAGS for firmware builds; if you have any -D flags, 102b265c34321c01bd279f3a1df0a2fea3601f732eeSimon Glass# please add them after this point (e.g., -DVBOOT_DEBUG). 10374359b755c4a203df0fe3bf51fc53d5de87d1fbfChe-Liang Chiou# 1046b0003c6381a7e69818b0b34b358c2cfb1393043Che-Liang Chiou# TODO(crosbug.com/16808) We hard-code u-boot's compiler flags here just 1056b0003c6381a7e69818b0b34b358c2cfb1393043Che-Liang Chiou# temporarily. As we are still investigating which flags are necessary for 1066b0003c6381a7e69818b0b34b358c2cfb1393043Che-Liang Chiou# maintaining a compatible ABI, etc. between u-boot and vboot_reference. 10774359b755c4a203df0fe3bf51fc53d5de87d1fbfChe-Liang Chiou# 108b265c34321c01bd279f3a1df0a2fea3601f732eeSimon Glass# As a first step, this makes the setting of CC and CFLAGS here optional, to 109b265c34321c01bd279f3a1df0a2fea3601f732eeSimon Glass# permit a calling script or Makefile to set these. 11074359b755c4a203df0fe3bf51fc53d5de87d1fbfChe-Liang Chiou# 111b265c34321c01bd279f3a1df0a2fea3601f732eeSimon Glass# Flag ordering: arch, then -f, then -m, then -W 112b265c34321c01bd279f3a1df0a2fea3601f732eeSimon GlassDEBUG_FLAGS := $(if ${DEBUG},-g -O0,-Os) 113b265c34321c01bd279f3a1df0a2fea3601f732eeSimon GlassCOMMON_FLAGS := -nostdinc -pipe \ 114b265c34321c01bd279f3a1df0a2fea3601f732eeSimon Glass -ffreestanding -fno-builtin -fno-stack-protector \ 115eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson -Werror -Wall -Wstrict-prototypes ${DEBUG_FLAGS} 116b265c34321c01bd279f3a1df0a2fea3601f732eeSimon Glass 117eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Note: FIRMWARE_ARCH is defined by the Chromium OS ebuild. 118eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${FIRMWARE_ARCH}, arm) 119b265c34321c01bd279f3a1df0a2fea3601f732eeSimon GlassCC ?= armv7a-cros-linux-gnueabi-gcc 120b265c34321c01bd279f3a1df0a2fea3601f732eeSimon GlassCFLAGS ?= -march=armv5 \ 121b265c34321c01bd279f3a1df0a2fea3601f732eeSimon Glass -fno-common -ffixed-r8 \ 122d50b27d15de8cc9e37410fc52d3184f17e0db5bbDoug Anderson -mfloat-abi=hard -marm -mabi=aapcs-linux -mno-thumb-interwork \ 123eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${COMMON_FLAGS} 12461a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spanglerelse ifeq (${FIRMWARE_ARCH}, x86) 125b265c34321c01bd279f3a1df0a2fea3601f732eeSimon GlassCC ?= i686-pc-linux-gnu-gcc 126b265c34321c01bd279f3a1df0a2fea3601f732eeSimon Glass# Drop -march=i386 to permit use of SSE instructions 127b265c34321c01bd279f3a1df0a2fea3601f732eeSimon GlassCFLAGS ?= \ 128b265c34321c01bd279f3a1df0a2fea3601f732eeSimon Glass -ffunction-sections -fvisibility=hidden -fno-strict-aliasing \ 129b265c34321c01bd279f3a1df0a2fea3601f732eeSimon Glass -fomit-frame-pointer -fno-toplevel-reorder -fno-dwarf2-cfi-asm \ 13046e00e63805f85c05449ce09cd843a18b76ca665Gabe Black -mpreferred-stack-boundary=2 \ 131eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${COMMON_FLAGS} 132eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonelse ifeq (${FIRMWARE_ARCH}, x86_64) 133eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonCFLAGS ?= ${COMMON_FLAGS} \ 1348e85e987739281161ece1dbc9ff2b73f3e8e1e35Simon Glass -fvisibility=hidden -fno-strict-aliasing -fomit-frame-pointer 135844bce57471153664c78993dab453e87891bb969Randall Spanglerelse 136eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# FIRMWARE_ARCH not defined; assuming local compile. 137eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonCC ?= gcc 138d462101f06e1bf817295a6cdd2b82e7e87eaeef3Bill RichardsonCFLAGS += -DCHROMEOS_ENVIRONMENT -Wall -Werror ${DEBUG_FLAGS} 1398e85e987739281161ece1dbc9ff2b73f3e8e1e35Simon Glassendif 14034be8273e0fb80a6654deab650e581b0dc9046a4Che-Liang Chiou 141eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifneq (${DEBUG},) 142eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonCFLAGS += -DVBOOT_DEBUG 143eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonendif 144844bce57471153664c78993dab453e87891bb969Randall Spangler 145eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${DISABLE_NDEBUG},) 146eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonCFLAGS += -DNDEBUG 147eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonendif 148eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 149feb2518166b1cd181e607c611cbb610f0c7300daBill Richardsonifneq (${FORCE_LOGGING_ON},) 150feb2518166b1cd181e607c611cbb610f0c7300daBill RichardsonCFLAGS += -DFORCE_LOGGING_ON=${FORCE_LOGGING_ON} 151feb2518166b1cd181e607c611cbb610f0c7300daBill Richardsonendif 152feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson 1536014c048131f7c3d055e97c0aaa44494edc4f813Randall Spanglerifneq (${PD_SYNC},) 1546014c048131f7c3d055e97c0aaa44494edc4f813Randall SpanglerCFLAGS += -DPD_SYNC 1556014c048131f7c3d055e97c0aaa44494edc4f813Randall Spanglerendif 1566014c048131f7c3d055e97c0aaa44494edc4f813Randall Spangler 157eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Create / use dependency files 158eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonCFLAGS += -MMD -MF $@.d 159eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 160f8f807a5ef00e8d5360fc2c9093bd0b5da8c0507Bertrand SIMONNETifeq (${FIRMWARE_ARCH},) 161f8f807a5ef00e8d5360fc2c9093bd0b5da8c0507Bertrand SIMONNET# Creates position independent code for non firmware target. 162f8f807a5ef00e8d5360fc2c9093bd0b5da8c0507Bertrand SIMONNETCFLAGS += -fPIE 163f8f807a5ef00e8d5360fc2c9093bd0b5da8c0507Bertrand SIMONNETendif 164f8f807a5ef00e8d5360fc2c9093bd0b5da8c0507Bertrand SIMONNET 1650c3ba249abb1dc60f5ebabccf84ff13206440b83Bill Richardson# These are required to access large disks and files on 32-bit systems. 1660c3ba249abb1dc60f5ebabccf84ff13206440b83Bill RichardsonCFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 1670c3ba249abb1dc60f5ebabccf84ff13206440b83Bill Richardson 16859d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler# Code coverage 169eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifneq (${COV},) 170d2d08b2cc68f720a485cdfa6f044ddb234e8c42bBill Richardson COV_FLAGS = -O0 --coverage -DCOVERAGE 17159d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler CFLAGS += ${COV_FLAGS} 17259d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler LDFLAGS += ${COV_FLAGS} 17359d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler COV_INFO = ${BUILD}/coverage.info 174eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonendif 175eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 176eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# And a few more default utilities 177eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonLD = ${CC} 1786df3e33912baf2633ed27fce6fe166d87e2f04a8Bill RichardsonCXX ?= g++ 179eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonPKG_CONFIG ?= pkg-config 180eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 181844bce57471153664c78993dab453e87891bb969Randall Spangler# Determine QEMU architecture needed, if any 182eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${ARCH},${HOST_ARCH}) 183844bce57471153664c78993dab453e87891bb969Randall Spangler # Same architecture; no need for QEMU 184844bce57471153664c78993dab453e87891bb969Randall Spangler QEMU_ARCH := 18561a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spanglerelse ifeq (${HOST_ARCH}-${ARCH},x86_64-x86) 186844bce57471153664c78993dab453e87891bb969Randall Spangler # 64-bit host can run 32-bit targets directly 187844bce57471153664c78993dab453e87891bb969Randall Spangler QEMU_ARCH := 188844bce57471153664c78993dab453e87891bb969Randall Spanglerelse 189eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson QEMU_ARCH := ${ARCH} 190844bce57471153664c78993dab453e87891bb969Randall Spanglerendif 191844bce57471153664c78993dab453e87891bb969Randall Spangler 192844bce57471153664c78993dab453e87891bb969Randall Spangler# The top of the chroot for qemu must be passed in via the SYSROOT environment 193844bce57471153664c78993dab453e87891bb969Randall Spangler# variable. In the Chromium OS chroot, this is done automatically by the 194844bce57471153664c78993dab453e87891bb969Randall Spangler# ebuild. 195844bce57471153664c78993dab453e87891bb969Randall Spangler 196eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${QEMU_ARCH},) 197844bce57471153664c78993dab453e87891bb969Randall Spangler # Path to build output for running tests is same as for building 198eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson BUILD_RUN = ${BUILD} 199e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spangler SRC_RUN = ${SRCDIR} 200844bce57471153664c78993dab453e87891bb969Randall Spanglerelse 201844bce57471153664c78993dab453e87891bb969Randall Spangler $(info Using qemu for testing.) 202844bce57471153664c78993dab453e87891bb969Randall Spangler # Path to build output for running tests is different in the chroot 203eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson BUILD_RUN = $(subst ${SYSROOT},,${BUILD}) 204e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spangler SRC_RUN = $(subst ${SYSROOT},,${SRCDIR}) 205844bce57471153664c78993dab453e87891bb969Randall Spangler 206eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson QEMU_BIN = qemu-${QEMU_ARCH} 207e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spangler QEMU_RUN = ${BUILD_RUN}/${QEMU_BIN} 208e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spangler export QEMU_RUN 209287beaed7f8ceff679c57664d4da008c6234edfdRandall Spangler 210e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spangler RUNTEST = tests/test_using_qemu.sh 211e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spanglerendif 2125d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 213e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spanglerexport BUILD_RUN 2145d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 215eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson############################################################################## 216eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Now we need to describe everything we might want or need to build 217b265c34321c01bd279f3a1df0a2fea3601f732eeSimon Glass 218eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Everything wants these headers. 2195d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerINCLUDES += \ 2205d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler -Ifirmware/include \ 2215d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler -Ifirmware/lib/include \ 2225d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler -Ifirmware/lib/cgptlib/include \ 2235d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler -Ifirmware/lib/cryptolib/include \ 224786acdabcc15f023330d7c628aca9679e757a238Randall Spangler -Ifirmware/lib/tpm_lite/include \ 225786acdabcc15f023330d7c628aca9679e757a238Randall Spangler -Ifirmware/2lib/include 2260b8f35c6a56a0e645254dd7f07ca68e01c8ee629Bill Richardson 227eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# If we're not building for a specific target, just stub out things like the 228eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# TPM commands and various external functions that are provided by the BIOS. 229eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${FIRMWARE_ARCH},) 2300e6ae29eec7a58eeeeba67356c3a3ee384ba6687Bill RichardsonINCLUDES += -Ihost/include -Ihost/lib/include 2315d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spanglerendif 2325d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 233782990277ac7d6730db4c43c2b5632de93396921Bill Richardson# Firmware library, used by the other firmware components (depthcharge, 234782990277ac7d6730db4c43c2b5632de93396921Bill Richardson# coreboot, etc.). It doesn't need exporting to some other place; they'll build 235782990277ac7d6730db4c43c2b5632de93396921Bill Richardson# this source tree locally and link to it directly. 236eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonFWLIB = ${BUILD}/vboot_fw.a 2375d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 238786acdabcc15f023330d7c628aca9679e757a238Randall Spangler# Smaller firmware library. TODO: Do we still need to export this? 239aaaff86467823e0d3d29c383402275eeae481256Randall SpanglerFWLIB20 = ${BUILD}/vboot_fw2.a 240a5b69b02e039d7267390fea10266d45e14630559Randall SpanglerFWLIB21 = ${BUILD}/vboot_fw21.a 241786acdabcc15f023330d7c628aca9679e757a238Randall Spangler 24293943266c597ad66300445a04afa01270f2b5763Randall Spangler# Firmware library sources needed by VbInit() call 24393943266c597ad66300445a04afa01270f2b5763Randall SpanglerVBINIT_SRCS = \ 2445d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/crc8.c \ 24593943266c597ad66300445a04afa01270f2b5763Randall Spangler firmware/lib/utility.c \ 24693943266c597ad66300445a04afa01270f2b5763Randall Spangler firmware/lib/vboot_api_init.c \ 24793943266c597ad66300445a04afa01270f2b5763Randall Spangler firmware/lib/vboot_common_init.c \ 24893943266c597ad66300445a04afa01270f2b5763Randall Spangler firmware/lib/vboot_nvstorage.c \ 249782990277ac7d6730db4c43c2b5632de93396921Bill Richardson firmware/lib/vboot_nvstorage_rollback.c \ 250527ba810eff4006cf69579f6b96cb4350cb1e189Simon Glass firmware/lib/region-init.c \ 25193943266c597ad66300445a04afa01270f2b5763Randall Spangler 25293943266c597ad66300445a04afa01270f2b5763Randall Spangler# Additional firmware library sources needed by VbSelectFirmware() call 25393943266c597ad66300445a04afa01270f2b5763Randall SpanglerVBSF_SRCS = \ 2545d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/cryptolib/padding.c \ 2555d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/cryptolib/rsa.c \ 2565d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/cryptolib/rsa_utility.c \ 2575d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/cryptolib/sha1.c \ 2585d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/cryptolib/sha256.c \ 2595d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/cryptolib/sha512.c \ 2605d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/cryptolib/sha_utility.c \ 2615d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/stateful_util.c \ 2625d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/vboot_api_firmware.c \ 26393943266c597ad66300445a04afa01270f2b5763Randall Spangler firmware/lib/vboot_common.c \ 264527ba810eff4006cf69579f6b96cb4350cb1e189Simon Glass firmware/lib/vboot_firmware.c \ 265527ba810eff4006cf69579f6b96cb4350cb1e189Simon Glass firmware/lib/region-fw.c \ 26693943266c597ad66300445a04afa01270f2b5763Randall Spangler 26793943266c597ad66300445a04afa01270f2b5763Randall Spangler# Additional firmware library sources needed by VbSelectAndLoadKernel() call 26893943266c597ad66300445a04afa01270f2b5763Randall SpanglerVBSLK_SRCS = \ 26993943266c597ad66300445a04afa01270f2b5763Randall Spangler firmware/lib/cgptlib/cgptlib.c \ 27093943266c597ad66300445a04afa01270f2b5763Randall Spangler firmware/lib/cgptlib/cgptlib_internal.c \ 27193943266c597ad66300445a04afa01270f2b5763Randall Spangler firmware/lib/cgptlib/crc32.c \ 2727c2beb08380410ca6847abdac23e11ded2d1b625Dan Ehrenberg firmware/lib/gpt_misc.c \ 27393943266c597ad66300445a04afa01270f2b5763Randall Spangler firmware/lib/utility_string.c \ 2745d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/vboot_api_kernel.c \ 2755d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/vboot_audio.c \ 2765d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/vboot_display.c \ 277527ba810eff4006cf69579f6b96cb4350cb1e189Simon Glass firmware/lib/vboot_kernel.c \ 278527ba810eff4006cf69579f6b96cb4350cb1e189Simon Glass firmware/lib/region-kernel.c \ 2795d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 280786acdabcc15f023330d7c628aca9679e757a238Randall Spangler# Firmware library source needed for smaller library 2 281108d991c678f80c99967bd07035de7418c81a072Randall SpanglerFWLIB2_SRCS = \ 282a7ab8b50b8923afcfd7a9e6181892c4c8a2de250Randall Spangler firmware/2lib/2api.c \ 283786acdabcc15f023330d7c628aca9679e757a238Randall Spangler firmware/2lib/2common.c \ 2843333e578497aafc4eb8c6e1e359f6e2b1dee633aRandall Spangler firmware/2lib/2crc8.c \ 2853333e578497aafc4eb8c6e1e359f6e2b1dee633aRandall Spangler firmware/2lib/2misc.c \ 2863333e578497aafc4eb8c6e1e359f6e2b1dee633aRandall Spangler firmware/2lib/2nvstorage.c \ 287e166d04e797b605dd2f6784bc863a262c418c0c4Randall Spangler firmware/2lib/2rsa.c \ 2883333e578497aafc4eb8c6e1e359f6e2b1dee633aRandall Spangler firmware/2lib/2secdata.c \ 289e166d04e797b605dd2f6784bc863a262c418c0c4Randall Spangler firmware/2lib/2sha1.c \ 290e166d04e797b605dd2f6784bc863a262c418c0c4Randall Spangler firmware/2lib/2sha256.c \ 291e166d04e797b605dd2f6784bc863a262c418c0c4Randall Spangler firmware/2lib/2sha512.c \ 292a5b69b02e039d7267390fea10266d45e14630559Randall Spangler firmware/2lib/2sha_utility.c 293a5b69b02e039d7267390fea10266d45e14630559Randall Spangler 294108d991c678f80c99967bd07035de7418c81a072Randall SpanglerFWLIB20_SRCS = \ 295108d991c678f80c99967bd07035de7418c81a072Randall Spangler firmware/2lib/2packed_key.c 296108d991c678f80c99967bd07035de7418c81a072Randall Spangler 297a5b69b02e039d7267390fea10266d45e14630559Randall SpanglerFWLIB21_SRCS = \ 298a5b69b02e039d7267390fea10266d45e14630559Randall Spangler firmware/lib21/api.c \ 299a5b69b02e039d7267390fea10266d45e14630559Randall Spangler firmware/lib21/common.c \ 300a5b69b02e039d7267390fea10266d45e14630559Randall Spangler firmware/lib21/misc.c \ 301a5b69b02e039d7267390fea10266d45e14630559Randall Spangler firmware/lib21/packed_key.c 302786acdabcc15f023330d7c628aca9679e757a238Randall Spangler 303eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Support real TPM unless BIOS sets MOCK_TPM 304eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${MOCK_TPM},) 30593943266c597ad66300445a04afa01270f2b5763Randall SpanglerVBINIT_SRCS += \ 3065d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/rollback_index.c \ 3075d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/tpm_lite/tlcl.c 30893943266c597ad66300445a04afa01270f2b5763Randall Spangler 30993943266c597ad66300445a04afa01270f2b5763Randall SpanglerVBSF_SRCS += \ 31093943266c597ad66300445a04afa01270f2b5763Randall Spangler firmware/lib/tpm_bootmode.c 3115d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spanglerelse 31293943266c597ad66300445a04afa01270f2b5763Randall SpanglerVBINIT_SRCS += \ 3135d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/mocked_rollback_index.c \ 3145d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/tpm_lite/mocked_tlcl.c 31593943266c597ad66300445a04afa01270f2b5763Randall Spangler 31693943266c597ad66300445a04afa01270f2b5763Randall SpanglerVBSF_SRCS += \ 31793943266c597ad66300445a04afa01270f2b5763Randall Spangler firmware/lib/mocked_tpm_bootmode.c 3185d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spanglerendif 3195d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 320eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${FIRMWARE_ARCH},) 321eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Include BIOS stubs in the firmware library when compiling for host 32293943266c597ad66300445a04afa01270f2b5763Randall Spangler# TODO: split out other stub funcs too 32393943266c597ad66300445a04afa01270f2b5763Randall SpanglerVBINIT_SRCS += \ 3245d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/stub/tpm_lite_stub.c \ 3255d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/stub/utility_stub.c \ 326527ba810eff4006cf69579f6b96cb4350cb1e189Simon Glass firmware/stub/vboot_api_stub_init.c \ 327527ba810eff4006cf69579f6b96cb4350cb1e189Simon Glass firmware/stub/vboot_api_stub_region.c 32893943266c597ad66300445a04afa01270f2b5763Randall Spangler 32993943266c597ad66300445a04afa01270f2b5763Randall SpanglerVBSF_SRCS += \ 33093943266c597ad66300445a04afa01270f2b5763Randall Spangler firmware/stub/vboot_api_stub_sf.c 33193943266c597ad66300445a04afa01270f2b5763Randall Spangler 33293943266c597ad66300445a04afa01270f2b5763Randall SpanglerVBSLK_SRCS += \ 3335d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/stub/vboot_api_stub.c \ 3345dc75d16b6d5cb0ebc677e6572a2559c6157b8e4Dan Ehrenberg firmware/stub/vboot_api_stub_disk.c \ 3355dc75d16b6d5cb0ebc677e6572a2559c6157b8e4Dan Ehrenberg firmware/stub/vboot_api_stub_stream.c 336da2b49cf08a27551fd910626f669910a636378d4Randall Spangler 337108d991c678f80c99967bd07035de7418c81a072Randall SpanglerFWLIB2_SRCS += \ 338da2b49cf08a27551fd910626f669910a636378d4Randall Spangler firmware/2lib/2stub.c 339da2b49cf08a27551fd910626f669910a636378d4Randall Spangler 3405d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spanglerendif 3415d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 34293943266c597ad66300445a04afa01270f2b5763Randall SpanglerVBSF_SRCS += ${VBINIT_SRCS} 34393943266c597ad66300445a04afa01270f2b5763Randall SpanglerFWLIB_SRCS += ${VBSF_SRCS} ${VBSLK_SRCS} 34493943266c597ad66300445a04afa01270f2b5763Randall Spangler 34593943266c597ad66300445a04afa01270f2b5763Randall SpanglerVBINIT_OBJS = ${VBINIT_SRCS:%.c=${BUILD}/%.o} 34693943266c597ad66300445a04afa01270f2b5763Randall SpanglerVBSF_OBJS = ${VBSF_SRCS:%.c=${BUILD}/%.o} 347a5b69b02e039d7267390fea10266d45e14630559Randall SpanglerALL_OBJS += ${VBINIT_OBJS} ${VBSF_OBJS} 34893943266c597ad66300445a04afa01270f2b5763Randall Spangler 349eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonFWLIB_OBJS = ${FWLIB_SRCS:%.c=${BUILD}/%.o} 350108d991c678f80c99967bd07035de7418c81a072Randall SpanglerFWLIB2_OBJS = ${FWLIB2_SRCS:%.c=${BUILD}/%.o} 351aaaff86467823e0d3d29c383402275eeae481256Randall SpanglerFWLIB20_OBJS = ${FWLIB20_SRCS:%.c=${BUILD}/%.o} 352a5b69b02e039d7267390fea10266d45e14630559Randall SpanglerFWLIB21_OBJS = ${FWLIB21_SRCS:%.c=${BUILD}/%.o} 353108d991c678f80c99967bd07035de7418c81a072Randall SpanglerALL_OBJS += ${FWLIB_OBJS} ${FWLIB2_OBJS} ${FWLIB20_OBJS} ${FWLIB21_OBJS} 3545d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 355782990277ac7d6730db4c43c2b5632de93396921Bill Richardson# Intermediate library for the vboot_reference utilities to link against. 356782990277ac7d6730db4c43c2b5632de93396921Bill RichardsonUTILLIB = ${BUILD}/libvboot_util.a 357108d991c678f80c99967bd07035de7418c81a072Randall SpanglerUTILLIB21 = ${BUILD}/libvboot_util21.a 3585d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 359782990277ac7d6730db4c43c2b5632de93396921Bill RichardsonUTILLIB_SRCS = \ 36081a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson cgpt/cgpt_create.c \ 36181a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson cgpt/cgpt_add.c \ 36281a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson cgpt/cgpt_boot.c \ 36381a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson cgpt/cgpt_show.c \ 36481a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson cgpt/cgpt_repair.c \ 36581a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson cgpt/cgpt_prioritize.c \ 36681a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson cgpt/cgpt_common.c \ 3676f3961507e73f90cec665896dece884e86be560aBill Richardson futility/dump_kernel_config_lib.c \ 368eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson host/arch/${ARCH}/lib/crossystem_arch.c \ 3695d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler host/lib/crossystem.c \ 3705d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler host/lib/file_keys.c \ 3715d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler host/lib/fmap.c \ 3725d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler host/lib/host_common.c \ 3735d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler host/lib/host_key.c \ 3745d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler host/lib/host_keyblock.c \ 3755d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler host/lib/host_misc.c \ 376782990277ac7d6730db4c43c2b5632de93396921Bill Richardson host/lib/util_misc.c \ 3775d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler host/lib/host_signature.c \ 3786f3961507e73f90cec665896dece884e86be560aBill Richardson host/lib/signature_digest.c 3795d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 380aaaff86467823e0d3d29c383402275eeae481256Randall SpanglerUTILLIB_OBJS = ${UTILLIB_SRCS:%.c=${BUILD}/%.o} 381aaaff86467823e0d3d29c383402275eeae481256Randall SpanglerALL_OBJS += ${UTILLIB_OBJS} 382aaaff86467823e0d3d29c383402275eeae481256Randall Spangler 383a5b69b02e039d7267390fea10266d45e14630559Randall SpanglerUTILLIB21_SRCS += \ 384a5b69b02e039d7267390fea10266d45e14630559Randall Spangler host/lib21/host_fw_preamble.c \ 385a5b69b02e039d7267390fea10266d45e14630559Randall Spangler host/lib21/host_key.c \ 386a5b69b02e039d7267390fea10266d45e14630559Randall Spangler host/lib21/host_keyblock.c \ 387a5b69b02e039d7267390fea10266d45e14630559Randall Spangler host/lib21/host_misc.c \ 388a5b69b02e039d7267390fea10266d45e14630559Randall Spangler host/lib21/host_signature.c 38902e11b323b819140590d99b6af440d36c12d161bRandall Spangler 390a5b69b02e039d7267390fea10266d45e14630559Randall SpanglerUTILLIB21_OBJS = ${UTILLIB21_SRCS:%.c=${BUILD}/%.o} 391a5b69b02e039d7267390fea10266d45e14630559Randall SpanglerALL_OBJS += ${UTILLIB21_OBJS} 392782990277ac7d6730db4c43c2b5632de93396921Bill Richardson 393782990277ac7d6730db4c43c2b5632de93396921Bill Richardson# Externally exported library for some target userspace apps to link with 394782990277ac7d6730db4c43c2b5632de93396921Bill Richardson# (cryptohome, updater, etc.) 395782990277ac7d6730db4c43c2b5632de93396921Bill RichardsonHOSTLIB = ${BUILD}/libvboot_host.a 396782990277ac7d6730db4c43c2b5632de93396921Bill Richardson 397782990277ac7d6730db4c43c2b5632de93396921Bill RichardsonHOSTLIB_SRCS = \ 398782990277ac7d6730db4c43c2b5632de93396921Bill Richardson cgpt/cgpt_add.c \ 399782990277ac7d6730db4c43c2b5632de93396921Bill Richardson cgpt/cgpt_boot.c \ 400782990277ac7d6730db4c43c2b5632de93396921Bill Richardson cgpt/cgpt_common.c \ 401782990277ac7d6730db4c43c2b5632de93396921Bill Richardson cgpt/cgpt_create.c \ 402782990277ac7d6730db4c43c2b5632de93396921Bill Richardson cgpt/cgpt_prioritize.c \ 403782990277ac7d6730db4c43c2b5632de93396921Bill Richardson firmware/lib/cgptlib/cgptlib_internal.c \ 404782990277ac7d6730db4c43c2b5632de93396921Bill Richardson firmware/lib/cgptlib/crc32.c \ 405782990277ac7d6730db4c43c2b5632de93396921Bill Richardson firmware/lib/crc8.c \ 406782990277ac7d6730db4c43c2b5632de93396921Bill Richardson firmware/lib/tpm_lite/tlcl.c \ 407782990277ac7d6730db4c43c2b5632de93396921Bill Richardson firmware/lib/utility_string.c \ 408782990277ac7d6730db4c43c2b5632de93396921Bill Richardson firmware/lib/vboot_nvstorage.c \ 409782990277ac7d6730db4c43c2b5632de93396921Bill Richardson firmware/stub/tpm_lite_stub.c \ 410782990277ac7d6730db4c43c2b5632de93396921Bill Richardson firmware/stub/utility_stub.c \ 411782990277ac7d6730db4c43c2b5632de93396921Bill Richardson firmware/stub/vboot_api_stub_init.c \ 4126f3961507e73f90cec665896dece884e86be560aBill Richardson futility/dump_kernel_config_lib.c \ 413782990277ac7d6730db4c43c2b5632de93396921Bill Richardson host/arch/${ARCH}/lib/crossystem_arch.c \ 414782990277ac7d6730db4c43c2b5632de93396921Bill Richardson host/lib/crossystem.c \ 4156ee52d9a929d00e871e7316240b54f381146fbc6Nam T. Nguyen host/lib/fmap.c \ 4166f3961507e73f90cec665896dece884e86be560aBill Richardson host/lib/host_misc.c 417782990277ac7d6730db4c43c2b5632de93396921Bill Richardson 418eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonHOSTLIB_OBJS = ${HOSTLIB_SRCS:%.c=${BUILD}/%.o} 4195d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerALL_OBJS += ${HOSTLIB_OBJS} 4205d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 42181a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson# Sigh. For historical reasons, the autoupdate installer must sometimes be a 42281a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson# 32-bit executable, even when everything else is 64-bit. But it only needs a 42381a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson# few functions, so let's just build those. 42481a0b3de707b4e00958faf36f41b8f3d7bac6808Bill RichardsonTINYHOSTLIB = ${BUILD}/libtinyvboot_host.a 42581a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson 42681a0b3de707b4e00958faf36f41b8f3d7bac6808Bill RichardsonTINYHOSTLIB_SRCS = \ 42781a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson cgpt/cgpt_add.c \ 42881a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson cgpt/cgpt_boot.c \ 42981a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson cgpt/cgpt_common.c \ 430782990277ac7d6730db4c43c2b5632de93396921Bill Richardson cgpt/cgpt_create.c \ 431782990277ac7d6730db4c43c2b5632de93396921Bill Richardson cgpt/cgpt_prioritize.c \ 432782990277ac7d6730db4c43c2b5632de93396921Bill Richardson firmware/lib/cgptlib/cgptlib_internal.c \ 433782990277ac7d6730db4c43c2b5632de93396921Bill Richardson firmware/lib/cgptlib/crc32.c \ 4345fed2a667096341160db8643a4a057e328953a1dBill Richardson firmware/lib/utility_string.c \ 435782990277ac7d6730db4c43c2b5632de93396921Bill Richardson firmware/stub/utility_stub.c \ 436ab899591808dd3e5f955ab7693b54a83389cd35fNam T. Nguyen futility/dump_kernel_config_lib.c 43781a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson 43881a0b3de707b4e00958faf36f41b8f3d7bac6808Bill RichardsonTINYHOSTLIB_OBJS = ${TINYHOSTLIB_SRCS:%.c=${BUILD}/%.o} 439eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 440eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 441eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Now for the userspace binaries 4425d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 4435d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerCGPT = ${BUILD}/cgpt/cgpt 4445d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 4455d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerCGPT_SRCS = \ 4465d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt.c \ 4475d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt_add.c \ 4485d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt_boot.c \ 4495d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt_common.c \ 4505d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt_create.c \ 4515d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt_find.c \ 4525d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt_legacy.c \ 4535d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt_prioritize.c \ 4545d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt_repair.c \ 4555d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt_show.c \ 4565d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cmd_add.c \ 4575d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cmd_boot.c \ 4585d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cmd_create.c \ 4595d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cmd_find.c \ 4605d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cmd_legacy.c \ 4615d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cmd_prioritize.c \ 4625d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cmd_repair.c \ 4638577b5360ca4c9514d9091ed9aded2bb3193f1f0Nam T. Nguyen cgpt/cmd_show.c 4645d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 465eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonCGPT_OBJS = ${CGPT_SRCS:%.c=${BUILD}/%.o} 4665d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerALL_OBJS += ${CGPT_OBJS} 4675d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 4685d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 469eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Scripts to install directly (not compiled) 4705d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerUTIL_SCRIPTS = \ 4715d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler utility/dev_debug_vboot \ 4724d49d34c4ba5aa64ca7aeb26c77e170b2cf2462fBill Richardson utility/enable_dev_usb_boot 4735d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 474c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardsonifeq (${MINIMAL},) 475c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill RichardsonUTIL_SCRIPTS += \ 4764d49d34c4ba5aa64ca7aeb26c77e170b2cf2462fBill Richardson utility/dev_make_keypair \ 4774d49d34c4ba5aa64ca7aeb26c77e170b2cf2462fBill Richardson utility/vbutil_what_keys 478c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardsonendif 479c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson 480eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# These utilities should be linked statically. 481eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonUTIL_NAMES_STATIC = \ 4826f3961507e73f90cec665896dece884e86be560aBill Richardson utility/crossystem 483eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 484eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonUTIL_NAMES = ${UTIL_NAMES_STATIC} \ 485339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/tpm_init_temp_fix \ 4860f07867e6fe186ea460afd557e830c1e49f1ff85Duncan Laurie utility/dumpRSAPublicKey \ 4876f3961507e73f90cec665896dece884e86be560aBill Richardson utility/tpmc 4885d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 4896f3961507e73f90cec665896dece884e86be560aBill Richardson# TODO: Do we still need eficompress and efidecompress for anything? 490eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${MINIMAL},) 4915d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerUTIL_NAMES += \ 492339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/bmpblk_font \ 493339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/bmpblk_utility \ 494339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/eficompress \ 495339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/efidecompress \ 496339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/load_kernel_test \ 497339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/pad_digest_utility \ 498339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/signature_digest_utility \ 499339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/verify_data 500a7ab8b50b8923afcfd7a9e6181892c4c8a2de250Randall Spangler 5015d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spanglerendif 5025d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 503339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill RichardsonUTIL_BINS_STATIC := $(addprefix ${BUILD}/,${UTIL_NAMES_STATIC}) 504339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill RichardsonUTIL_BINS = $(addprefix ${BUILD}/,${UTIL_NAMES}) 5051912bbae89b82c10819b01d039e140e39c668fc7Bill RichardsonALL_OBJS += $(addsuffix .o,${UTIL_BINS} ${UTIL_BINS_STATIC}) 5065d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 507c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson 508c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson# Scripts for signing stuff. 509c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill RichardsonSIGNING_SCRIPTS = \ 510c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson utility/tpm-nvsize \ 511c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson utility/chromeos-tpm-recovery 512c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson 513c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson# These go in a different place. 514c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill RichardsonSIGNING_SCRIPTS_DEV = \ 515c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson scripts/image_signing/resign_firmwarefd.sh \ 516c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson scripts/image_signing/make_dev_firmware.sh \ 517c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson scripts/image_signing/make_dev_ssd.sh \ 518c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson scripts/image_signing/set_gbb_flags.sh 519c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson 520c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson# Installed, but not made executable. 521c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill RichardsonSIGNING_COMMON = scripts/image_signing/common_minimal.sh 522eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 523eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 524eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# The unified firmware utility will eventually replace all the others 525eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonFUTIL_BIN = ${BUILD}/futility/futility 5266db8c75021e2edfa400ae707a8544d041e3c415fBill Richardson# But we still need both static (tiny) and dynamic (with openssl) versions. 5276db8c75021e2edfa400ae707a8544d041e3c415fBill RichardsonFUTIL_STATIC_BIN = ${FUTIL_BIN}_s 528eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 5296f3961507e73f90cec665896dece884e86be560aBill Richardson# These are the executables that are now built in to futility. We'll create 5306f3961507e73f90cec665896dece884e86be560aBill Richardson# symlinks for these so the old names will still work. 5316f3961507e73f90cec665896dece884e86be560aBill Richardson# TODO: Do we still need dev_sign_file for anything? 532a1d9fe6eecf82540d31d34bba988e4838d295302Bill RichardsonFUTIL_SYMLINKS = \ 533e155044a7bbb9b8c6eb751af051726cfe1b411a4Bill Richardson dev_sign_file \ 534e155044a7bbb9b8c6eb751af051726cfe1b411a4Bill Richardson dump_fmap \ 535e155044a7bbb9b8c6eb751af051726cfe1b411a4Bill Richardson dump_kernel_config \ 536e155044a7bbb9b8c6eb751af051726cfe1b411a4Bill Richardson gbb_utility \ 537e155044a7bbb9b8c6eb751af051726cfe1b411a4Bill Richardson vbutil_firmware \ 538e155044a7bbb9b8c6eb751af051726cfe1b411a4Bill Richardson vbutil_kernel \ 539e155044a7bbb9b8c6eb751af051726cfe1b411a4Bill Richardson vbutil_key \ 5406f3961507e73f90cec665896dece884e86be560aBill Richardson vbutil_keyblock 541feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson 5426db8c75021e2edfa400ae707a8544d041e3c415fBill RichardsonFUTIL_STATIC_SRCS = \ 543feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson futility/futility.c \ 54420807b6158b6a43baf0974bc763890888ba1f841Bill Richardson futility/cmd_dump_fmap.c \ 545cf6e78dbd54684ebba0c3bfc2524426f61193416Bill Richardson futility/cmd_gbb_utility.c \ 546cf6e78dbd54684ebba0c3bfc2524426f61193416Bill Richardson futility/misc.c 547eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 5486db8c75021e2edfa400ae707a8544d041e3c415fBill RichardsonFUTIL_SRCS = \ 5496db8c75021e2edfa400ae707a8544d041e3c415fBill Richardson $(FUTIL_STATIC_SRCS) \ 5506f3961507e73f90cec665896dece884e86be560aBill Richardson futility/cmd_dev_sign_file.c \ 5516f3961507e73f90cec665896dece884e86be560aBill Richardson futility/cmd_dump_kernel_config.c \ 5522e25e813419f2cd437164929543e452b28b89260Bill Richardson futility/cmd_load_fmap.c \ 553f4f395e1ca724ef8795cfe86a9edbf15f14eacd1Bill Richardson futility/cmd_pcr.c \ 554f318ee205cc8d92def925c6158272da8a63bf1edBill Richardson futility/cmd_show.c \ 555f318ee205cc8d92def925c6158272da8a63bf1edBill Richardson futility/cmd_sign.c \ 5566f3961507e73f90cec665896dece884e86be560aBill Richardson futility/cmd_vbutil_firmware.c \ 5576f3961507e73f90cec665896dece884e86be560aBill Richardson futility/cmd_vbutil_kernel.c \ 558f1dba02034fba650c84cec52630755cd3c063e88Bill Richardson futility/cmd_vbutil_kernel0.c \ 559b84b81dc265a766a968bf126905447d442558218Bill Richardson futility/cmd_vbutil_key.c \ 560b8ff397674fb98c1d7eea864e7fa571369675131Randall Spangler futility/cmd_vbutil_keyblock.c \ 561cf6e78dbd54684ebba0c3bfc2524426f61193416Bill Richardson futility/cmd_verify_kernel.c \ 562f318ee205cc8d92def925c6158272da8a63bf1edBill Richardson futility/traversal.c \ 563f318ee205cc8d92def925c6158272da8a63bf1edBill Richardson futility/vb1_helper.c 5646db8c75021e2edfa400ae707a8544d041e3c415fBill Richardson 565028f468aff976ef5e76f20133c64ec19cb9d1517Randall Spanglerifneq (${VBOOT2},) 566028f468aff976ef5e76f20133c64ec19cb9d1517Randall SpanglerFUTIL_SRCS += \ 567028f468aff976ef5e76f20133c64ec19cb9d1517Randall Spangler futility/cmd_vb2_verify_fw.c 568028f468aff976ef5e76f20133c64ec19cb9d1517Randall Spanglerendif 569028f468aff976ef5e76f20133c64ec19cb9d1517Randall Spangler 570e08ee28548934e933733babf0bc0c418142d095dAlex Deymo# List of commands built in futility and futility_s. 571e08ee28548934e933733babf0bc0c418142d095dAlex DeymoFUTIL_STATIC_CMD_LIST = ${BUILD}/gen/futility_static_cmds.c 572e08ee28548934e933733babf0bc0c418142d095dAlex DeymoFUTIL_CMD_LIST = ${BUILD}/gen/futility_cmds.c 573eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 57491852e7f58d50a031bcb5c02e68473cefb10ebb0Bill Richardson# Workaround for TODO(crbug.com/437107). 57591852e7f58d50a031bcb5c02e68473cefb10ebb0Bill RichardsonFUTIL_STATIC_WORKAROUND_SRCS = firmware/stub/vboot_api_stub_static_sf.c 57691852e7f58d50a031bcb5c02e68473cefb10ebb0Bill Richardson 577e08ee28548934e933733babf0bc0c418142d095dAlex DeymoFUTIL_STATIC_OBJS = ${FUTIL_STATIC_SRCS:%.c=${BUILD}/%.o} \ 57891852e7f58d50a031bcb5c02e68473cefb10ebb0Bill Richardson ${FUTIL_STATIC_WORKAROUND_SRCS:%.c=${BUILD}/%.o} \ 579e08ee28548934e933733babf0bc0c418142d095dAlex Deymo ${FUTIL_STATIC_CMD_LIST:%.c=%.o} 580e08ee28548934e933733babf0bc0c418142d095dAlex DeymoFUTIL_OBJS = ${FUTIL_SRCS:%.c=${BUILD}/%.o} ${FUTIL_CMD_LIST:%.c=%.o} 581eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 582eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonALL_OBJS += ${FUTIL_OBJS} 583eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 584eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 585eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Library of handy test functions. 586eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonTESTLIB = ${BUILD}/tests/test.a 587eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 588eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonTESTLIB_SRCS = \ 589eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson tests/test_common.c \ 590eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson tests/timer_utils.c \ 591eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson tests/crc32_test.c 592eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 593eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonTESTLIB_OBJS = ${TESTLIB_SRCS:%.c=${BUILD}/%.o} 59480872dbffcb2e0079bfe095d770ccc6c8bd5fd7aBill RichardsonTEST_OBJS += ${TESTLIB_OBJS} 595eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 596eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 597eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# And some compiled tests. 598eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonTEST_NAMES = \ 599339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/cgptlib_test \ 600339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/rollback_index2_tests \ 601339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/rollback_index3_tests \ 602339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/rsa_padding_test \ 603339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/rsa_utility_tests \ 604339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/rsa_verify_benchmark \ 605339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/sha_benchmark \ 606339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/sha_tests \ 607339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/stateful_util_tests \ 608339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/tlcl_tests \ 609339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/tpm_bootmode_tests \ 610339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/utility_string_tests \ 611339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/utility_tests \ 612339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_api_init_tests \ 613339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_api_devmode_tests \ 614339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_api_firmware_tests \ 615339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_api_kernel_tests \ 616339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_api_kernel2_tests \ 617339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_api_kernel3_tests \ 618339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_api_kernel4_tests \ 619339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_audio_tests \ 620339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_common_tests \ 621339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_common2_tests \ 622339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_common3_tests \ 623339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_display_tests \ 624339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_firmware_tests \ 625339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_kernel_tests \ 626339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_nvstorage_test \ 6276f3961507e73f90cec665896dece884e86be560aBill Richardson tests/futility/binary_editor \ 628339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/futility/test_not_really 629eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 630527ba810eff4006cf69579f6b96cb4350cb1e189Simon Glassifdef REGION_READ 631527ba810eff4006cf69579f6b96cb4350cb1e189Simon GlassTEST_NAMES += tests/vboot_region_tests 632527ba810eff4006cf69579f6b96cb4350cb1e189Simon Glassendif 633527ba810eff4006cf69579f6b96cb4350cb1e189Simon Glass 634aaaff86467823e0d3d29c383402275eeae481256Randall SpanglerTEST20_NAMES = \ 635a7ab8b50b8923afcfd7a9e6181892c4c8a2de250Randall Spangler tests/vb2_api_tests \ 636786acdabcc15f023330d7c628aca9679e757a238Randall Spangler tests/vb2_common_tests \ 6377141d73c149ee203a192f0cb45ca9bfa10c0ff8cRandall Spangler tests/vb2_common2_tests \ 6387141d73c149ee203a192f0cb45ca9bfa10c0ff8cRandall Spangler tests/vb2_common3_tests \ 6393333e578497aafc4eb8c6e1e359f6e2b1dee633aRandall Spangler tests/vb2_misc_tests \ 6401803068173a625efd83d1cee8dd90843feb0d972Randall Spangler tests/vb2_misc2_tests \ 6413333e578497aafc4eb8c6e1e359f6e2b1dee633aRandall Spangler tests/vb2_nvstorage_tests \ 642e166d04e797b605dd2f6784bc863a262c418c0c4Randall Spangler tests/vb2_rsa_padding_tests \ 643e166d04e797b605dd2f6784bc863a262c418c0c4Randall Spangler tests/vb2_rsa_utility_tests \ 6443333e578497aafc4eb8c6e1e359f6e2b1dee633aRandall Spangler tests/vb2_secdata_tests \ 645108d991c678f80c99967bd07035de7418c81a072Randall Spangler tests/vb2_sha_tests 646108d991c678f80c99967bd07035de7418c81a072Randall Spangler 647108d991c678f80c99967bd07035de7418c81a072Randall SpanglerTEST21_NAMES = \ 648108d991c678f80c99967bd07035de7418c81a072Randall Spangler tests/vb21_api_tests \ 649108d991c678f80c99967bd07035de7418c81a072Randall Spangler tests/vb21_common_tests \ 650108d991c678f80c99967bd07035de7418c81a072Randall Spangler tests/vb21_common2_tests \ 651108d991c678f80c99967bd07035de7418c81a072Randall Spangler tests/vb21_misc_tests \ 652108d991c678f80c99967bd07035de7418c81a072Randall Spangler tests/vb21_host_fw_preamble_tests \ 653108d991c678f80c99967bd07035de7418c81a072Randall Spangler tests/vb21_host_key_tests \ 654108d991c678f80c99967bd07035de7418c81a072Randall Spangler tests/vb21_host_keyblock_tests \ 655108d991c678f80c99967bd07035de7418c81a072Randall Spangler tests/vb21_host_misc_tests \ 656108d991c678f80c99967bd07035de7418c81a072Randall Spangler tests/vb21_host_sig_tests 657786acdabcc15f023330d7c628aca9679e757a238Randall Spangler 658aaaff86467823e0d3d29c383402275eeae481256Randall Spanglerifneq (${VBOOT2},) 659108d991c678f80c99967bd07035de7418c81a072Randall SpanglerTEST_NAMES += ${TEST20_NAMES} ${TEST21_NAMES} 660786acdabcc15f023330d7c628aca9679e757a238Randall Spanglerendif 661786acdabcc15f023330d7c628aca9679e757a238Randall Spangler 662eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# And a few more... 663339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill RichardsonTLCL_TEST_NAMES = \ 664339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/tpm_lite/tpmtest_earlyextend \ 665339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/tpm_lite/tpmtest_earlynvram \ 666339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/tpm_lite/tpmtest_earlynvram2 \ 667339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/tpm_lite/tpmtest_enable \ 668339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/tpm_lite/tpmtest_fastenable \ 669339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/tpm_lite/tpmtest_globallock \ 670339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/tpm_lite/tpmtest_redefine_unowned \ 671339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/tpm_lite/tpmtest_spaceperm \ 672339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/tpm_lite/tpmtest_testsetup \ 673339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/tpm_lite/tpmtest_timing \ 674339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/tpm_lite/tpmtest_writelimit 675eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 676eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonTEST_NAMES += ${TLCL_TEST_NAMES} 677eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 678339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson# Finally 679339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill RichardsonTEST_BINS = $(addprefix ${BUILD}/,${TEST_NAMES}) 68080872dbffcb2e0079bfe095d770ccc6c8bd5fd7aBill RichardsonTEST_OBJS += $(addsuffix .o,${TEST_BINS}) 681eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 682aaaff86467823e0d3d29c383402275eeae481256Randall SpanglerTEST20_BINS = $(addprefix ${BUILD}/,${TEST20_NAMES}) 683108d991c678f80c99967bd07035de7418c81a072Randall SpanglerTEST21_BINS = $(addprefix ${BUILD}/,${TEST21_NAMES}) 684aaaff86467823e0d3d29c383402275eeae481256Randall Spangler 685e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spangler# Directory containing test keys 686e061a256549607a56d771eb8ddae5d0dd90d519cRandall SpanglerTEST_KEYS = ${SRC_RUN}/tests/testkeys 687eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 688eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 689eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson############################################################################## 690eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Finally, some targets. High-level ones first. 691eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 692eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Create output directories if necessary. Do this via explicit shell commands 693eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# so it happens before trying to generate/include dependencies. 694eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonSUBDIRS := firmware host cgpt utility futility tests tests/tpm_lite 695eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson_dir_create := $(foreach d, \ 696eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson $(shell find ${SUBDIRS} -name '*.c' -exec dirname {} \; | sort -u), \ 697eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson $(shell [ -d ${BUILD}/${d} ] || mkdir -p ${BUILD}/${d})) 698eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 699eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 700eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Default target. 701eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: all 702aaaff86467823e0d3d29c383402275eeae481256Randall Spanglerall: fwlib \ 703a5b69b02e039d7267390fea10266d45e14630559Randall Spangler $(if ${VBOOT2},fwlib2 fwlib21) \ 704aaaff86467823e0d3d29c383402275eeae481256Randall Spangler $(if ${FIRMWARE_ARCH},,host_stuff) \ 705786acdabcc15f023330d7c628aca9679e757a238Randall Spangler $(if ${COV},coverage) 706eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 707eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Host targets 708eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: host_stuff 709a5b69b02e039d7267390fea10266d45e14630559Randall Spanglerhost_stuff: utillib hostlib cgpt utils futil tests $(if ${VBOOT2},utillib21) 710eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 711eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: clean 712eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonclean: 713eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}/bin/rm -rf ${BUILD} 714eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 715eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: install 716c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardsoninstall: cgpt_install utils_install signing_install futil_install 717eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 7183e3790d00827e75d39b77a14bca2756a14a51b3cBill Richardson.PHONY: install_for_test 7193e3790d00827e75d39b77a14bca2756a14a51b3cBill Richardsoninstall_for_test: override DESTDIR = ${TEST_INSTALL_DIR} 7203e3790d00827e75d39b77a14bca2756a14a51b3cBill Richardsoninstall_for_test: install 7213e3790d00827e75d39b77a14bca2756a14a51b3cBill Richardson 722eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Don't delete intermediate object files 723eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.SECONDARY: 724eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 725eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 726eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Firmware library 727eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 728eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# TPM-specific flags. These depend on the particular TPM we're targeting for. 729eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# They are needed here only for compiling parts of the firmware code into 730eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# user-level tests. 731eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 732eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# TPM_BLOCKING_CONTINUESELFTEST is defined if TPM_ContinueSelfTest blocks until 733eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# the self test has completed. 734eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 73545cc0f2c0a48b377520842597769a5813cf55902Randall Spangler${FWLIB_OBJS}: CFLAGS += -DTPM_BLOCKING_CONTINUESELFTEST 736eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 737eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# TPM_MANUAL_SELFTEST is defined if the self test must be started manually 738eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# (with a call to TPM_ContinueSelfTest) instead of starting automatically at 739eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# power on. 740eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# 741eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# We sincerely hope that TPM_BLOCKING_CONTINUESELFTEST and TPM_MANUAL_SELFTEST 742eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# are not both defined at the same time. (See comment in code.) 743eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 744eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# CFLAGS += -DTPM_MANUAL_SELFTEST 745eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 746eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${FIRMWARE_ARCH},i386) 747eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Unrolling loops in cryptolib makes it faster 74845cc0f2c0a48b377520842597769a5813cf55902Randall Spangler${FWLIB_OBJS}: CFLAGS += -DUNROLL_LOOPS 749108d991c678f80c99967bd07035de7418c81a072Randall Spangler${FWLIB2_OBJS}: CFLAGS += -DUNROLL_LOOPS 750aaaff86467823e0d3d29c383402275eeae481256Randall Spangler${FWLIB20_OBJS}: CFLAGS += -DUNROLL_LOOPS 751a5b69b02e039d7267390fea10266d45e14630559Randall Spangler${FWLIB21_OBJS}: CFLAGS += -DUNROLL_LOOPS 752eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 753eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Workaround for coreboot on x86, which will power off asynchronously 754eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# without giving us a chance to react. This is not an example of the Right 755eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Way to do things. See chrome-os-partner:7689, and the commit message 756eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# that made this change. 75745cc0f2c0a48b377520842597769a5813cf55902Randall Spangler${FWLIB_OBJS}: CFLAGS += -DSAVE_LOCALE_IMMEDIATELY 758eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 759eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# On x86 we don't actually read the GBB data into RAM until it is needed. 760eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Therefore it makes sense to cache it rather than reading it each time. 761eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Enable this feature. 76245cc0f2c0a48b377520842597769a5813cf55902Randall Spangler${FWLIB_OBJS}: CFLAGS += -DCOPY_BMP_DATA 763eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonendif 764eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 765527ba810eff4006cf69579f6b96cb4350cb1e189Simon Glassifdef REGION_READ 766527ba810eff4006cf69579f6b96cb4350cb1e189Simon Glass${FWLIB_OBJS}: CFLAGS += -DREGION_READ 767527ba810eff4006cf69579f6b96cb4350cb1e189Simon Glassendif 768527ba810eff4006cf69579f6b96cb4350cb1e189Simon Glass 769eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${FIRMWARE_ARCH},) 770eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Disable rollback TPM when compiling locally, since otherwise 771eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# load_kernel_test attempts to talk to the TPM. 77245cc0f2c0a48b377520842597769a5813cf55902Randall Spangler${FWLIB_OBJS}: CFLAGS += -DDISABLE_ROLLBACK_TPM 773eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonendif 774eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 775108d991c678f80c99967bd07035de7418c81a072Randall Spangler${FWLIB21_OBJS}: INCLUDES += -Ifirmware/lib21/include 776108d991c678f80c99967bd07035de7418c81a072Randall Spangler 777a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson# Linktest ensures firmware lib doesn't rely on outside libraries 778a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson${BUILD}/firmware/linktest/main_vbinit: ${VBINIT_OBJS} 77993943266c597ad66300445a04afa01270f2b5763Randall Spangler${BUILD}/firmware/linktest/main_vbinit: OBJS = ${VBINIT_OBJS} 78080872dbffcb2e0079bfe095d770ccc6c8bd5fd7aBill RichardsonTEST_OBJS += ${BUILD}/firmware/linktest/main_vbinit.o 781a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson${BUILD}/firmware/linktest/main_vbsf: ${VBSF_OBJS} 78293943266c597ad66300445a04afa01270f2b5763Randall Spangler${BUILD}/firmware/linktest/main_vbsf: OBJS = ${VBSF_OBJS} 78380872dbffcb2e0079bfe095d770ccc6c8bd5fd7aBill RichardsonTEST_OBJS += ${BUILD}/firmware/linktest/main_vbsf.o 784a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson${BUILD}/firmware/linktest/main: ${FWLIB} 785a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson${BUILD}/firmware/linktest/main: LIBS = ${FWLIB} 78680872dbffcb2e0079bfe095d770ccc6c8bd5fd7aBill RichardsonTEST_OBJS += ${BUILD}/firmware/linktest/main.o 78793943266c597ad66300445a04afa01270f2b5763Randall Spangler 788d2d08b2cc68f720a485cdfa6f044ddb234e8c42bBill Richardson.PHONY: fwlinktest 789d2d08b2cc68f720a485cdfa6f044ddb234e8c42bBill Richardsonfwlinktest: \ 79093943266c597ad66300445a04afa01270f2b5763Randall Spangler ${BUILD}/firmware/linktest/main_vbinit \ 79193943266c597ad66300445a04afa01270f2b5763Randall Spangler ${BUILD}/firmware/linktest/main_vbsf \ 79293943266c597ad66300445a04afa01270f2b5763Randall Spangler ${BUILD}/firmware/linktest/main 79393943266c597ad66300445a04afa01270f2b5763Randall Spangler 794eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: fwlib 795a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardsonfwlib: $(if ${FIRMWARE_ARCH},${FWLIB},fwlinktest) 796eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 797a5b69b02e039d7267390fea10266d45e14630559Randall Spangler${FWLIB}: ${FWLIB_OBJS} 798a5b69b02e039d7267390fea10266d45e14630559Randall Spangler @$(PRINTF) " RM $(subst ${BUILD}/,,$@)\n" 799a5b69b02e039d7267390fea10266d45e14630559Randall Spangler ${Q}rm -f $@ 800a5b69b02e039d7267390fea10266d45e14630559Randall Spangler @$(PRINTF) " AR $(subst ${BUILD}/,,$@)\n" 801a5b69b02e039d7267390fea10266d45e14630559Randall Spangler ${Q}ar qc $@ $^ 802a5b69b02e039d7267390fea10266d45e14630559Randall Spangler 803786acdabcc15f023330d7c628aca9679e757a238Randall Spangler.PHONY: fwlib2 804aaaff86467823e0d3d29c383402275eeae481256Randall Spanglerfwlib2: ${FWLIB20} 805786acdabcc15f023330d7c628aca9679e757a238Randall Spangler 806108d991c678f80c99967bd07035de7418c81a072Randall Spangler${FWLIB20}: ${FWLIB2_OBJS} ${FWLIB20_OBJS} 807661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " RM $(subst ${BUILD}/,,$@)\n" 808eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}rm -f $@ 809661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " AR $(subst ${BUILD}/,,$@)\n" 810eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}ar qc $@ $^ 811eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 812a5b69b02e039d7267390fea10266d45e14630559Randall Spangler.PHONY: fwlib21 813a5b69b02e039d7267390fea10266d45e14630559Randall Spanglerfwlib21: ${FWLIB21} 814a5b69b02e039d7267390fea10266d45e14630559Randall Spangler 815108d991c678f80c99967bd07035de7418c81a072Randall Spangler${FWLIB21}: ${FWLIB2_OBJS} ${FWLIB21_OBJS} 816786acdabcc15f023330d7c628aca9679e757a238Randall Spangler @$(PRINTF) " RM $(subst ${BUILD}/,,$@)\n" 817786acdabcc15f023330d7c628aca9679e757a238Randall Spangler ${Q}rm -f $@ 818786acdabcc15f023330d7c628aca9679e757a238Randall Spangler @$(PRINTF) " AR $(subst ${BUILD}/,,$@)\n" 819786acdabcc15f023330d7c628aca9679e757a238Randall Spangler ${Q}ar qc $@ $^ 820786acdabcc15f023330d7c628aca9679e757a238Randall Spangler 821eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 822782990277ac7d6730db4c43c2b5632de93396921Bill Richardson# Host library(s) 823eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 824782990277ac7d6730db4c43c2b5632de93396921Bill Richardson# Link tests for local utilities 825782990277ac7d6730db4c43c2b5632de93396921Bill Richardson${BUILD}/host/linktest/main: ${UTILLIB} 826782990277ac7d6730db4c43c2b5632de93396921Bill Richardson${BUILD}/host/linktest/main: LIBS = ${UTILLIB} 82780872dbffcb2e0079bfe095d770ccc6c8bd5fd7aBill RichardsonTEST_OBJS += ${BUILD}/host/linktest/main.o 828782990277ac7d6730db4c43c2b5632de93396921Bill Richardson 829782990277ac7d6730db4c43c2b5632de93396921Bill Richardson.PHONY: utillib 830782990277ac7d6730db4c43c2b5632de93396921Bill Richardsonutillib: ${UTILLIB} \ 831782990277ac7d6730db4c43c2b5632de93396921Bill Richardson ${BUILD}/host/linktest/main 832eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 833eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# TODO: better way to make .a than duplicating this recipe each time? 834aaaff86467823e0d3d29c383402275eeae481256Randall Spangler${UTILLIB}: ${UTILLIB_OBJS} ${FWLIB_OBJS} 835aaaff86467823e0d3d29c383402275eeae481256Randall Spangler @$(PRINTF) " RM $(subst ${BUILD}/,,$@)\n" 836aaaff86467823e0d3d29c383402275eeae481256Randall Spangler ${Q}rm -f $@ 837aaaff86467823e0d3d29c383402275eeae481256Randall Spangler @$(PRINTF) " AR $(subst ${BUILD}/,,$@)\n" 838aaaff86467823e0d3d29c383402275eeae481256Randall Spangler ${Q}ar qc $@ $^ 839aaaff86467823e0d3d29c383402275eeae481256Randall Spangler 840a5b69b02e039d7267390fea10266d45e14630559Randall Spangler.PHONY: utillib21 841a5b69b02e039d7267390fea10266d45e14630559Randall Spanglerutillib21: ${UTILLIB21} 842aaaff86467823e0d3d29c383402275eeae481256Randall Spangler 843108d991c678f80c99967bd07035de7418c81a072Randall Spangler${UTILLIB21}: INCLUDES += -Ihost/lib21/include -Ifirmware/lib21/include 844a5b69b02e039d7267390fea10266d45e14630559Randall Spangler 845a5b69b02e039d7267390fea10266d45e14630559Randall Spangler# TODO: right now, firmware lib 2.1 isn't a complete standalone copy 846108d991c678f80c99967bd07035de7418c81a072Randall Spangler${UTILLIB21}: ${UTILLIB21_OBJS} ${FWLIB2_OBJS} ${FWLIB20_OBJS} ${FWLIB21_OBJS} 847782990277ac7d6730db4c43c2b5632de93396921Bill Richardson @$(PRINTF) " RM $(subst ${BUILD}/,,$@)\n" 848782990277ac7d6730db4c43c2b5632de93396921Bill Richardson ${Q}rm -f $@ 849782990277ac7d6730db4c43c2b5632de93396921Bill Richardson @$(PRINTF) " AR $(subst ${BUILD}/,,$@)\n" 850782990277ac7d6730db4c43c2b5632de93396921Bill Richardson ${Q}ar qc $@ $^ 851782990277ac7d6730db4c43c2b5632de93396921Bill Richardson 852782990277ac7d6730db4c43c2b5632de93396921Bill Richardson 853782990277ac7d6730db4c43c2b5632de93396921Bill Richardson# Link tests for external repos 854782990277ac7d6730db4c43c2b5632de93396921Bill Richardson${BUILD}/host/linktest/extern: ${HOSTLIB} 855782990277ac7d6730db4c43c2b5632de93396921Bill Richardson${BUILD}/host/linktest/extern: LIBS = ${HOSTLIB} 856782990277ac7d6730db4c43c2b5632de93396921Bill Richardson${BUILD}/host/linktest/extern: LDLIBS += -static 85780872dbffcb2e0079bfe095d770ccc6c8bd5fd7aBill RichardsonTEST_OBJS += ${BUILD}/host/linktest/extern.o 858782990277ac7d6730db4c43c2b5632de93396921Bill Richardson 859782990277ac7d6730db4c43c2b5632de93396921Bill Richardson.PHONY: hostlib 860782990277ac7d6730db4c43c2b5632de93396921Bill Richardsonhostlib: ${HOSTLIB} \ 861782990277ac7d6730db4c43c2b5632de93396921Bill Richardson ${BUILD}/host/linktest/extern 862782990277ac7d6730db4c43c2b5632de93396921Bill Richardson 863782990277ac7d6730db4c43c2b5632de93396921Bill Richardson# TODO: better way to make .a than duplicating this recipe each time? 864782990277ac7d6730db4c43c2b5632de93396921Bill Richardson${HOSTLIB}: ${HOSTLIB_OBJS} 865661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " RM $(subst ${BUILD}/,,$@)\n" 866eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}rm -f $@ 867661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " AR $(subst ${BUILD}/,,$@)\n" 868eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}ar qc $@ $^ 869eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 87081a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson 87181a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson# Ugh. This is a very cut-down version of HOSTLIB just for the installer. 87281a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson.PHONY: tinyhostlib 87381a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardsontinyhostlib: ${TINYHOSTLIB} 87481a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson ${Q}cp -f ${TINYHOSTLIB} ${HOSTLIB} 87581a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson 87681a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson${TINYHOSTLIB}: ${TINYHOSTLIB_OBJS} 877661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " RM $(subst ${BUILD}/,,$@)\n" 87881a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson ${Q}rm -f $@ 879661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " AR $(subst ${BUILD}/,,$@)\n" 88081a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson ${Q}ar qc $@ $^ 88181a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson 882eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 883eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# CGPT library and utility 884eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 885eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: cgpt 886eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsoncgpt: ${CGPT} 887eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 888eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${CGPT}: LDFLAGS += -static 889eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${CGPT}: LDLIBS += -luuid 890eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 891782990277ac7d6730db4c43c2b5632de93396921Bill Richardson${CGPT}: ${CGPT_OBJS} ${UTILLIB} 892661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " LDcgpt $(subst ${BUILD}/,,$@)\n" 8936db8c75021e2edfa400ae707a8544d041e3c415fBill Richardson ${Q}${LD} -o ${CGPT} ${CFLAGS} ${LDFLAGS} $^ ${LDLIBS} 894eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 895eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: cgpt_install 896eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsoncgpt_install: ${CGPT} 897661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " INSTALL CGPT\n" 898c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson ${Q}mkdir -p ${UB_DIR} 899c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson ${Q}${INSTALL} -t ${UB_DIR} $^ 900eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 901eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 902eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Utilities 903eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 904eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# These have their own headers too. 9050f6679e8582219b40e2ab5485992827a92c18bcdBill Richardson${BUILD}/utility/%: INCLUDES += -Iutility/include 9060f6679e8582219b40e2ab5485992827a92c18bcdBill Richardson 9070f6679e8582219b40e2ab5485992827a92c18bcdBill Richardson${UTIL_BINS} ${UTIL_BINS_STATIC}: ${UTILLIB} 9080f6679e8582219b40e2ab5485992827a92c18bcdBill Richardson${UTIL_BINS} ${UTIL_BINS_STATIC}: LIBS = ${UTILLIB} 909eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 910eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Utilities for auto-update toolkits must be statically linked. 911eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${UTIL_BINS_STATIC}: LDFLAGS += -static 912eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 913a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson 914acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson.PHONY: utils 915c7c6e5d2f7076fe512b692411f0d05d4bf76d91fBill Richardsonutils: ${UTIL_BINS} ${UTIL_SCRIPTS} 916eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}cp -f ${UTIL_SCRIPTS} ${BUILD}/utility 917eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}chmod a+rx $(patsubst %,${BUILD}/%,${UTIL_SCRIPTS}) 918826db09fcec194951e1dc71002d6a92620fbb46bBill Richardson 919acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson.PHONY: utils_install 920c7c6e5d2f7076fe512b692411f0d05d4bf76d91fBill Richardsonutils_install: ${UTIL_BINS} ${UTIL_SCRIPTS} 921661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " INSTALL UTILS\n" 922c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson ${Q}mkdir -p ${UB_DIR} 923c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson ${Q}${INSTALL} -t ${UB_DIR} ${UTIL_BINS} ${UTIL_SCRIPTS} 924c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson 925c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson# And some signing stuff for the target 926c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson.PHONY: signing_install 927c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardsonsigning_install: ${SIGNING_SCRIPTS} ${SIGNING_SCRIPTS_DEV} ${SIGNING_COMMON} 928661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " INSTALL SIGNING\n" 9296f3961507e73f90cec665896dece884e86be560aBill Richardson ${Q}mkdir -p ${UB_DIR} ${VB_DIR} 930c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson ${Q}${INSTALL} -t ${UB_DIR} ${SIGNING_SCRIPTS} 9316f3961507e73f90cec665896dece884e86be560aBill Richardson ${Q}${INSTALL} -t ${VB_DIR} ${SIGNING_SCRIPTS_DEV} 9326f3961507e73f90cec665896dece884e86be560aBill Richardson ${Q}${INSTALL} -t ${VB_DIR} -m 'u=rw,go=r,a-s' ${SIGNING_COMMON} 9335d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 934eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 935eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# new Firmware Utility 9365d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 937eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: futil 9386db8c75021e2edfa400ae707a8544d041e3c415fBill Richardsonfutil: ${FUTIL_STATIC_BIN} ${FUTIL_BIN} 9396db8c75021e2edfa400ae707a8544d041e3c415fBill Richardson 940aaaff86467823e0d3d29c383402275eeae481256Randall Spangler${FUTIL_STATIC_BIN}: ${FUTIL_STATIC_OBJS} ${UTILLIB} \ 941a5b69b02e039d7267390fea10266d45e14630559Randall Spangler $(if ${VBOOT2},${UTILLIB21}) 9426db8c75021e2edfa400ae707a8544d041e3c415fBill Richardson @$(PRINTF) " LD $(subst ${BUILD}/,,$@)\n" 9436db8c75021e2edfa400ae707a8544d041e3c415fBill Richardson ${Q}${LD} -o $@ ${CFLAGS} ${LDFLAGS} -static $^ ${LDLIBS} 9445d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 945b84b81dc265a766a968bf126905447d442558218Bill Richardson${FUTIL_BIN}: LDLIBS += ${CRYPTO_LIBS} 946a5b69b02e039d7267390fea10266d45e14630559Randall Spangler${FUTIL_BIN}: ${FUTIL_OBJS} ${UTILLIB} $(if ${VBOOT2},${UTILLIB21}) 947661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " LD $(subst ${BUILD}/,,$@)\n" 9486db8c75021e2edfa400ae707a8544d041e3c415fBill Richardson ${Q}${LD} -o $@ ${CFLAGS} ${LDFLAGS} $^ ${LDLIBS} 9495d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 950eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: futil_install 951efa8756c5e7068e57f5e98f0e7f2f42fb8d969d6Bill Richardsonfutil_install: ${FUTIL_BIN} ${FUTIL_STATIC_BIN} 952661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " INSTALL futility\n" 9536f3961507e73f90cec665896dece884e86be560aBill Richardson ${Q}mkdir -p ${UB_DIR} 9546f3961507e73f90cec665896dece884e86be560aBill Richardson ${Q}${INSTALL} -t ${UB_DIR} ${FUTIL_BIN} ${FUTIL_STATIC_BIN} 955a1d9fe6eecf82540d31d34bba988e4838d295302Bill Richardson ${Q}for prog in ${FUTIL_SYMLINKS}; do \ 9566f3961507e73f90cec665896dece884e86be560aBill Richardson ln -sf futility "${UB_DIR}/$$prog"; done 9575d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 958eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 9595d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# Utility to generate TLCL structure definition header file. 9605d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 961acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson${BUILD}/utility/tlcl_generator: CFLAGS += -fpack-struct 9625d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 9635d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerSTRUCTURES_TMP=${BUILD}/tlcl_structures.tmp 9645d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerSTRUCTURES_SRC=firmware/lib/tpm_lite/include/tlcl_structures.h 9655d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 966acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson.PHONY: update_tlcl_structures 9675d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spanglerupdate_tlcl_structures: ${BUILD}/utility/tlcl_generator 968661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " Rebuilding TLCL structures\n" 969eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}${BUILD}/utility/tlcl_generator > ${STRUCTURES_TMP} 970eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}cmp -s ${STRUCTURES_TMP} ${STRUCTURES_SRC} || \ 9715d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler ( echo "%% Updating structures.h %%" && \ 972eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson cp ${STRUCTURES_TMP} ${STRUCTURES_SRC} ) 9735d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 974eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 9755d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# Tests 9765d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 977eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: tests 978eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsontests: ${TEST_BINS} 9795d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 980782990277ac7d6730db4c43c2b5632de93396921Bill Richardson${TEST_BINS}: ${UTILLIB} ${TESTLIB} 981339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson${TEST_BINS}: INCLUDES += -Itests 982efa37b87f2b4cd4b4f515e96201502ae0408cec7Randall Spangler${TEST_BINS}: LIBS = ${TESTLIB} ${UTILLIB} 9835d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 984108d991c678f80c99967bd07035de7418c81a072Randall Spangler${TEST20_BINS}: ${FWLIB20} 985108d991c678f80c99967bd07035de7418c81a072Randall Spangler${TEST20_BINS}: LIBS += ${FWLIB20} 986108d991c678f80c99967bd07035de7418c81a072Randall Spangler 987108d991c678f80c99967bd07035de7418c81a072Randall Spangler${TEST21_BINS}: ${UTILLIB21} 988108d991c678f80c99967bd07035de7418c81a072Randall Spangler${TEST21_BINS}: INCLUDES += -Ihost/lib21/include -Ifirmware/lib21/include 989108d991c678f80c99967bd07035de7418c81a072Randall Spangler${TEST21_BINS}: LIBS += ${UTILLIB21} 990aaaff86467823e0d3d29c383402275eeae481256Randall Spangler 991eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${TESTLIB}: ${TESTLIB_OBJS} 992661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " RM $(subst ${BUILD}/,,$@)\n" 993eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}rm -f $@ 994661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " AR $(subst ${BUILD}/,,$@)\n" 995eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}ar qc $@ $^ 9965d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 9975d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 998eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 999eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Generic build rules. LIBS and OBJS can be overridden to tweak the generic 1000eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# rules for specific targets. 10015d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 1002eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/%: ${BUILD}/%.o ${OBJS} ${LIBS} 1003661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " LD $(subst ${BUILD}/,,$@)\n" 10046db8c75021e2edfa400ae707a8544d041e3c415fBill Richardson ${Q}${LD} -o $@ ${CFLAGS} ${LDFLAGS} $< ${OBJS} ${LIBS} ${LDLIBS} 1005eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 1006eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/%.o: %.c 1007661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " CC $(subst ${BUILD}/,,$@)\n" 1008eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}${CC} ${CFLAGS} ${INCLUDES} -c -o $@ $< 1009eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 1010e08ee28548934e933733babf0bc0c418142d095dAlex Deymo${BUILD}/%.o: ${BUILD}/%.c 1011e08ee28548934e933733babf0bc0c418142d095dAlex Deymo @$(PRINTF) " CC $(subst ${BUILD}/,,$@)\n" 1012e08ee28548934e933733babf0bc0c418142d095dAlex Deymo ${Q}${CC} ${CFLAGS} ${INCLUDES} -c -o $@ $< 1013e08ee28548934e933733babf0bc0c418142d095dAlex Deymo 1014eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Rules to recompile a single source file for library and test 1015eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# TODO: is there a tidier way to do this? 1016eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/%_for_lib.o: CFLAGS += -DFOR_LIBRARY 1017eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/%_for_lib.o: %.c 1018661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " CC-for-lib $(subst ${BUILD}/,,$@)\n" 1019eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}${CC} ${CFLAGS} ${INCLUDES} -c -o $@ $< 1020eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 1021eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/%_for_test.o: CFLAGS += -DFOR_TEST 1022eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/%_for_test.o: %.c 1023661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " CC-for-test $(subst ${BUILD}/,,$@)\n" 1024eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}${CC} ${CFLAGS} ${INCLUDES} -c -o $@ $< 1025eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 1026eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# TODO: C++ files don't belong in vboot reference at all. Convert to C. 1027eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/%.o: %.cc 1028661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " CXX $(subst ${BUILD}/,,$@)\n" 1029eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}${CXX} ${CFLAGS} ${INCLUDES} -c -o $@ $< 1030eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 1031eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 1032eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Here are the special tweaks to the generic rules. 1033eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 1034eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Some utilities need external crypto functions 1035782990277ac7d6730db4c43c2b5632de93396921Bill RichardsonCRYPTO_LIBS := $(shell ${PKG_CONFIG} --libs libcrypto) 1036782990277ac7d6730db4c43c2b5632de93396921Bill Richardson 1037eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/dumpRSAPublicKey: LDLIBS += ${CRYPTO_LIBS} 1038eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/pad_digest_utility: LDLIBS += ${CRYPTO_LIBS} 1039eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/signature_digest_utility: LDLIBS += ${CRYPTO_LIBS} 1040eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 1041eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/host/linktest/main: LDLIBS += ${CRYPTO_LIBS} 1042eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/tests/vboot_common2_tests: LDLIBS += ${CRYPTO_LIBS} 1043eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/tests/vboot_common3_tests: LDLIBS += ${CRYPTO_LIBS} 1044108d991c678f80c99967bd07035de7418c81a072Randall Spangler${BUILD}/tests/vb2_common2_tests: LDLIBS += ${CRYPTO_LIBS} 1045108d991c678f80c99967bd07035de7418c81a072Randall Spangler${BUILD}/tests/vb2_common3_tests: LDLIBS += ${CRYPTO_LIBS} 1046108d991c678f80c99967bd07035de7418c81a072Randall Spangler 1047108d991c678f80c99967bd07035de7418c81a072Randall Spangler${TEST21_BINS}: LDLIBS += ${CRYPTO_LIBS} 1048eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 1049eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/bmpblk_utility: LD = ${CXX} 1050eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/bmpblk_utility: LDLIBS = -llzma -lyaml 1051eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 1052eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonBMPBLK_UTILITY_DEPS = \ 1053eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${BUILD}/utility/bmpblk_util.o \ 1054eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${BUILD}/utility/image_types.o \ 1055eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${BUILD}/utility/eficompress_for_lib.o \ 1056eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${BUILD}/utility/efidecompress_for_lib.o 10571912bbae89b82c10819b01d039e140e39c668fc7Bill Richardson 1058eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/bmpblk_utility: OBJS = ${BMPBLK_UTILITY_DEPS} 1059eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/bmpblk_utility: ${BMPBLK_UTILITY_DEPS} 10601912bbae89b82c10819b01d039e140e39c668fc7Bill RichardsonALL_OBJS += ${BMPBLK_UTILITY_DEPS} 1061eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 1062eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/bmpblk_font: OBJS += ${BUILD}/utility/image_types.o 1063eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/bmpblk_font: ${BUILD}/utility/image_types.o 10641912bbae89b82c10819b01d039e140e39c668fc7Bill RichardsonALL_OBJS += ${BUILD}/utility/image_types.o 1065eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 1066eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Allow multiple definitions, so tests can mock functions from other libraries 1067eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/tests/%: CFLAGS += -Xlinker --allow-multiple-definition 1068eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/tests/%: LDLIBS += -lrt -luuid 1069eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/tests/%: LIBS += ${TESTLIB} 10705d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 10715d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler${BUILD}/tests/rollback_index2_tests: OBJS += \ 107217f8d341099120da78a6ca71165834eefb0960edRandall Spangler ${BUILD}/firmware/lib/rollback_index_for_test.o 1073eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/tests/rollback_index2_tests: \ 1074eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${BUILD}/firmware/lib/rollback_index_for_test.o 107580872dbffcb2e0079bfe095d770ccc6c8bd5fd7aBill RichardsonTEST_OBJS += ${BUILD}/firmware/lib/rollback_index_for_test.o 10765d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 1077c3d488d155961d2849dfdaa4f0461df1aa95c2caRandall Spangler${BUILD}/tests/tlcl_tests: OBJS += \ 1078c3d488d155961d2849dfdaa4f0461df1aa95c2caRandall Spangler ${BUILD}/firmware/lib/tpm_lite/tlcl_for_test.o 1079c3d488d155961d2849dfdaa4f0461df1aa95c2caRandall Spangler${BUILD}/tests/tlcl_tests: \ 1080c3d488d155961d2849dfdaa4f0461df1aa95c2caRandall Spangler ${BUILD}/firmware/lib/tpm_lite/tlcl_for_test.o 108180872dbffcb2e0079bfe095d770ccc6c8bd5fd7aBill RichardsonTEST_OBJS += ${BUILD}/firmware/lib/tpm_lite/tlcl_for_test.o 1082c3d488d155961d2849dfdaa4f0461df1aa95c2caRandall Spangler 10835d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler${BUILD}/tests/vboot_audio_tests: OBJS += \ 108417f8d341099120da78a6ca71165834eefb0960edRandall Spangler ${BUILD}/firmware/lib/vboot_audio_for_test.o 1085eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/tests/vboot_audio_tests: \ 1086eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${BUILD}/firmware/lib/vboot_audio_for_test.o 108780872dbffcb2e0079bfe095d770ccc6c8bd5fd7aBill RichardsonTEST_OBJS += ${BUILD}/firmware/lib/vboot_audio_for_test.o 10885d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 1089339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill RichardsonTLCL_TEST_BINS = $(addprefix ${BUILD}/,${TLCL_TEST_NAMES}) 1090eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${TLCL_TEST_BINS}: OBJS += ${BUILD}/tests/tpm_lite/tlcl_tests.o 1091eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${TLCL_TEST_BINS}: ${BUILD}/tests/tpm_lite/tlcl_tests.o 109280872dbffcb2e0079bfe095d770ccc6c8bd5fd7aBill RichardsonTEST_OBJS += ${BUILD}/tests/tpm_lite/tlcl_tests.o 10935d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 1094e08ee28548934e933733babf0bc0c418142d095dAlex Deymo# ---------------------------------------------------------------------------- 1095e08ee28548934e933733babf0bc0c418142d095dAlex Deymo# Here are the special rules that don't fit in the generic rules. 1096e08ee28548934e933733babf0bc0c418142d095dAlex Deymo 1097e08ee28548934e933733babf0bc0c418142d095dAlex Deymo# Generates the list of commands defined in futility by running grep in the 1098e08ee28548934e933733babf0bc0c418142d095dAlex Deymo# source files looking for the DECLARE_FUTIL_COMMAND() macro usage. 1099e08ee28548934e933733babf0bc0c418142d095dAlex Deymo${FUTIL_STATIC_CMD_LIST}: ${FUTIL_STATIC_SRCS} 1100e08ee28548934e933733babf0bc0c418142d095dAlex Deymo${FUTIL_CMD_LIST}: ${FUTIL_SRCS} 1101e08ee28548934e933733babf0bc0c418142d095dAlex Deymo${FUTIL_CMD_LIST} ${FUTIL_STATIC_CMD_LIST}: 1102e08ee28548934e933733babf0bc0c418142d095dAlex Deymo @$(PRINTF) " GEN $(subst ${BUILD}/,,$@)\n" 1103e08ee28548934e933733babf0bc0c418142d095dAlex Deymo ${Q}rm -f $@ $@_t $@_commands 1104e08ee28548934e933733babf0bc0c418142d095dAlex Deymo ${Q}mkdir -p ${BUILD}/gen 1105779796f57e1e0236ea502248ede2cbea986fca21Bill Richardson ${Q}grep -hoRE '^DECLARE_FUTIL_COMMAND\([^,]+' $^ \ 1106e08ee28548934e933733babf0bc0c418142d095dAlex Deymo | sed 's/DECLARE_FUTIL_COMMAND(\(.*\)/_CMD(\1)/' \ 1107e08ee28548934e933733babf0bc0c418142d095dAlex Deymo | sort >>$@_commands 1108e1486c3234b7dc6fc5b58681b271a65a09141e20Bill Richardson ${Q}./scripts/getversion.sh >> $@_t 1109e08ee28548934e933733babf0bc0c418142d095dAlex Deymo ${Q}echo '#define _CMD(NAME) extern const struct' \ 1110e08ee28548934e933733babf0bc0c418142d095dAlex Deymo 'futil_cmd_t __cmd_##NAME;' >> $@_t 1111e08ee28548934e933733babf0bc0c418142d095dAlex Deymo ${Q}cat $@_commands >> $@_t 1112e08ee28548934e933733babf0bc0c418142d095dAlex Deymo ${Q}echo '#undef _CMD' >> $@_t 1113e08ee28548934e933733babf0bc0c418142d095dAlex Deymo ${Q}echo '#define _CMD(NAME) &__cmd_##NAME,' >> $@_t 1114e08ee28548934e933733babf0bc0c418142d095dAlex Deymo ${Q}echo 'const struct futil_cmd_t *const futil_cmds[] = {' >> $@_t 1115e08ee28548934e933733babf0bc0c418142d095dAlex Deymo ${Q}cat $@_commands >> $@_t 1116e08ee28548934e933733babf0bc0c418142d095dAlex Deymo ${Q}echo '0}; /* null-terminated */' >> $@_t 1117e08ee28548934e933733babf0bc0c418142d095dAlex Deymo ${Q}echo '#undef _CMD' >> $@_t 1118e08ee28548934e933733babf0bc0c418142d095dAlex Deymo ${Q}mv $@_t $@ 1119e08ee28548934e933733babf0bc0c418142d095dAlex Deymo ${Q}rm -f $@_commands 1120e08ee28548934e933733babf0bc0c418142d095dAlex Deymo 1121eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson############################################################################## 1122eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Targets that exist just to run tests 11235d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 11245d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# Frequently-run tests 1125eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: test_targets 1126786acdabcc15f023330d7c628aca9679e757a238Randall Spanglertest_targets:: runcgpttests runmisctests $(if ${VBOOT2},run2tests) 1127844bce57471153664c78993dab453e87891bb969Randall Spangler 1128eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${MINIMAL},) 1129844bce57471153664c78993dab453e87891bb969Randall Spangler# Bitmap utility isn't compiled for minimal variant 1130feb2518166b1cd181e607c611cbb610f0c7300daBill Richardsontest_targets:: runbmptests runfutiltests 1131844bce57471153664c78993dab453e87891bb969Randall Spangler# Scripts don't work under qemu testing 1132844bce57471153664c78993dab453e87891bb969Randall Spangler# TODO: convert scripts to makefile so they can be called directly 1133eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsontest_targets:: runtestscripts 1134844bce57471153664c78993dab453e87891bb969Randall Spanglerendif 1135844bce57471153664c78993dab453e87891bb969Randall Spangler 1136eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: test_setup 11373e3790d00827e75d39b77a14bca2756a14a51b3cBill Richardsontest_setup:: cgpt utils futil tests install_for_test 1138eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 1139844bce57471153664c78993dab453e87891bb969Randall Spangler# Qemu setup for cross-compiled tests. Need to copy qemu binary into the 1140844bce57471153664c78993dab453e87891bb969Randall Spangler# sysroot. 1141eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifneq (${QEMU_ARCH},) 1142eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsontest_setup:: qemu_install 1143844bce57471153664c78993dab453e87891bb969Randall Spangler 1144844bce57471153664c78993dab453e87891bb969Randall Spangler.PHONY: qemu_install 1145844bce57471153664c78993dab453e87891bb969Randall Spanglerqemu_install: 1146eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${SYSROOT},) 1147eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson $(error SYSROOT must be set to the top of the target-specific root \ 1148eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonwhen cross-compiling for qemu-based tests to run properly.) 1149eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonendif 1150661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " Copying qemu binary.\n" 1151eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}cp -fu /usr/bin/${QEMU_BIN} ${BUILD}/${QEMU_BIN} 1152eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}chmod a+rx ${BUILD}/${QEMU_BIN} 1153844bce57471153664c78993dab453e87891bb969Randall Spanglerendif 1154844bce57471153664c78993dab453e87891bb969Randall Spangler 1155acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson.PHONY: runtests 1156a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardsonruntests: test_setup test_targets 11575d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 11585d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# Generate test keys 1159acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson.PHONY: genkeys 1160844bce57471153664c78993dab453e87891bb969Randall Spanglergenkeys: utils 11615d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler tests/gen_test_keys.sh 11625d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 11635d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# Generate test cases for fuzzing 1164acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson.PHONY: genfuzztestcases 1165a808dc944284e6eba39a8f19ddb46bc61c34de8aRandall Spanglergenfuzztestcases: utils 11665d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler tests/gen_fuzz_test_cases.sh 11675d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 1168acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson.PHONY: runbmptests 1169eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonrunbmptests: test_setup 1170eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson cd tests/bitmaps && BMPBLK=${BUILD_RUN}/utility/bmpblk_utility \ 11715d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler ./TestBmpBlock.py -v 11725d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 1173acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson.PHONY: runcgpttests 1174eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonruncgpttests: test_setup 1175eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/cgptlib_test 11765d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 1177844bce57471153664c78993dab453e87891bb969Randall Spangler.PHONY: runtestscripts 1178eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonruntestscripts: test_setup genfuzztestcases 1179b8ff397674fb98c1d7eea864e7fa571369675131Randall Spangler tests/load_kernel_tests.sh 1180eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson tests/run_cgpt_tests.sh ${BUILD_RUN}/cgpt/cgpt 1181ab899591808dd3e5f955ab7693b54a83389cd35fNam T. Nguyen tests/run_cgpt_tests.sh ${BUILD_RUN}/cgpt/cgpt -D 358400 11825d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler tests/run_preamble_tests.sh 11835d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler tests/run_rsa_tests.sh 1184844bce57471153664c78993dab453e87891bb969Randall Spangler tests/run_vbutil_kernel_arg_tests.sh 11855d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler tests/run_vbutil_tests.sh 1186e166d04e797b605dd2f6784bc863a262c418c0c4Randall Spanglerifneq (${VBOOT2},) 1187e166d04e797b605dd2f6784bc863a262c418c0c4Randall Spangler tests/vb2_rsa_tests.sh 1188539cbc27305b6aef9643adffc3297c7079fe7457Randall Spangler tests/vb2_firmware_tests.sh 1189e166d04e797b605dd2f6784bc863a262c418c0c4Randall Spanglerendif 11905d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 1191844bce57471153664c78993dab453e87891bb969Randall Spangler.PHONY: runmisctests 1192eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonrunmisctests: test_setup 1193eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/rollback_index2_tests 1194a3eac79f5070747e326da631c1eec155f0389919Randall Spangler ${RUNTEST} ${BUILD_RUN}/tests/rollback_index3_tests 1195eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/rsa_utility_tests 1196eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/sha_tests 1197eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/stateful_util_tests 1198c3d488d155961d2849dfdaa4f0461df1aa95c2caRandall Spangler ${RUNTEST} ${BUILD_RUN}/tests/tlcl_tests 1199eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/tpm_bootmode_tests 1200eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/utility_string_tests 1201eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/utility_tests 1202eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_devmode_tests 1203eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_firmware_tests 12040714d9de56da3a5c686b26755d15aa6788c727d4Randall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_init_tests 12050714d9de56da3a5c686b26755d15aa6788c727d4Randall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_kernel_tests 12067f43669630cb42e40ca6ddc1128eefea8fd339d9Randall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_kernel2_tests 12077f43669630cb42e40ca6ddc1128eefea8fd339d9Randall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_kernel3_tests 12087f43669630cb42e40ca6ddc1128eefea8fd339d9Randall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_kernel4_tests 1209eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/vboot_audio_tests 1210e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_common_tests 1211e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_common2_tests ${TEST_KEYS} 1212e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_common3_tests ${TEST_KEYS} 1213786a5dca74387de5ffdc51ca5a099a4e90f406daRandall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_display_tests 1214eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/vboot_firmware_tests 121549cb0d3471e768da11fe76b65769bd57dca38bd7Randall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_kernel_tests 12166dbf9d9160b2927d76017d0f51919e0880f9b2ccRandall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_nvstorage_test 1217eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 1218786acdabcc15f023330d7c628aca9679e757a238Randall Spangler.PHONY: run2tests 1219786acdabcc15f023330d7c628aca9679e757a238Randall Spanglerrun2tests: test_setup 1220a7ab8b50b8923afcfd7a9e6181892c4c8a2de250Randall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vb2_api_tests 1221786acdabcc15f023330d7c628aca9679e757a238Randall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vb2_common_tests 12227141d73c149ee203a192f0cb45ca9bfa10c0ff8cRandall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vb2_common2_tests ${TEST_KEYS} 12237141d73c149ee203a192f0cb45ca9bfa10c0ff8cRandall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vb2_common3_tests ${TEST_KEYS} 12243333e578497aafc4eb8c6e1e359f6e2b1dee633aRandall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vb2_misc_tests 12251803068173a625efd83d1cee8dd90843feb0d972Randall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vb2_misc2_tests 12263333e578497aafc4eb8c6e1e359f6e2b1dee633aRandall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vb2_nvstorage_tests 1227e166d04e797b605dd2f6784bc863a262c418c0c4Randall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vb2_rsa_utility_tests 12283333e578497aafc4eb8c6e1e359f6e2b1dee633aRandall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vb2_secdata_tests 1229e166d04e797b605dd2f6784bc863a262c418c0c4Randall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vb2_sha_tests 1230108d991c678f80c99967bd07035de7418c81a072Randall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vb21_api_tests 1231108d991c678f80c99967bd07035de7418c81a072Randall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vb21_common_tests 1232108d991c678f80c99967bd07035de7418c81a072Randall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vb21_common2_tests ${TEST_KEYS} 1233108d991c678f80c99967bd07035de7418c81a072Randall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vb21_misc_tests 1234108d991c678f80c99967bd07035de7418c81a072Randall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vb21_host_fw_preamble_tests ${TEST_KEYS} 1235108d991c678f80c99967bd07035de7418c81a072Randall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vb21_host_key_tests ${TEST_KEYS} 1236108d991c678f80c99967bd07035de7418c81a072Randall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vb21_host_keyblock_tests ${TEST_KEYS} 1237108d991c678f80c99967bd07035de7418c81a072Randall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vb21_host_misc_tests 1238108d991c678f80c99967bd07035de7418c81a072Randall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vb21_host_sig_tests ${TEST_KEYS} 1239786acdabcc15f023330d7c628aca9679e757a238Randall Spangler 1240eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: runfutiltests 12413e3790d00827e75d39b77a14bca2756a14a51b3cBill Richardsonrunfutiltests: test_setup 1242efa8756c5e7068e57f5e98f0e7f2f42fb8d969d6Bill Richardson tests/futility/run_test_scripts.sh ${TEST_INSTALL_DIR}/bin 1243339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/futility/test_not_really 1244844bce57471153664c78993dab453e87891bb969Randall Spangler 12455d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# Run long tests, including all permutations of encryption keys (instead of 1246786a5dca74387de5ffdc51ca5a099a4e90f406daRandall Spangler# just the ones we use) and tests of currently-unused code. 12475d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# Not run by automated build. 1248acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson.PHONY: runlongtests 1249eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonrunlongtests: test_setup genkeys genfuzztestcases 1250e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_common2_tests ${TEST_KEYS} --all 1251e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_common3_tests ${TEST_KEYS} --all 12527141d73c149ee203a192f0cb45ca9bfa10c0ff8cRandall Spanglerifneq (${VBOOT2},) 12537141d73c149ee203a192f0cb45ca9bfa10c0ff8cRandall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vb2_common2_tests ${TEST_KEYS} --all 12547141d73c149ee203a192f0cb45ca9bfa10c0ff8cRandall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vb2_common3_tests ${TEST_KEYS} --all 1255108d991c678f80c99967bd07035de7418c81a072Randall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vb21_common2_tests ${TEST_KEYS} --all 12567141d73c149ee203a192f0cb45ca9bfa10c0ff8cRandall Spanglerendif 12575d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler tests/run_preamble_tests.sh --all 12585d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler tests/run_vbutil_tests.sh --all 12595d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 126078d59bffec45da47b4e8a763186723192dd24f87Bill Richardson# TODO: There were a number of ancient tests that hadn't been run in years. 126178d59bffec45da47b4e8a763186723192dd24f87Bill Richardson# They were removed with https://chromium-review.googlesource.com/#/c/214610/ 126278d59bffec45da47b4e8a763186723192dd24f87Bill Richardson# Some day it might be nice to see what they were supposed to do. 12635d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 1264782990277ac7d6730db4c43c2b5632de93396921Bill Richardson.PHONY: runalltests 1265782990277ac7d6730db4c43c2b5632de93396921Bill Richardsonrunalltests: runtests runfutiltests runlongtests 1266782990277ac7d6730db4c43c2b5632de93396921Bill Richardson 126759d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler# Code coverage 126859d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler.PHONY: coverage_init 126959d7508c2261a8371715b28f663b8b2efbb5a895Randall Spanglercoverage_init: test_setup 127059d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler rm -f ${COV_INFO}* 127159d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler lcov -c -i -d . -b . -o ${COV_INFO}.initial 127259d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler 127359d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler.PHONY: coverage_html 127459d7508c2261a8371715b28f663b8b2efbb5a895Randall Spanglercoverage_html: 127559d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler lcov -c -d . -b . -o ${COV_INFO}.tests 127659d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler lcov -a ${COV_INFO}.initial -a ${COV_INFO}.tests -o ${COV_INFO}.total 127759d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler lcov -r ${COV_INFO}.total '/usr/*' '*/linktest/*' -o ${COV_INFO}.local 127859d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler genhtml ${COV_INFO}.local -o ${BUILD}/coverage 1279d2d08b2cc68f720a485cdfa6f044ddb234e8c42bBill Richardson# Generate addtional coverage stats just for firmware subdir, because the stats 1280d2d08b2cc68f720a485cdfa6f044ddb234e8c42bBill Richardson# for the whole project don't include subdirectory summaries. This will print 1281d2d08b2cc68f720a485cdfa6f044ddb234e8c42bBill Richardson# the summary for just the firmware sources. 128249cb0d3471e768da11fe76b65769bd57dca38bd7Randall Spangler lcov -r ${COV_INFO}.local '*/stub/*' -o ${COV_INFO}.nostub 128349cb0d3471e768da11fe76b65769bd57dca38bd7Randall Spangler lcov -e ${COV_INFO}.nostub '${SRCDIR}/firmware/*' \ 128459d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler -o ${COV_INFO}.firmware 128559d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler 128659d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler.PHONY: coverage 128759d7508c2261a8371715b28f663b8b2efbb5a895Randall Spanglerifeq (${COV},) 128859d7508c2261a8371715b28f663b8b2efbb5a895Randall Spanglercoverage: 128959d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler $(error Build coverage like this: make clean && COV=1 make) 129059d7508c2261a8371715b28f663b8b2efbb5a895Randall Spanglerelse 129159d7508c2261a8371715b28f663b8b2efbb5a895Randall Spanglercoverage: coverage_init runtests coverage_html 129259d7508c2261a8371715b28f663b8b2efbb5a895Randall Spanglerendif 12931912bbae89b82c10819b01d039e140e39c668fc7Bill Richardson 12941912bbae89b82c10819b01d039e140e39c668fc7Bill Richardson# Include generated dependencies 12951912bbae89b82c10819b01d039e140e39c668fc7Bill RichardsonALL_DEPS += ${ALL_OBJS:%.o=%.o.d} 129680872dbffcb2e0079bfe095d770ccc6c8bd5fd7aBill RichardsonTEST_DEPS += ${TEST_OBJS:%.o=%.o.d} 129780872dbffcb2e0079bfe095d770ccc6c8bd5fd7aBill Richardson 129880872dbffcb2e0079bfe095d770ccc6c8bd5fd7aBill Richardson# We want to use only relative paths in cscope.files, especially since the 129980872dbffcb2e0079bfe095d770ccc6c8bd5fd7aBill Richardson# paths inside and outside the chroot are different. 130080872dbffcb2e0079bfe095d770ccc6c8bd5fd7aBill RichardsonSRCDIRPAT=$(subst /,\/,${SRCDIR}/) 130180872dbffcb2e0079bfe095d770ccc6c8bd5fd7aBill Richardson 130280872dbffcb2e0079bfe095d770ccc6c8bd5fd7aBill Richardson${BUILD}/cscope.files: test_setup 130380872dbffcb2e0079bfe095d770ccc6c8bd5fd7aBill Richardson ${Q}rm -f $@ 130480872dbffcb2e0079bfe095d770ccc6c8bd5fd7aBill Richardson ${Q}cat ${ALL_DEPS} | tr -d ':\\' | tr ' ' '\012' | \ 130580872dbffcb2e0079bfe095d770ccc6c8bd5fd7aBill Richardson sed -e "s/${SRCDIRPAT}//" | \ 130680872dbffcb2e0079bfe095d770ccc6c8bd5fd7aBill Richardson egrep '\.[chS]$$' | sort | uniq > $@ 130780872dbffcb2e0079bfe095d770ccc6c8bd5fd7aBill Richardson 130880872dbffcb2e0079bfe095d770ccc6c8bd5fd7aBill Richardsoncmd_etags = etags -o ${BUILD}/TAGS $(shell cat ${BUILD}/cscope.files) 130980872dbffcb2e0079bfe095d770ccc6c8bd5fd7aBill Richardsoncmd_ctags = ctags -o ${BUILD}/tags $(shell cat ${BUILD}/cscope.files) 131080872dbffcb2e0079bfe095d770ccc6c8bd5fd7aBill Richardsonrun_if_prog = $(if $(shell which $(1) 2>/dev/null),$(2),) 131180872dbffcb2e0079bfe095d770ccc6c8bd5fd7aBill Richardson 131280872dbffcb2e0079bfe095d770ccc6c8bd5fd7aBill Richardson.PHONY: tags TAGS xrefs 131380872dbffcb2e0079bfe095d770ccc6c8bd5fd7aBill Richardsontags TAGS xrefs: ${BUILD}/cscope.files 131480872dbffcb2e0079bfe095d770ccc6c8bd5fd7aBill Richardson ${Q}\rm -f ${BUILD}/tags ${BUILD}/TAGS 131580872dbffcb2e0079bfe095d770ccc6c8bd5fd7aBill Richardson ${Q}$(call run_if_prog,etags,${cmd_etags}) 131680872dbffcb2e0079bfe095d770ccc6c8bd5fd7aBill Richardson ${Q}$(call run_if_prog,ctags,${cmd_ctags}) 1317