Makefile revision 42c08cb2dac102509491810361e239fbde52b9e0
1e8cfa31d548c069d73c304fea522b527fe7c7dd6Randall Spangler# Copyright (c) 2013 The Chromium OS Authors. All rights reserved. 2322536d2f9d30f42218cc9f2ab40574557da8a9Gaurav Shah# Use of this source code is governed by a BSD-style license that can be 3322536d2f9d30f42218cc9f2ab40574557da8a9Gaurav Shah# found in the LICENSE file. 4322536d2f9d30f42218cc9f2ab40574557da8a9Gaurav Shah 56d696e532c6a0c93ad9b915c59dad4144e6f1b33Simon Glass# This Makefile normally builds in a 'build' subdir, but use 66d696e532c6a0c93ad9b915c59dad4144e6f1b33Simon Glass# 76d696e532c6a0c93ad9b915c59dad4144e6f1b33Simon Glass# make BUILD=<dir> 86d696e532c6a0c93ad9b915c59dad4144e6f1b33Simon Glass# 9eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# to put the output somewhere else. 10eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 11eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson############################################################################## 12eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Make variables come in two flavors, immediate or deferred. 13eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# 14eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Variable definitions are parsed like this: 15eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# 16eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# IMMEDIATE = DEFERRED 17eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# or 18eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# IMMEDIATE := IMMEDIATE 19eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# 20eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Rules are parsed this way: 21eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# 22eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# IMMEDIATE : IMMEDIATE 23eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# DEFERRED 24eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# 25eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# So you can assign variables in any order if they're only to be used in 26eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# actions, but if you use a variable in either the target or prerequisite of a 27eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# rule, the rule will be constructed using only the top-down, immediate value. 28eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# 29eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# So we'll try to define all the variables first. Then the rules. 30eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# 31eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 32eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson############################################################################## 33eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Configuration variables come first. 34eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# 35eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Our convention is that we only use := for variables that will never be 36eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# changed or appended. They must be defined before being used anywhere. 37eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 38c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson# We should only run pwd once, not every time we refer to ${BUILD}. 39e061a256549607a56d771eb8ddae5d0dd90d519cRandall SpanglerSRCDIR := $(shell pwd) 40feb2518166b1cd181e607c611cbb610f0c7300daBill RichardsonBUILD = $(SRCDIR)/build 41844bce57471153664c78993dab453e87891bb969Randall Spanglerexport BUILD 425d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 43c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson# Stuff for 'make install' 44feb2518166b1cd181e607c611cbb610f0c7300daBill RichardsonINSTALL = install 45feb2518166b1cd181e607c611cbb610f0c7300daBill RichardsonDESTDIR = /usr/local/bin 46feb2518166b1cd181e607c611cbb610f0c7300daBill RichardsonOLDDIR = old_bins 47feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson 48feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson# Where exactly do the pieces go? 49feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson# FT_DIR = futility target directory - where it will be on the target 50feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson# F_DIR = futility install directory - where it gets put right now 51feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson# UB_DIR = userspace binary directory for futility's exec() targets 52feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson# VB_DIR = target vboot directory - for dev-mode-only helpers, keys, etc. 53c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardsonifeq (${MINIMAL},) 54c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson# Host install just puts everything in one place 55feb2518166b1cd181e607c611cbb610f0c7300daBill RichardsonFT_DIR=${DESTDIR} 56feb2518166b1cd181e607c611cbb610f0c7300daBill RichardsonF_DIR=${DESTDIR} 57feb2518166b1cd181e607c611cbb610f0c7300daBill RichardsonUB_DIR=${DESTDIR}/${OLDDIR} 58c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardsonelse 59c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson# Target install puts things into DESTDIR subdirectories 60feb2518166b1cd181e607c611cbb610f0c7300daBill RichardsonFT_DIR=/usr/bin 61feb2518166b1cd181e607c611cbb610f0c7300daBill RichardsonF_DIR=${DESTDIR}${FT_DIR} 62feb2518166b1cd181e607c611cbb610f0c7300daBill RichardsonUB_DIR=${F_DIR}/${OLDDIR} 63c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill RichardsonVB_DIR=${DESTDIR}/usr/share/vboot/bin 64c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardsonendif 656d696e532c6a0c93ad9b915c59dad4144e6f1b33Simon Glass 66eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Where to install the (exportable) executables for testing? 67eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonTEST_INSTALL_DIR = ${BUILD}/install_for_test 68eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 69eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Verbose? Use V=1 70eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${V},) 71eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonQ := @ 72eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonendif 73eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 74661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass# Quiet? Use QUIET=1 75661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glassifeq ($(QUIET),) 76661ae9e9cbaad430b87b443712d2608f9ce59883Simon GlassPRINTF := printf 77661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glasselse 78661ae9e9cbaad430b87b443712d2608f9ce59883Simon GlassPRINTF := : 79661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glassendif 80661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass 8161a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler# Architecture detection 8261a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler_machname := $(shell uname -m) 8361a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall SpanglerHOST_ARCH ?= ${_machname} 8461a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler 8561a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler# ARCH and/or FIRMWARE_ARCH are defined by the Chromium OS ebuild. 8661a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler# Pick a sane target architecture if none is defined. 8761a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spanglerifeq (${ARCH},) 8861a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler ARCH := ${HOST_ARCH} 8961a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spanglerelse ifeq (${ARCH},i386) 9061a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler override ARCH := x86 9161a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spanglerelse ifeq (${ARCH},amd64) 9261a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler override ARCH := x86_64 9361a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spanglerendif 9461a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler 9561a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler# FIRMWARE_ARCH is only defined by the Chromium OS ebuild if compiling 9661a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler# for a firmware target (such as u-boot or depthcharge). It must map 9761a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler# to the same consistent set of architectures as the host. 9861a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spanglerifeq (${FIRMWARE_ARCH},i386) 9961a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler override FIRMWARE_ARCH := x86 10061a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spanglerelse ifeq (${FIRMWARE_ARCH},amd64) 10161a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler override FIRMWARE_ARCH := x86_64 10261a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spanglerendif 10361a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spangler 104b265c34321c01bd279f3a1df0a2fea3601f732eeSimon Glass# Provide default CC and CFLAGS for firmware builds; if you have any -D flags, 105b265c34321c01bd279f3a1df0a2fea3601f732eeSimon Glass# please add them after this point (e.g., -DVBOOT_DEBUG). 10674359b755c4a203df0fe3bf51fc53d5de87d1fbfChe-Liang Chiou# 1076b0003c6381a7e69818b0b34b358c2cfb1393043Che-Liang Chiou# TODO(crosbug.com/16808) We hard-code u-boot's compiler flags here just 1086b0003c6381a7e69818b0b34b358c2cfb1393043Che-Liang Chiou# temporarily. As we are still investigating which flags are necessary for 1096b0003c6381a7e69818b0b34b358c2cfb1393043Che-Liang Chiou# maintaining a compatible ABI, etc. between u-boot and vboot_reference. 11074359b755c4a203df0fe3bf51fc53d5de87d1fbfChe-Liang Chiou# 111b265c34321c01bd279f3a1df0a2fea3601f732eeSimon Glass# As a first step, this makes the setting of CC and CFLAGS here optional, to 112b265c34321c01bd279f3a1df0a2fea3601f732eeSimon Glass# permit a calling script or Makefile to set these. 11374359b755c4a203df0fe3bf51fc53d5de87d1fbfChe-Liang Chiou# 114b265c34321c01bd279f3a1df0a2fea3601f732eeSimon Glass# Flag ordering: arch, then -f, then -m, then -W 115b265c34321c01bd279f3a1df0a2fea3601f732eeSimon GlassDEBUG_FLAGS := $(if ${DEBUG},-g -O0,-Os) 116b265c34321c01bd279f3a1df0a2fea3601f732eeSimon GlassCOMMON_FLAGS := -nostdinc -pipe \ 117b265c34321c01bd279f3a1df0a2fea3601f732eeSimon Glass -ffreestanding -fno-builtin -fno-stack-protector \ 118eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson -Werror -Wall -Wstrict-prototypes ${DEBUG_FLAGS} 119b265c34321c01bd279f3a1df0a2fea3601f732eeSimon Glass 120eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Note: FIRMWARE_ARCH is defined by the Chromium OS ebuild. 121eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${FIRMWARE_ARCH}, arm) 122b265c34321c01bd279f3a1df0a2fea3601f732eeSimon GlassCC ?= armv7a-cros-linux-gnueabi-gcc 123b265c34321c01bd279f3a1df0a2fea3601f732eeSimon GlassCFLAGS ?= -march=armv5 \ 124b265c34321c01bd279f3a1df0a2fea3601f732eeSimon Glass -fno-common -ffixed-r8 \ 125d50b27d15de8cc9e37410fc52d3184f17e0db5bbDoug Anderson -mfloat-abi=hard -marm -mabi=aapcs-linux -mno-thumb-interwork \ 126eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${COMMON_FLAGS} 12761a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spanglerelse ifeq (${FIRMWARE_ARCH}, x86) 128b265c34321c01bd279f3a1df0a2fea3601f732eeSimon GlassCC ?= i686-pc-linux-gnu-gcc 129b265c34321c01bd279f3a1df0a2fea3601f732eeSimon Glass# Drop -march=i386 to permit use of SSE instructions 130b265c34321c01bd279f3a1df0a2fea3601f732eeSimon GlassCFLAGS ?= \ 131b265c34321c01bd279f3a1df0a2fea3601f732eeSimon Glass -ffunction-sections -fvisibility=hidden -fno-strict-aliasing \ 132b265c34321c01bd279f3a1df0a2fea3601f732eeSimon Glass -fomit-frame-pointer -fno-toplevel-reorder -fno-dwarf2-cfi-asm \ 133b265c34321c01bd279f3a1df0a2fea3601f732eeSimon Glass -mpreferred-stack-boundary=2 -mregparm=3 \ 134eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${COMMON_FLAGS} 135eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonelse ifeq (${FIRMWARE_ARCH}, x86_64) 136eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonCFLAGS ?= ${COMMON_FLAGS} \ 1378e85e987739281161ece1dbc9ff2b73f3e8e1e35Simon Glass -fvisibility=hidden -fno-strict-aliasing -fomit-frame-pointer 138844bce57471153664c78993dab453e87891bb969Randall Spanglerelse 139eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# FIRMWARE_ARCH not defined; assuming local compile. 140eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonCC ?= gcc 141eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonCFLAGS += -DCHROMEOS_ENVIRONMENT -Wall -Werror # HEY: always want last two? 1428e85e987739281161ece1dbc9ff2b73f3e8e1e35Simon Glassendif 14334be8273e0fb80a6654deab650e581b0dc9046a4Che-Liang Chiou 144feb2518166b1cd181e607c611cbb610f0c7300daBill Richardsonifneq (${OLDDIR},) 145feb2518166b1cd181e607c611cbb610f0c7300daBill RichardsonCFLAGS += -DOLDDIR=${OLDDIR} 146feb2518166b1cd181e607c611cbb610f0c7300daBill Richardsonendif 147feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson 148eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifneq (${DEBUG},) 149eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonCFLAGS += -DVBOOT_DEBUG 150eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonendif 151844bce57471153664c78993dab453e87891bb969Randall Spangler 152eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${DISABLE_NDEBUG},) 153eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonCFLAGS += -DNDEBUG 154eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonendif 155eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 156feb2518166b1cd181e607c611cbb610f0c7300daBill Richardsonifneq (${FORCE_LOGGING_ON},) 157feb2518166b1cd181e607c611cbb610f0c7300daBill RichardsonCFLAGS += -DFORCE_LOGGING_ON=${FORCE_LOGGING_ON} 158feb2518166b1cd181e607c611cbb610f0c7300daBill Richardsonendif 159feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson 160eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Create / use dependency files 161eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonCFLAGS += -MMD -MF $@.d 162eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 1630c3ba249abb1dc60f5ebabccf84ff13206440b83Bill Richardson# These are required to access large disks and files on 32-bit systems. 1640c3ba249abb1dc60f5ebabccf84ff13206440b83Bill RichardsonCFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 1650c3ba249abb1dc60f5ebabccf84ff13206440b83Bill Richardson 16659d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler# Code coverage 167eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifneq (${COV},) 16859d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler COV_FLAGS = -O0 --coverage 16959d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler CFLAGS += ${COV_FLAGS} 17059d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler LDFLAGS += ${COV_FLAGS} 17159d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler COV_INFO = ${BUILD}/coverage.info 172eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonendif 173eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 174eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# And a few more default utilities 175eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonLD = ${CC} 176eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonCXX ?= g++ # HEY: really? 177eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonPKG_CONFIG ?= pkg-config 178eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 179844bce57471153664c78993dab453e87891bb969Randall Spangler# Determine QEMU architecture needed, if any 180eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${ARCH},${HOST_ARCH}) 181844bce57471153664c78993dab453e87891bb969Randall Spangler # Same architecture; no need for QEMU 182844bce57471153664c78993dab453e87891bb969Randall Spangler QEMU_ARCH := 18361a2eb389d9903b1b5a88d3e11ad5d713b3a364aRandall Spanglerelse ifeq (${HOST_ARCH}-${ARCH},x86_64-x86) 184844bce57471153664c78993dab453e87891bb969Randall Spangler # 64-bit host can run 32-bit targets directly 185844bce57471153664c78993dab453e87891bb969Randall Spangler QEMU_ARCH := 186844bce57471153664c78993dab453e87891bb969Randall Spanglerelse 187eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson QEMU_ARCH := ${ARCH} 188844bce57471153664c78993dab453e87891bb969Randall Spanglerendif 189844bce57471153664c78993dab453e87891bb969Randall Spangler 190844bce57471153664c78993dab453e87891bb969Randall Spangler# The top of the chroot for qemu must be passed in via the SYSROOT environment 191844bce57471153664c78993dab453e87891bb969Randall Spangler# variable. In the Chromium OS chroot, this is done automatically by the 192844bce57471153664c78993dab453e87891bb969Randall Spangler# ebuild. 193844bce57471153664c78993dab453e87891bb969Randall Spangler 194eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${QEMU_ARCH},) 195844bce57471153664c78993dab453e87891bb969Randall Spangler # Path to build output for running tests is same as for building 196eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson BUILD_RUN = ${BUILD} 197e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spangler SRC_RUN = ${SRCDIR} 198844bce57471153664c78993dab453e87891bb969Randall Spanglerelse 199844bce57471153664c78993dab453e87891bb969Randall Spangler $(info Using qemu for testing.) 200844bce57471153664c78993dab453e87891bb969Randall Spangler # Path to build output for running tests is different in the chroot 201eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson BUILD_RUN = $(subst ${SYSROOT},,${BUILD}) 202e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spangler SRC_RUN = $(subst ${SYSROOT},,${SRCDIR}) 203844bce57471153664c78993dab453e87891bb969Randall Spangler 204eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson QEMU_BIN = qemu-${QEMU_ARCH} 205e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spangler QEMU_RUN = ${BUILD_RUN}/${QEMU_BIN} 206e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spangler export QEMU_RUN 207287beaed7f8ceff679c57664d4da008c6234edfdRandall Spangler 208e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spangler RUNTEST = tests/test_using_qemu.sh 209e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spanglerendif 2105d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 211e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spanglerexport BUILD_RUN 2125d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 213eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson############################################################################## 214eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Now we need to describe everything we might want or need to build 215b265c34321c01bd279f3a1df0a2fea3601f732eeSimon Glass 216eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Everything wants these headers. 2175d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerINCLUDES += \ 2185d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler -Ifirmware/include \ 2195d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler -Ifirmware/lib/include \ 2205d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler -Ifirmware/lib/cgptlib/include \ 2215d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler -Ifirmware/lib/cryptolib/include \ 2225d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler -Ifirmware/lib/tpm_lite/include 2230b8f35c6a56a0e645254dd7f07ca68e01c8ee629Bill Richardson 224eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# If we're not building for a specific target, just stub out things like the 225eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# TPM commands and various external functions that are provided by the BIOS. 226eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${FIRMWARE_ARCH},) 2275d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerINCLUDES += -Ifirmware/stub/include 2280a0e8d0bb26c951a895c5034a4c1c12f3d4e8707Che-Liang Chiouelse 229eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonINCLUDES += -Ifirmware/arch/${FIRMWARE_ARCH}/include 2305d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spanglerendif 2315d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 232eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Firmware library. TODO: Do we still need to export this? 233eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonFWLIB = ${BUILD}/vboot_fw.a 2345d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 23593943266c597ad66300445a04afa01270f2b5763Randall Spangler# Firmware library sources needed by VbInit() call 23693943266c597ad66300445a04afa01270f2b5763Randall SpanglerVBINIT_SRCS = \ 2375d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/crc8.c \ 23893943266c597ad66300445a04afa01270f2b5763Randall Spangler firmware/lib/utility.c \ 23993943266c597ad66300445a04afa01270f2b5763Randall Spangler firmware/lib/vboot_api_init.c \ 24093943266c597ad66300445a04afa01270f2b5763Randall Spangler firmware/lib/vboot_common_init.c \ 24193943266c597ad66300445a04afa01270f2b5763Randall Spangler firmware/lib/vboot_nvstorage.c \ 24293943266c597ad66300445a04afa01270f2b5763Randall Spangler 24393943266c597ad66300445a04afa01270f2b5763Randall Spangler# Additional firmware library sources needed by VbSelectFirmware() call 24493943266c597ad66300445a04afa01270f2b5763Randall SpanglerVBSF_SRCS = \ 2455d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/cryptolib/padding.c \ 2465d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/cryptolib/rsa.c \ 2475d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/cryptolib/rsa_utility.c \ 2485d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/cryptolib/sha1.c \ 2495d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/cryptolib/sha256.c \ 2505d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/cryptolib/sha512.c \ 2515d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/cryptolib/sha_utility.c \ 2525d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/stateful_util.c \ 2535d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/vboot_api_firmware.c \ 25493943266c597ad66300445a04afa01270f2b5763Randall Spangler firmware/lib/vboot_common.c \ 25593943266c597ad66300445a04afa01270f2b5763Randall Spangler firmware/lib/vboot_firmware.c 25693943266c597ad66300445a04afa01270f2b5763Randall Spangler 25793943266c597ad66300445a04afa01270f2b5763Randall Spangler# Additional firmware library sources needed by VbSelectAndLoadKernel() call 25893943266c597ad66300445a04afa01270f2b5763Randall SpanglerVBSLK_SRCS = \ 25993943266c597ad66300445a04afa01270f2b5763Randall Spangler firmware/lib/cgptlib/cgptlib.c \ 26093943266c597ad66300445a04afa01270f2b5763Randall Spangler firmware/lib/cgptlib/cgptlib_internal.c \ 26193943266c597ad66300445a04afa01270f2b5763Randall Spangler firmware/lib/cgptlib/crc32.c \ 2625c9e4532b9bc45cff22f37d3556da679809a60a7Albert Chaulk firmware/lib/cgptlib/mtdlib.c \ 26393943266c597ad66300445a04afa01270f2b5763Randall Spangler firmware/lib/utility_string.c \ 2645d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/vboot_api_kernel.c \ 2655d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/vboot_audio.c \ 2665d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/vboot_display.c \ 26793943266c597ad66300445a04afa01270f2b5763Randall Spangler firmware/lib/vboot_kernel.c 2685d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 269eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Support real TPM unless BIOS sets MOCK_TPM 270eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${MOCK_TPM},) 27193943266c597ad66300445a04afa01270f2b5763Randall SpanglerVBINIT_SRCS += \ 2725d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/rollback_index.c \ 2735d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/tpm_lite/tlcl.c 27493943266c597ad66300445a04afa01270f2b5763Randall Spangler 27593943266c597ad66300445a04afa01270f2b5763Randall SpanglerVBSF_SRCS += \ 27693943266c597ad66300445a04afa01270f2b5763Randall Spangler firmware/lib/tpm_bootmode.c 2775d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spanglerelse 27893943266c597ad66300445a04afa01270f2b5763Randall SpanglerVBINIT_SRCS += \ 2795d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/mocked_rollback_index.c \ 2805d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/tpm_lite/mocked_tlcl.c 28193943266c597ad66300445a04afa01270f2b5763Randall Spangler 28293943266c597ad66300445a04afa01270f2b5763Randall SpanglerVBSF_SRCS += \ 28393943266c597ad66300445a04afa01270f2b5763Randall Spangler firmware/lib/mocked_tpm_bootmode.c 2845d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spanglerendif 2855d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 286eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${FIRMWARE_ARCH},) 287eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Include BIOS stubs in the firmware library when compiling for host 28893943266c597ad66300445a04afa01270f2b5763Randall Spangler# TODO: split out other stub funcs too 28993943266c597ad66300445a04afa01270f2b5763Randall SpanglerVBINIT_SRCS += \ 2905d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/stub/tpm_lite_stub.c \ 2915d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/stub/utility_stub.c \ 29293943266c597ad66300445a04afa01270f2b5763Randall Spangler firmware/stub/vboot_api_stub_init.c 29393943266c597ad66300445a04afa01270f2b5763Randall Spangler 29493943266c597ad66300445a04afa01270f2b5763Randall SpanglerVBSF_SRCS += \ 29593943266c597ad66300445a04afa01270f2b5763Randall Spangler firmware/stub/vboot_api_stub_sf.c 29693943266c597ad66300445a04afa01270f2b5763Randall Spangler 29793943266c597ad66300445a04afa01270f2b5763Randall SpanglerVBSLK_SRCS += \ 2985d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/stub/vboot_api_stub.c \ 2995d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/stub/vboot_api_stub_disk.c 3005d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spanglerendif 3015d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 30293943266c597ad66300445a04afa01270f2b5763Randall SpanglerVBSF_SRCS += ${VBINIT_SRCS} 30393943266c597ad66300445a04afa01270f2b5763Randall SpanglerFWLIB_SRCS += ${VBSF_SRCS} ${VBSLK_SRCS} 30493943266c597ad66300445a04afa01270f2b5763Randall Spangler 30593943266c597ad66300445a04afa01270f2b5763Randall SpanglerVBINIT_OBJS = ${VBINIT_SRCS:%.c=${BUILD}/%.o} 30693943266c597ad66300445a04afa01270f2b5763Randall SpanglerVBSF_OBJS = ${VBSF_SRCS:%.c=${BUILD}/%.o} 30793943266c597ad66300445a04afa01270f2b5763Randall Spangler 308eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonFWLIB_OBJS = ${FWLIB_SRCS:%.c=${BUILD}/%.o} 3091912bbae89b82c10819b01d039e140e39c668fc7Bill Richardson 3101912bbae89b82c10819b01d039e140e39c668fc7Bill RichardsonALL_OBJS += ${FWLIB_OBJS} ${VBINIT_OBJS} ${VBSF_OBJS} 3115d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 3125d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 313eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Library to build the utilities. "HOST" mostly means "userspace". 314c7c6e5d2f7076fe512b692411f0d05d4bf76d91fBill RichardsonHOSTLIB = ${BUILD}/libvboot_host.a 3155d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 3165d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerHOSTLIB_SRCS = \ 31781a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson cgpt/cgpt_create.c \ 31881a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson cgpt/cgpt_add.c \ 31981a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson cgpt/cgpt_boot.c \ 32081a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson cgpt/cgpt_show.c \ 32181a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson cgpt/cgpt_repair.c \ 32281a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson cgpt/cgpt_prioritize.c \ 32381a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson cgpt/cgpt_common.c \ 324534723a6519267461855441279b321e6fc1e4e90Albert Chaulk cgpt/flash_ts_drv.c \ 325b334e651a597a10d562bc882613f0b482b24e3caAlbert Chaulk firmware/lib/cgptlib/mtdlib.c \ 326534723a6519267461855441279b321e6fc1e4e90Albert Chaulk firmware/lib/flash_ts.c \ 327eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson host/arch/${ARCH}/lib/crossystem_arch.c \ 3285d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler host/lib/crossystem.c \ 3295d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler host/lib/file_keys.c \ 3305d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler host/lib/fmap.c \ 3315d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler host/lib/host_common.c \ 3325d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler host/lib/host_key.c \ 3335d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler host/lib/host_keyblock.c \ 3345d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler host/lib/host_misc.c \ 3355d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler host/lib/host_signature.c \ 33681a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson host/lib/signature_digest.c \ 33781a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson utility/dump_kernel_config_lib.c 3385d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 339eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonHOSTLIB_OBJS = ${HOSTLIB_SRCS:%.c=${BUILD}/%.o} 3405d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerALL_OBJS += ${HOSTLIB_OBJS} 3415d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 342eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Might need this too. 343eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonCRYPTO_LIBS := $(shell ${PKG_CONFIG} --libs libcrypto) 344eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 34581a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson# Sigh. For historical reasons, the autoupdate installer must sometimes be a 34681a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson# 32-bit executable, even when everything else is 64-bit. But it only needs a 34781a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson# few functions, so let's just build those. 34881a0b3de707b4e00958faf36f41b8f3d7bac6808Bill RichardsonTINYHOSTLIB = ${BUILD}/libtinyvboot_host.a 34981a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson 35081a0b3de707b4e00958faf36f41b8f3d7bac6808Bill RichardsonTINYHOSTLIB_SRCS = \ 35181a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson cgpt/cgpt_create.c \ 35281a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson cgpt/cgpt_add.c \ 35381a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson cgpt/cgpt_boot.c \ 35481a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson cgpt/cgpt_show.c \ 35581a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson cgpt/cgpt_repair.c \ 35681a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson cgpt/cgpt_prioritize.c \ 35781a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson cgpt/cgpt_common.c \ 358534723a6519267461855441279b321e6fc1e4e90Albert Chaulk cgpt/flash_ts_drv.c \ 359b334e651a597a10d562bc882613f0b482b24e3caAlbert Chaulk firmware/lib/cgptlib/mtdlib.c \ 360534723a6519267461855441279b321e6fc1e4e90Albert Chaulk firmware/lib/flash_ts.c \ 36181a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson utility/dump_kernel_config_lib.c \ 36281a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson firmware/lib/cgptlib/crc32.c \ 36381a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson firmware/lib/cgptlib/cgptlib_internal.c \ 3645fed2a667096341160db8643a4a057e328953a1dBill Richardson firmware/lib/utility_string.c \ 36581a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson firmware/stub/utility_stub.c 36681a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson 36781a0b3de707b4e00958faf36f41b8f3d7bac6808Bill RichardsonTINYHOSTLIB_OBJS = ${TINYHOSTLIB_SRCS:%.c=${BUILD}/%.o} 368eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 369eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 370eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Now for the userspace binaries 3715d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 3725d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerCGPT = ${BUILD}/cgpt/cgpt 3735d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 3745d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerCGPT_SRCS = \ 3755d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt.c \ 3765d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt_add.c \ 3775d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt_boot.c \ 3785d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt_common.c \ 3795d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt_create.c \ 3805d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt_find.c \ 3815d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt_legacy.c \ 3825d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt_prioritize.c \ 3835d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt_repair.c \ 3845d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt_show.c \ 3855d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cmd_add.c \ 3865d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cmd_boot.c \ 3875d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cmd_create.c \ 3885d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cmd_find.c \ 3895d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cmd_legacy.c \ 3905d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cmd_prioritize.c \ 3915d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cmd_repair.c \ 392534723a6519267461855441279b321e6fc1e4e90Albert Chaulk cgpt/cmd_show.c \ 393534723a6519267461855441279b321e6fc1e4e90Albert Chaulk cgpt/flash_ts_drv.c \ 394534723a6519267461855441279b321e6fc1e4e90Albert Chaulk firmware/lib/flash_ts.c 3955d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 396eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonCGPT_OBJS = ${CGPT_SRCS:%.c=${BUILD}/%.o} 3975d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerALL_OBJS += ${CGPT_OBJS} 3985d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 3995d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 400eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Scripts to install directly (not compiled) 4015d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerUTIL_SCRIPTS = \ 4025d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler utility/dev_debug_vboot \ 4035d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler utility/enable_dev_usb_boot \ 4045d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler utility/vbutil_what_keys 4055d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 406c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardsonifeq (${MINIMAL},) 407c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill RichardsonUTIL_SCRIPTS += \ 408c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson utility/dev_make_keypair 409c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardsonendif 410c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson 411eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# These utilities should be linked statically. 412eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonUTIL_NAMES_STATIC = \ 413339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/crossystem \ 414339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/gbb_utility 415eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 416eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonUTIL_NAMES = ${UTIL_NAMES_STATIC} \ 417339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/dev_sign_file \ 418339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/dump_kernel_config \ 419339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/dumpRSAPublicKey \ 420339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/tpm_init_temp_fix \ 421339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/tpmc \ 422339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/vbutil_firmware \ 423339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/vbutil_kernel \ 424339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/vbutil_key \ 425339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/vbutil_keyblock \ 4265d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 427eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${MINIMAL},) 4285d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerUTIL_NAMES += \ 429339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/bmpblk_font \ 430339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/bmpblk_utility \ 431339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/eficompress \ 432339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/efidecompress \ 433339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/load_kernel_test \ 434339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/pad_digest_utility \ 435339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/signature_digest_utility \ 436339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/verify_data 4375d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spanglerendif 4385d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 439339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill RichardsonUTIL_BINS_STATIC := $(addprefix ${BUILD}/,${UTIL_NAMES_STATIC}) 440339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill RichardsonUTIL_BINS = $(addprefix ${BUILD}/,${UTIL_NAMES}) 4411912bbae89b82c10819b01d039e140e39c668fc7Bill RichardsonALL_OBJS += $(addsuffix .o,${UTIL_BINS} ${UTIL_BINS_STATIC}) 4425d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 443c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson 444c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson# Scripts for signing stuff. 445c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill RichardsonSIGNING_SCRIPTS = \ 446c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson utility/tpm-nvsize \ 447c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson utility/chromeos-tpm-recovery 448c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson 449c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson# These go in a different place. 450c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill RichardsonSIGNING_SCRIPTS_DEV = \ 451c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson scripts/image_signing/resign_firmwarefd.sh \ 452c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson scripts/image_signing/make_dev_firmware.sh \ 453c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson scripts/image_signing/make_dev_ssd.sh \ 454c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson scripts/image_signing/set_gbb_flags.sh 455c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson 456c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson# Installed, but not made executable. 457c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill RichardsonSIGNING_COMMON = scripts/image_signing/common_minimal.sh 458eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 459eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 460eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# The unified firmware utility will eventually replace all the others 461eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonFUTIL_BIN = ${BUILD}/futility/futility 4626db8c75021e2edfa400ae707a8544d041e3c415fBill Richardson# But we still need both static (tiny) and dynamic (with openssl) versions. 4636db8c75021e2edfa400ae707a8544d041e3c415fBill RichardsonFUTIL_STATIC_BIN = ${FUTIL_BIN}_s 464eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 465feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson# These are the others it will replace. 46620807b6158b6a43baf0974bc763890888ba1f841Bill RichardsonFUTIL_OLD = bmpblk_font bmpblk_utility cgpt chromeos-tpm-recovery crossystem \ 46720807b6158b6a43baf0974bc763890888ba1f841Bill Richardson dev_debug_vboot dev_make_keypair dev_sign_file dumpRSAPublicKey \ 46820807b6158b6a43baf0974bc763890888ba1f841Bill Richardson dump_fmap dump_kernel_config eficompress efidecompress \ 46920807b6158b6a43baf0974bc763890888ba1f841Bill Richardson enable_dev_usb_boot gbb_utility load_kernel_test \ 47020807b6158b6a43baf0974bc763890888ba1f841Bill Richardson make_dev_firmware.sh make_dev_ssd.sh pad_digest_utility \ 47120807b6158b6a43baf0974bc763890888ba1f841Bill Richardson resign_firmwarefd.sh set_gbb_flags.sh signature_digest_utility \ 47220807b6158b6a43baf0974bc763890888ba1f841Bill Richardson tpm-nvsize tpm_init_temp_fix tpmc vbutil_firmware vbutil_kernel \ 47320807b6158b6a43baf0974bc763890888ba1f841Bill Richardson vbutil_key vbutil_keyblock vbutil_what_keys verify_data 474feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson 4756db8c75021e2edfa400ae707a8544d041e3c415fBill RichardsonFUTIL_STATIC_SRCS = \ 476feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson futility/futility.c \ 47720807b6158b6a43baf0974bc763890888ba1f841Bill Richardson futility/cmd_dump_fmap.c \ 478feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson futility/cmd_foo.c 479eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 4806db8c75021e2edfa400ae707a8544d041e3c415fBill RichardsonFUTIL_SRCS = \ 4816db8c75021e2edfa400ae707a8544d041e3c415fBill Richardson $(FUTIL_STATIC_SRCS) \ 4826db8c75021e2edfa400ae707a8544d041e3c415fBill Richardson futility/cmd_hey.c 4836db8c75021e2edfa400ae707a8544d041e3c415fBill Richardson 484eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonFUTIL_LDS = futility/futility.lds 485eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 4866db8c75021e2edfa400ae707a8544d041e3c415fBill RichardsonFUTIL_STATIC_OBJS = ${FUTIL_STATIC_SRCS:%.c=${BUILD}/%.o} 487eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonFUTIL_OBJS = ${FUTIL_SRCS:%.c=${BUILD}/%.o} 488eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 489eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonALL_OBJS += ${FUTIL_OBJS} 490eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 491eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 492eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Library of handy test functions. 493eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonTESTLIB = ${BUILD}/tests/test.a 494eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 495eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonTESTLIB_SRCS = \ 496eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson tests/test_common.c \ 497eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson tests/timer_utils.c \ 498eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson tests/crc32_test.c 499eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 500eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonTESTLIB_OBJS = ${TESTLIB_SRCS:%.c=${BUILD}/%.o} 501eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonALL_OBJS += ${TESTLIB_OBJS} 502eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 503eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 504eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# And some compiled tests. 505eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonTEST_NAMES = \ 506339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/cgptlib_test \ 507339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/rollback_index2_tests \ 508339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/rollback_index3_tests \ 509339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/rsa_padding_test \ 510339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/rsa_utility_tests \ 511339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/rsa_verify_benchmark \ 512339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/sha_benchmark \ 513339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/sha_tests \ 514339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/stateful_util_tests \ 515339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/tlcl_tests \ 516339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/tpm_bootmode_tests \ 517339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/utility_string_tests \ 518339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/utility_tests \ 519339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_api_init_tests \ 520339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_api_devmode_tests \ 521339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_api_firmware_tests \ 522339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_api_kernel_tests \ 523339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_api_kernel2_tests \ 524339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_api_kernel3_tests \ 525339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_api_kernel4_tests \ 526339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_audio_tests \ 527339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_common_tests \ 528339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_common2_tests \ 529339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_common3_tests \ 530339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_display_tests \ 531339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_firmware_tests \ 532339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_kernel_tests \ 533339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_nvstorage_test \ 534339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/futility/test_not_really 535eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 536eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# TODO: port these tests to new API, if not already eqivalent 537eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# functionality in other tests. These don't even compile at present. 538eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# 539eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# big_firmware_tests 540eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# big_kernel_tests 541eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# firmware_image_tests 542eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# firmware_rollback_tests 543eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# firmware_splicing_tests 544eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# firmware_verify_benchmark 545eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# kernel_image_tests 546eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# kernel_rollback_tests 547eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# kernel_splicing_tests 548eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# kernel_verify_benchmark 549eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# rollback_index_test 550eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# verify_firmware_fuzz_driver 551eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# verify_kernel_fuzz_driver 552eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# utility/load_firmware_test 553eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 554eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# And a few more... 555339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill RichardsonTLCL_TEST_NAMES = \ 556339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/tpm_lite/tpmtest_earlyextend \ 557339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/tpm_lite/tpmtest_earlynvram \ 558339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/tpm_lite/tpmtest_earlynvram2 \ 559339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/tpm_lite/tpmtest_enable \ 560339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/tpm_lite/tpmtest_fastenable \ 561339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/tpm_lite/tpmtest_globallock \ 562339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/tpm_lite/tpmtest_redefine_unowned \ 563339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/tpm_lite/tpmtest_spaceperm \ 564339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/tpm_lite/tpmtest_testsetup \ 565339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/tpm_lite/tpmtest_timing \ 566339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/tpm_lite/tpmtest_writelimit 567eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 568eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonTEST_NAMES += ${TLCL_TEST_NAMES} 569eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 570339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson# Finally 571339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill RichardsonTEST_BINS = $(addprefix ${BUILD}/,${TEST_NAMES}) 5721912bbae89b82c10819b01d039e140e39c668fc7Bill RichardsonALL_OBJS += $(addsuffix .o,${TEST_BINS}) 573eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 574e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spangler# Directory containing test keys 575e061a256549607a56d771eb8ddae5d0dd90d519cRandall SpanglerTEST_KEYS = ${SRC_RUN}/tests/testkeys 576eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 577eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 578eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson############################################################################## 579eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Finally, some targets. High-level ones first. 580eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 581eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Create output directories if necessary. Do this via explicit shell commands 582eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# so it happens before trying to generate/include dependencies. 583eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonSUBDIRS := firmware host cgpt utility futility tests tests/tpm_lite 584eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson_dir_create := $(foreach d, \ 585eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson $(shell find ${SUBDIRS} -name '*.c' -exec dirname {} \; | sort -u), \ 586eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson $(shell [ -d ${BUILD}/${d} ] || mkdir -p ${BUILD}/${d})) 587eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 588eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 589eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Default target. 590eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: all 59159d7508c2261a8371715b28f663b8b2efbb5a895Randall Spanglerall: fwlib $(if ${FIRMWARE_ARCH},,host_stuff) $(if ${COV},coverage) 592eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 593eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Host targets 594eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: host_stuff 595eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonhost_stuff: hostlib cgpt utils futil tests 596eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 597eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: clean 598eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonclean: 599eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}/bin/rm -rf ${BUILD} 600eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 601eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: install 602c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardsoninstall: cgpt_install utils_install signing_install futil_install 603eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 604eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Don't delete intermediate object files 605eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.SECONDARY: 606eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 607eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 608eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 609eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Firmware library 610eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 611eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# TPM-specific flags. These depend on the particular TPM we're targeting for. 612eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# They are needed here only for compiling parts of the firmware code into 613eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# user-level tests. 614eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 615eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# TPM_BLOCKING_CONTINUESELFTEST is defined if TPM_ContinueSelfTest blocks until 616eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# the self test has completed. 617eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 61845cc0f2c0a48b377520842597769a5813cf55902Randall Spangler${FWLIB_OBJS}: CFLAGS += -DTPM_BLOCKING_CONTINUESELFTEST 619eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 620eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# TPM_MANUAL_SELFTEST is defined if the self test must be started manually 621eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# (with a call to TPM_ContinueSelfTest) instead of starting automatically at 622eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# power on. 623eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# 624eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# We sincerely hope that TPM_BLOCKING_CONTINUESELFTEST and TPM_MANUAL_SELFTEST 625eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# are not both defined at the same time. (See comment in code.) 626eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 627eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# CFLAGS += -DTPM_MANUAL_SELFTEST 628eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 629eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${FIRMWARE_ARCH},i386) 630eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Unrolling loops in cryptolib makes it faster 63145cc0f2c0a48b377520842597769a5813cf55902Randall Spangler${FWLIB_OBJS}: CFLAGS += -DUNROLL_LOOPS 632eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 633eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Workaround for coreboot on x86, which will power off asynchronously 634eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# without giving us a chance to react. This is not an example of the Right 635eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Way to do things. See chrome-os-partner:7689, and the commit message 636eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# that made this change. 63745cc0f2c0a48b377520842597769a5813cf55902Randall Spangler${FWLIB_OBJS}: CFLAGS += -DSAVE_LOCALE_IMMEDIATELY 638eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 639eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# On x86 we don't actually read the GBB data into RAM until it is needed. 640eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Therefore it makes sense to cache it rather than reading it each time. 641eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Enable this feature. 64245cc0f2c0a48b377520842597769a5813cf55902Randall Spangler${FWLIB_OBJS}: CFLAGS += -DCOPY_BMP_DATA 643eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonendif 644eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 645eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${FIRMWARE_ARCH},) 646eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Disable rollback TPM when compiling locally, since otherwise 647eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# load_kernel_test attempts to talk to the TPM. 64845cc0f2c0a48b377520842597769a5813cf55902Randall Spangler${FWLIB_OBJS}: CFLAGS += -DDISABLE_ROLLBACK_TPM 649eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonendif 650eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 651a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson# Linktest ensures firmware lib doesn't rely on outside libraries 652a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson${BUILD}/firmware/linktest/main_vbinit: ${VBINIT_OBJS} 65393943266c597ad66300445a04afa01270f2b5763Randall Spangler${BUILD}/firmware/linktest/main_vbinit: OBJS = ${VBINIT_OBJS} 6541912bbae89b82c10819b01d039e140e39c668fc7Bill RichardsonALL_OBJS += ${BUILD}/firmware/linktest/main_vbinit.o 655a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson${BUILD}/firmware/linktest/main_vbsf: ${VBSF_OBJS} 65693943266c597ad66300445a04afa01270f2b5763Randall Spangler${BUILD}/firmware/linktest/main_vbsf: OBJS = ${VBSF_OBJS} 6571912bbae89b82c10819b01d039e140e39c668fc7Bill RichardsonALL_OBJS += ${BUILD}/firmware/linktest/main_vbsf.o 658a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson${BUILD}/firmware/linktest/main: ${FWLIB} 659a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson${BUILD}/firmware/linktest/main: LIBS = ${FWLIB} 6601912bbae89b82c10819b01d039e140e39c668fc7Bill RichardsonALL_OBJS += ${BUILD}/firmware/linktest/main.o 66193943266c597ad66300445a04afa01270f2b5763Randall Spangler 66293943266c597ad66300445a04afa01270f2b5763Randall Spangler.phony: fwlinktest 66393943266c597ad66300445a04afa01270f2b5763Randall Spanglerfwlinktest: ${FWLIB} \ 66493943266c597ad66300445a04afa01270f2b5763Randall Spangler ${BUILD}/firmware/linktest/main_vbinit \ 66593943266c597ad66300445a04afa01270f2b5763Randall Spangler ${BUILD}/firmware/linktest/main_vbsf \ 66693943266c597ad66300445a04afa01270f2b5763Randall Spangler ${BUILD}/firmware/linktest/main 66793943266c597ad66300445a04afa01270f2b5763Randall Spangler 668eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: fwlib 669a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardsonfwlib: $(if ${FIRMWARE_ARCH},${FWLIB},fwlinktest) 670eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 671eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${FWLIB}: ${FWLIB_OBJS} 672661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " RM $(subst ${BUILD}/,,$@)\n" 673eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}rm -f $@ 674661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " AR $(subst ${BUILD}/,,$@)\n" 675eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}ar qc $@ $^ 676eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 677eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 678eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Host library 679eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 680a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson 681a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson# Link tests 682a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson${BUILD}/host/linktest/main: ${HOSTLIB} 683a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson${BUILD}/host/linktest/main: LIBS = ${HOSTLIB} 6841912bbae89b82c10819b01d039e140e39c668fc7Bill RichardsonALL_OBJS += ${BUILD}/host/linktest/main.o 685a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson 686eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: hostlib 687a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardsonhostlib: ${BUILD}/host/linktest/main 688eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 689eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/host/% ${HOSTLIB}: INCLUDES += \ 6900c3ba249abb1dc60f5ebabccf84ff13206440b83Bill Richardson -Ihost/include \ 6910c3ba249abb1dc60f5ebabccf84ff13206440b83Bill Richardson -Ihost/arch/${ARCH}/include \ 6920c3ba249abb1dc60f5ebabccf84ff13206440b83Bill Richardson -Ihost/lib/include 693eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 694eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# TODO: better way to make .a than duplicating this recipe each time? 695eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${HOSTLIB}: ${HOSTLIB_OBJS} ${FWLIB_OBJS} 696661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " RM $(subst ${BUILD}/,,$@)\n" 697eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}rm -f $@ 698661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " AR $(subst ${BUILD}/,,$@)\n" 699eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}ar qc $@ $^ 700eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 70181a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson 70281a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson# Ugh. This is a very cut-down version of HOSTLIB just for the installer. 70381a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson.PHONY: tinyhostlib 70481a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardsontinyhostlib: ${TINYHOSTLIB} 70581a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson ${Q}cp -f ${TINYHOSTLIB} ${HOSTLIB} 70681a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson 70781a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson${TINYHOSTLIB}: ${TINYHOSTLIB_OBJS} 708661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " RM $(subst ${BUILD}/,,$@)\n" 70981a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson ${Q}rm -f $@ 710661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " AR $(subst ${BUILD}/,,$@)\n" 71181a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson ${Q}ar qc $@ $^ 71281a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson 713eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 714eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# CGPT library and utility 715eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 716eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: cgpt 717eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsoncgpt: ${CGPT} 718eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 7190c3ba249abb1dc60f5ebabccf84ff13206440b83Bill Richardson${CGPT_OBJS}: INCLUDES += -Ihost/include 7200c3ba249abb1dc60f5ebabccf84ff13206440b83Bill Richardson 721eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${CGPT}: LDFLAGS += -static 722eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${CGPT}: LDLIBS += -luuid 723eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 724a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson${CGPT}: ${CGPT_OBJS} ${HOSTLIB} 725661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " LDcgpt $(subst ${BUILD}/,,$@)\n" 7266db8c75021e2edfa400ae707a8544d041e3c415fBill Richardson ${Q}${LD} -o ${CGPT} ${CFLAGS} ${LDFLAGS} $^ ${LDLIBS} 727eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 728eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: cgpt_install 729eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsoncgpt_install: ${CGPT} 730661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " INSTALL CGPT\n" 731c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson ${Q}mkdir -p ${UB_DIR} 732c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson ${Q}${INSTALL} -t ${UB_DIR} $^ 733eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 734eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 735eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Utilities 736eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 737eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# These have their own headers too. 7380c3ba249abb1dc60f5ebabccf84ff13206440b83Bill Richardson${BUILD}/utility/%: INCLUDES += \ 7390c3ba249abb1dc60f5ebabccf84ff13206440b83Bill Richardson -Ihost/include \ 7400c3ba249abb1dc60f5ebabccf84ff13206440b83Bill Richardson -Ihost/lib/include \ 7410c3ba249abb1dc60f5ebabccf84ff13206440b83Bill Richardson -Iutility/include 742eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 743eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Utilities for auto-update toolkits must be statically linked. 744eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${UTIL_BINS_STATIC}: LDFLAGS += -static 745eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 746a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson 747acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson.PHONY: utils 748c7c6e5d2f7076fe512b692411f0d05d4bf76d91fBill Richardsonutils: ${UTIL_BINS} ${UTIL_SCRIPTS} 749eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}cp -f ${UTIL_SCRIPTS} ${BUILD}/utility 750eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}chmod a+rx $(patsubst %,${BUILD}/%,${UTIL_SCRIPTS}) 751826db09fcec194951e1dc71002d6a92620fbb46bBill Richardson 752a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson${UTIL_BINS} ${UTIL_BINS_STATIC}: ${HOSTLIB} 753a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson${UTIL_BINS} ${UTIL_BINS_STATIC}: LIBS = ${HOSTLIB} 754a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson 755acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson.PHONY: utils_install 756c7c6e5d2f7076fe512b692411f0d05d4bf76d91fBill Richardsonutils_install: ${UTIL_BINS} ${UTIL_SCRIPTS} 757661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " INSTALL UTILS\n" 758c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson ${Q}mkdir -p ${UB_DIR} 759c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson ${Q}${INSTALL} -t ${UB_DIR} ${UTIL_BINS} ${UTIL_SCRIPTS} 760c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson 761c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson# And some signing stuff for the target 762c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson.PHONY: signing_install 763c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardsonsigning_install: ${SIGNING_SCRIPTS} ${SIGNING_SCRIPTS_DEV} ${SIGNING_COMMON} 764661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " INSTALL SIGNING\n" 765c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson ${Q}mkdir -p ${UB_DIR} 766c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson ${Q}${INSTALL} -t ${UB_DIR} ${SIGNING_SCRIPTS} 767feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson ${Q}${INSTALL} -t ${UB_DIR} ${SIGNING_SCRIPTS_DEV} 768feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson ${Q}${INSTALL} -t ${UB_DIR} -m 'u=rw,go=r,a-s' ${SIGNING_COMMON} 769feb2518166b1cd181e607c611cbb610f0c7300daBill Richardsonifneq (${VB_DIR},) 770c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson ${Q}mkdir -p ${VB_DIR} 771feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson ${Q}for prog in $(notdir ${SIGNING_SCRIPTS_DEV}); do \ 772feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson ln -sf "${FT_DIR}/futility" "${VB_DIR}/$$prog"; done 773c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardsonendif 7745d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 775eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 776eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# new Firmware Utility 7775d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 778eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: futil 7796db8c75021e2edfa400ae707a8544d041e3c415fBill Richardsonfutil: ${FUTIL_STATIC_BIN} ${FUTIL_BIN} 7806db8c75021e2edfa400ae707a8544d041e3c415fBill Richardson 7816db8c75021e2edfa400ae707a8544d041e3c415fBill Richardson${FUTIL_STATIC_BIN}: ${FUTIL_LDS} ${FUTIL_STATIC_OBJS} 7826db8c75021e2edfa400ae707a8544d041e3c415fBill Richardson @$(PRINTF) " LD $(subst ${BUILD}/,,$@)\n" 7836db8c75021e2edfa400ae707a8544d041e3c415fBill Richardson ${Q}${LD} -o $@ ${CFLAGS} ${LDFLAGS} -static $^ ${LDLIBS} 7845d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 785eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${FUTIL_BIN}: ${FUTIL_LDS} ${FUTIL_OBJS} 786661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " LD $(subst ${BUILD}/,,$@)\n" 7876db8c75021e2edfa400ae707a8544d041e3c415fBill Richardson ${Q}${LD} -o $@ ${CFLAGS} ${LDFLAGS} $^ ${LDLIBS} 7885d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 789eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: futil_install 790eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonfutil_install: ${FUTIL_BIN} 791661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " INSTALL futility\n" 792feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson ${Q}mkdir -p ${F_DIR} 7936db8c75021e2edfa400ae707a8544d041e3c415fBill Richardson ${Q}${INSTALL} -t ${F_DIR} ${FUTIL_BIN} ${FUTIL_STATIC_BIN} 794feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson ${Q}for prog in ${FUTIL_OLD}; do \ 795feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson ln -sf futility "${F_DIR}/$$prog"; done 7965d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 79720807b6158b6a43baf0974bc763890888ba1f841Bill Richardson# TODO(wfrichar): This will need some refactoring (crbug.com/228932) 79820807b6158b6a43baf0974bc763890888ba1f841Bill Richardson${BUILD}/futility/% ${HOSTLIB}: INCLUDES += \ 79920807b6158b6a43baf0974bc763890888ba1f841Bill Richardson -Ihost/include \ 80020807b6158b6a43baf0974bc763890888ba1f841Bill Richardson -Ihost/arch/${ARCH}/include \ 80120807b6158b6a43baf0974bc763890888ba1f841Bill Richardson -Ihost/lib/include 80220807b6158b6a43baf0974bc763890888ba1f841Bill Richardson${FUTIL_STATIC_BIN} ${FUTIL_BIN}: ${HOSTLIB} 80320807b6158b6a43baf0974bc763890888ba1f841Bill Richardson${FUTIL_STATIC_BIN} ${FUTIL_BIN}: LIBS = ${HOSTLIB} 80420807b6158b6a43baf0974bc763890888ba1f841Bill Richardson 805eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 8065d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# Utility to generate TLCL structure definition header file. 8075d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 808acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson${BUILD}/utility/tlcl_generator: CFLAGS += -fpack-struct 8095d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 8105d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerSTRUCTURES_TMP=${BUILD}/tlcl_structures.tmp 8115d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerSTRUCTURES_SRC=firmware/lib/tpm_lite/include/tlcl_structures.h 8125d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 813acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson.PHONY: update_tlcl_structures 8145d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spanglerupdate_tlcl_structures: ${BUILD}/utility/tlcl_generator 815661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " Rebuilding TLCL structures\n" 816eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}${BUILD}/utility/tlcl_generator > ${STRUCTURES_TMP} 817eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}cmp -s ${STRUCTURES_TMP} ${STRUCTURES_SRC} || \ 8185d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler ( echo "%% Updating structures.h %%" && \ 819eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson cp ${STRUCTURES_TMP} ${STRUCTURES_SRC} ) 8205d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 821eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 8225d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# Tests 8235d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 824eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: tests 825eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsontests: ${TEST_BINS} 8265d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 827a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson${TEST_BINS}: ${HOSTLIB} ${TESTLIB} 828339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson${TEST_BINS}: INCLUDES += -Itests 829a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson${TEST_BINS}: LIBS = ${HOSTLIB} ${TESTLIB} 8305d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 831eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${TESTLIB}: ${TESTLIB_OBJS} 832661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " RM $(subst ${BUILD}/,,$@)\n" 833eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}rm -f $@ 834661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " AR $(subst ${BUILD}/,,$@)\n" 835eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}ar qc $@ $^ 8365d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 8375d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 838eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 839eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Generic build rules. LIBS and OBJS can be overridden to tweak the generic 840eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# rules for specific targets. 8415d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 842eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/%: ${BUILD}/%.o ${OBJS} ${LIBS} 843661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " LD $(subst ${BUILD}/,,$@)\n" 8446db8c75021e2edfa400ae707a8544d041e3c415fBill Richardson ${Q}${LD} -o $@ ${CFLAGS} ${LDFLAGS} $< ${OBJS} ${LIBS} ${LDLIBS} 845eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 846eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/%.o: %.c 847661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " CC $(subst ${BUILD}/,,$@)\n" 848eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}${CC} ${CFLAGS} ${INCLUDES} -c -o $@ $< 849eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 850eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Rules to recompile a single source file for library and test 851eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# TODO: is there a tidier way to do this? 852eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/%_for_lib.o: CFLAGS += -DFOR_LIBRARY 853eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/%_for_lib.o: %.c 854661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " CC-for-lib $(subst ${BUILD}/,,$@)\n" 855eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}${CC} ${CFLAGS} ${INCLUDES} -c -o $@ $< 856eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 857eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/%_for_test.o: CFLAGS += -DFOR_TEST 858eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/%_for_test.o: %.c 859661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " CC-for-test $(subst ${BUILD}/,,$@)\n" 860eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}${CC} ${CFLAGS} ${INCLUDES} -c -o $@ $< 861eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 862eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# TODO: C++ files don't belong in vboot reference at all. Convert to C. 863eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/%.o: %.cc 864661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " CXX $(subst ${BUILD}/,,$@)\n" 865eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}${CXX} ${CFLAGS} ${INCLUDES} -c -o $@ $< 866eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 867eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 868eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Here are the special tweaks to the generic rules. 869eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 870eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# GBB utility needs C++ linker. TODO: It shouldn't. 871eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/gbb_utility: LD = ${CXX} 872eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 873feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson# Because we play some clever linker script games to add new commands without 874feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson# changing any header files, futility must be linked with ld.bfd, not gold. 875feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson${FUTIL_BIN}: LDFLAGS += -fuse-ld=bfd 8766db8c75021e2edfa400ae707a8544d041e3c415fBill Richardson${FUTIL_STATIC_BIN}: LDFLAGS += -fuse-ld=bfd 877feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson 878eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Some utilities need external crypto functions 879eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/dumpRSAPublicKey: LDLIBS += ${CRYPTO_LIBS} 880eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/pad_digest_utility: LDLIBS += ${CRYPTO_LIBS} 881eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/signature_digest_utility: LDLIBS += ${CRYPTO_LIBS} 882eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/dev_sign_file: LDLIBS += ${CRYPTO_LIBS} 883eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/vbutil_firmware: LDLIBS += ${CRYPTO_LIBS} 884eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/vbutil_kernel: LDLIBS += ${CRYPTO_LIBS} 885eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/vbutil_key: LDLIBS += ${CRYPTO_LIBS} 886eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/vbutil_keyblock: LDLIBS += ${CRYPTO_LIBS} 887eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 888eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/host/linktest/main: LDLIBS += ${CRYPTO_LIBS} 889eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/tests/vboot_common2_tests: LDLIBS += ${CRYPTO_LIBS} 890eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/tests/vboot_common3_tests: LDLIBS += ${CRYPTO_LIBS} 891eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 892eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/bmpblk_utility: LD = ${CXX} 893eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/bmpblk_utility: LDLIBS = -llzma -lyaml 894eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 895eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonBMPBLK_UTILITY_DEPS = \ 896eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${BUILD}/utility/bmpblk_util.o \ 897eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${BUILD}/utility/image_types.o \ 898eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${BUILD}/utility/eficompress_for_lib.o \ 899eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${BUILD}/utility/efidecompress_for_lib.o 9001912bbae89b82c10819b01d039e140e39c668fc7Bill Richardson 901eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/bmpblk_utility: OBJS = ${BMPBLK_UTILITY_DEPS} 902eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/bmpblk_utility: ${BMPBLK_UTILITY_DEPS} 9031912bbae89b82c10819b01d039e140e39c668fc7Bill RichardsonALL_OBJS += ${BMPBLK_UTILITY_DEPS} 904eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 905eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/bmpblk_font: OBJS += ${BUILD}/utility/image_types.o 906eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/bmpblk_font: ${BUILD}/utility/image_types.o 9071912bbae89b82c10819b01d039e140e39c668fc7Bill RichardsonALL_OBJS += ${BUILD}/utility/image_types.o 908eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 909eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Allow multiple definitions, so tests can mock functions from other libraries 910eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/tests/%: CFLAGS += -Xlinker --allow-multiple-definition 9110c3ba249abb1dc60f5ebabccf84ff13206440b83Bill Richardson${BUILD}/tests/%: INCLUDES += -Ihost/include -Ihost/lib/include 912eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/tests/%: LDLIBS += -lrt -luuid 913eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/tests/%: LIBS += ${TESTLIB} 9145d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 9155d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler${BUILD}/tests/rollback_index2_tests: OBJS += \ 91617f8d341099120da78a6ca71165834eefb0960edRandall Spangler ${BUILD}/firmware/lib/rollback_index_for_test.o 917eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/tests/rollback_index2_tests: \ 918eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${BUILD}/firmware/lib/rollback_index_for_test.o 9191912bbae89b82c10819b01d039e140e39c668fc7Bill RichardsonALL_OBJS += ${BUILD}/firmware/lib/rollback_index_for_test.o 9205d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 921c3d488d155961d2849dfdaa4f0461df1aa95c2caRandall Spangler${BUILD}/tests/tlcl_tests: OBJS += \ 922c3d488d155961d2849dfdaa4f0461df1aa95c2caRandall Spangler ${BUILD}/firmware/lib/tpm_lite/tlcl_for_test.o 923c3d488d155961d2849dfdaa4f0461df1aa95c2caRandall Spangler${BUILD}/tests/tlcl_tests: \ 924c3d488d155961d2849dfdaa4f0461df1aa95c2caRandall Spangler ${BUILD}/firmware/lib/tpm_lite/tlcl_for_test.o 9251912bbae89b82c10819b01d039e140e39c668fc7Bill RichardsonALL_OBJS += ${BUILD}/firmware/lib/tpm_lite/tlcl_for_test.o 926c3d488d155961d2849dfdaa4f0461df1aa95c2caRandall Spangler 9275d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler${BUILD}/tests/vboot_audio_tests: OBJS += \ 92817f8d341099120da78a6ca71165834eefb0960edRandall Spangler ${BUILD}/firmware/lib/vboot_audio_for_test.o 929eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/tests/vboot_audio_tests: \ 930eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${BUILD}/firmware/lib/vboot_audio_for_test.o 9311912bbae89b82c10819b01d039e140e39c668fc7Bill RichardsonALL_OBJS += ${BUILD}/firmware/lib/vboot_audio_for_test.o 9325d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 933acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson${BUILD}/tests/rollback_index_test: INCLUDES += -I/usr/include 934acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson${BUILD}/tests/rollback_index_test: LIBS += -ltlcl 9355d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 936339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill RichardsonTLCL_TEST_BINS = $(addprefix ${BUILD}/,${TLCL_TEST_NAMES}) 937eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${TLCL_TEST_BINS}: OBJS += ${BUILD}/tests/tpm_lite/tlcl_tests.o 938eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${TLCL_TEST_BINS}: ${BUILD}/tests/tpm_lite/tlcl_tests.o 9391912bbae89b82c10819b01d039e140e39c668fc7Bill RichardsonALL_OBJS += ${BUILD}/tests/tpm_lite/tlcl_tests.o 9405d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 941eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson############################################################################## 942eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Targets that exist just to run tests 9435d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 9445d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# Frequently-run tests 945eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: test_targets 946eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsontest_targets:: runcgpttests runmisctests 947844bce57471153664c78993dab453e87891bb969Randall Spangler 948eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${MINIMAL},) 949844bce57471153664c78993dab453e87891bb969Randall Spangler# Bitmap utility isn't compiled for minimal variant 950feb2518166b1cd181e607c611cbb610f0c7300daBill Richardsontest_targets:: runbmptests runfutiltests 951844bce57471153664c78993dab453e87891bb969Randall Spangler# Scripts don't work under qemu testing 952844bce57471153664c78993dab453e87891bb969Randall Spangler# TODO: convert scripts to makefile so they can be called directly 953eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsontest_targets:: runtestscripts 954844bce57471153664c78993dab453e87891bb969Randall Spanglerendif 955844bce57471153664c78993dab453e87891bb969Randall Spangler 956eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: test_setup 957eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsontest_setup:: cgpt utils futil tests 958eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 959844bce57471153664c78993dab453e87891bb969Randall Spangler# Qemu setup for cross-compiled tests. Need to copy qemu binary into the 960844bce57471153664c78993dab453e87891bb969Randall Spangler# sysroot. 961eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifneq (${QEMU_ARCH},) 962eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsontest_setup:: qemu_install 963844bce57471153664c78993dab453e87891bb969Randall Spangler 964844bce57471153664c78993dab453e87891bb969Randall Spangler.PHONY: qemu_install 965844bce57471153664c78993dab453e87891bb969Randall Spanglerqemu_install: 966eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${SYSROOT},) 967eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson $(error SYSROOT must be set to the top of the target-specific root \ 968eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonwhen cross-compiling for qemu-based tests to run properly.) 969eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonendif 970661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " Copying qemu binary.\n" 971eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}cp -fu /usr/bin/${QEMU_BIN} ${BUILD}/${QEMU_BIN} 972eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}chmod a+rx ${BUILD}/${QEMU_BIN} 973844bce57471153664c78993dab453e87891bb969Randall Spanglerendif 974844bce57471153664c78993dab453e87891bb969Randall Spangler 975acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson.PHONY: runtests 976a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardsonruntests: test_setup test_targets 9775d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 9785d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# Generate test keys 979acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson.PHONY: genkeys 980844bce57471153664c78993dab453e87891bb969Randall Spanglergenkeys: utils 9815d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler tests/gen_test_keys.sh 9825d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 9835d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# Generate test cases for fuzzing 984acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson.PHONY: genfuzztestcases 985a808dc944284e6eba39a8f19ddb46bc61c34de8aRandall Spanglergenfuzztestcases: utils 9865d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler tests/gen_fuzz_test_cases.sh 9875d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 988acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson.PHONY: runbmptests 989eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonrunbmptests: test_setup 990eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson cd tests/bitmaps && BMPBLK=${BUILD_RUN}/utility/bmpblk_utility \ 9915d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler ./TestBmpBlock.py -v 9925d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 993acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson.PHONY: runcgpttests 994eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonruncgpttests: test_setup 995eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/cgptlib_test 9965d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 997844bce57471153664c78993dab453e87891bb969Randall Spangler.PHONY: runtestscripts 998eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonruntestscripts: test_setup genfuzztestcases 999eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson tests/run_cgpt_tests.sh ${BUILD_RUN}/cgpt/cgpt 100042c08cb2dac102509491810361e239fbde52b9e0Albert Chaulk tests/run_cgpt_tests.sh ${BUILD_RUN}/cgpt/cgpt -N=512,32,1,3 10015d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler tests/run_preamble_tests.sh 10025d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler tests/run_rsa_tests.sh 1003844bce57471153664c78993dab453e87891bb969Randall Spangler tests/run_vbutil_kernel_arg_tests.sh 10045d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler tests/run_vbutil_tests.sh 10055d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 1006844bce57471153664c78993dab453e87891bb969Randall Spangler.PHONY: runmisctests 1007eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonrunmisctests: test_setup 1008eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/rollback_index2_tests 1009a3eac79f5070747e326da631c1eec155f0389919Randall Spangler ${RUNTEST} ${BUILD_RUN}/tests/rollback_index3_tests 1010eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/rsa_utility_tests 1011eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/sha_tests 1012eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/stateful_util_tests 1013c3d488d155961d2849dfdaa4f0461df1aa95c2caRandall Spangler ${RUNTEST} ${BUILD_RUN}/tests/tlcl_tests 1014eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/tpm_bootmode_tests 1015eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/utility_string_tests 1016eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/utility_tests 1017eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_devmode_tests 1018eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_firmware_tests 10190714d9de56da3a5c686b26755d15aa6788c727d4Randall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_init_tests 10200714d9de56da3a5c686b26755d15aa6788c727d4Randall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_kernel_tests 10217f43669630cb42e40ca6ddc1128eefea8fd339d9Randall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_kernel2_tests 10227f43669630cb42e40ca6ddc1128eefea8fd339d9Randall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_kernel3_tests 10237f43669630cb42e40ca6ddc1128eefea8fd339d9Randall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_kernel4_tests 1024eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/vboot_audio_tests 1025e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_common_tests 1026e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_common2_tests ${TEST_KEYS} 1027e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_common3_tests ${TEST_KEYS} 1028786a5dca74387de5ffdc51ca5a099a4e90f406daRandall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_display_tests 1029eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/vboot_firmware_tests 103049cb0d3471e768da11fe76b65769bd57dca38bd7Randall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_kernel_tests 10316dbf9d9160b2927d76017d0f51919e0880f9b2ccRandall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_nvstorage_test 1032eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 1033eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: runfutiltests 1034feb2518166b1cd181e607c611cbb610f0c7300daBill Richardsonrunfutiltests: override DESTDIR = ${TEST_INSTALL_DIR} 1035eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonrunfutiltests: test_setup install 1036339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/futility/run_test_scripts.sh ${DESTDIR} 1037339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/futility/test_not_really 1038844bce57471153664c78993dab453e87891bb969Randall Spangler 10395d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# Run long tests, including all permutations of encryption keys (instead of 1040786a5dca74387de5ffdc51ca5a099a4e90f406daRandall Spangler# just the ones we use) and tests of currently-unused code. 10415d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# Not run by automated build. 1042acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson.PHONY: runlongtests 1043eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonrunlongtests: test_setup genkeys genfuzztestcases 1044e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_common2_tests ${TEST_KEYS} --all 1045e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_common3_tests ${TEST_KEYS} --all 10465d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler tests/run_preamble_tests.sh --all 10475d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler tests/run_vbutil_tests.sh --all 10485d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 10495d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# TODO: tests to run when ported to new API 10505d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# ./run_image_verification_tests.sh 10515d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# # Splicing tests 10525d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# ${BUILD}/tests/firmware_splicing_tests 10535d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# ${BUILD}/tests/kernel_splicing_tests 10545d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# # Rollback Tests 10555d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# ${BUILD}/tests/firmware_rollback_tests 10565d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# ${BUILD}/tests/kernel_rollback_tests 10575d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 105859d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler# Code coverage 105959d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler.PHONY: coverage_init 106059d7508c2261a8371715b28f663b8b2efbb5a895Randall Spanglercoverage_init: test_setup 106159d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler rm -f ${COV_INFO}* 106259d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler lcov -c -i -d . -b . -o ${COV_INFO}.initial 106359d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler 106459d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler.PHONY: coverage_html 106559d7508c2261a8371715b28f663b8b2efbb5a895Randall Spanglercoverage_html: 106659d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler lcov -c -d . -b . -o ${COV_INFO}.tests 106759d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler lcov -a ${COV_INFO}.initial -a ${COV_INFO}.tests -o ${COV_INFO}.total 106859d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler lcov -r ${COV_INFO}.total '/usr/*' '*/linktest/*' -o ${COV_INFO}.local 106959d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler genhtml ${COV_INFO}.local -o ${BUILD}/coverage 107059d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler 107159d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler# Generate addtional coverage stats just for firmware subdir, because the 107259d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler# per-directory stats for the whole project don't include their own subdirs. 107349cb0d3471e768da11fe76b65769bd57dca38bd7Randall Spangler lcov -r ${COV_INFO}.local '*/stub/*' -o ${COV_INFO}.nostub 107449cb0d3471e768da11fe76b65769bd57dca38bd7Randall Spangler lcov -e ${COV_INFO}.nostub '${SRCDIR}/firmware/*' \ 107559d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler -o ${COV_INFO}.firmware 107659d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler 107759d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler.PHONY: coverage 107859d7508c2261a8371715b28f663b8b2efbb5a895Randall Spanglerifeq (${COV},) 107959d7508c2261a8371715b28f663b8b2efbb5a895Randall Spanglercoverage: 108059d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler $(error Build coverage like this: make clean && COV=1 make) 108159d7508c2261a8371715b28f663b8b2efbb5a895Randall Spanglerelse 108259d7508c2261a8371715b28f663b8b2efbb5a895Randall Spanglercoverage: coverage_init runtests coverage_html 108359d7508c2261a8371715b28f663b8b2efbb5a895Randall Spanglerendif 10841912bbae89b82c10819b01d039e140e39c668fc7Bill Richardson 10851912bbae89b82c10819b01d039e140e39c668fc7Bill Richardson# Include generated dependencies 10861912bbae89b82c10819b01d039e140e39c668fc7Bill RichardsonALL_DEPS += ${ALL_OBJS:%.o=%.o.d} 10871912bbae89b82c10819b01d039e140e39c668fc7Bill Richardson-include ${ALL_DEPS} 1088