Makefile revision 20807b6158b6a43baf0974bc763890888ba1f841
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 \ 26293943266c597ad66300445a04afa01270f2b5763Randall Spangler firmware/lib/utility_string.c \ 2635d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/vboot_api_kernel.c \ 2645d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/vboot_audio.c \ 2655d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/vboot_display.c \ 26693943266c597ad66300445a04afa01270f2b5763Randall Spangler firmware/lib/vboot_kernel.c 2675d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 268eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Support real TPM unless BIOS sets MOCK_TPM 269eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${MOCK_TPM},) 27093943266c597ad66300445a04afa01270f2b5763Randall SpanglerVBINIT_SRCS += \ 2715d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/rollback_index.c \ 2725d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/tpm_lite/tlcl.c 27393943266c597ad66300445a04afa01270f2b5763Randall Spangler 27493943266c597ad66300445a04afa01270f2b5763Randall SpanglerVBSF_SRCS += \ 27593943266c597ad66300445a04afa01270f2b5763Randall Spangler firmware/lib/tpm_bootmode.c 2765d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spanglerelse 27793943266c597ad66300445a04afa01270f2b5763Randall SpanglerVBINIT_SRCS += \ 2785d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/mocked_rollback_index.c \ 2795d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/lib/tpm_lite/mocked_tlcl.c 28093943266c597ad66300445a04afa01270f2b5763Randall Spangler 28193943266c597ad66300445a04afa01270f2b5763Randall SpanglerVBSF_SRCS += \ 28293943266c597ad66300445a04afa01270f2b5763Randall Spangler firmware/lib/mocked_tpm_bootmode.c 2835d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spanglerendif 2845d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 285eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${FIRMWARE_ARCH},) 286eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Include BIOS stubs in the firmware library when compiling for host 28793943266c597ad66300445a04afa01270f2b5763Randall Spangler# TODO: split out other stub funcs too 28893943266c597ad66300445a04afa01270f2b5763Randall SpanglerVBINIT_SRCS += \ 2895d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/stub/tpm_lite_stub.c \ 2905d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/stub/utility_stub.c \ 29193943266c597ad66300445a04afa01270f2b5763Randall Spangler firmware/stub/vboot_api_stub_init.c 29293943266c597ad66300445a04afa01270f2b5763Randall Spangler 29393943266c597ad66300445a04afa01270f2b5763Randall SpanglerVBSF_SRCS += \ 29493943266c597ad66300445a04afa01270f2b5763Randall Spangler firmware/stub/vboot_api_stub_sf.c 29593943266c597ad66300445a04afa01270f2b5763Randall Spangler 29693943266c597ad66300445a04afa01270f2b5763Randall SpanglerVBSLK_SRCS += \ 2975d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/stub/vboot_api_stub.c \ 2985d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler firmware/stub/vboot_api_stub_disk.c 2995d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spanglerendif 3005d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 30193943266c597ad66300445a04afa01270f2b5763Randall SpanglerVBSF_SRCS += ${VBINIT_SRCS} 30293943266c597ad66300445a04afa01270f2b5763Randall SpanglerFWLIB_SRCS += ${VBSF_SRCS} ${VBSLK_SRCS} 30393943266c597ad66300445a04afa01270f2b5763Randall Spangler 30493943266c597ad66300445a04afa01270f2b5763Randall SpanglerVBINIT_OBJS = ${VBINIT_SRCS:%.c=${BUILD}/%.o} 30593943266c597ad66300445a04afa01270f2b5763Randall SpanglerVBSF_OBJS = ${VBSF_SRCS:%.c=${BUILD}/%.o} 30693943266c597ad66300445a04afa01270f2b5763Randall Spangler 307eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonFWLIB_OBJS = ${FWLIB_SRCS:%.c=${BUILD}/%.o} 3081912bbae89b82c10819b01d039e140e39c668fc7Bill Richardson 3091912bbae89b82c10819b01d039e140e39c668fc7Bill RichardsonALL_OBJS += ${FWLIB_OBJS} ${VBINIT_OBJS} ${VBSF_OBJS} 3105d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 3115d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 312eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Library to build the utilities. "HOST" mostly means "userspace". 313c7c6e5d2f7076fe512b692411f0d05d4bf76d91fBill RichardsonHOSTLIB = ${BUILD}/libvboot_host.a 3145d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 3155d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerHOSTLIB_SRCS = \ 31681a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson cgpt/cgpt_create.c \ 31781a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson cgpt/cgpt_add.c \ 31881a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson cgpt/cgpt_boot.c \ 31981a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson cgpt/cgpt_show.c \ 32081a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson cgpt/cgpt_repair.c \ 32181a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson cgpt/cgpt_prioritize.c \ 32281a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson cgpt/cgpt_common.c \ 323eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson host/arch/${ARCH}/lib/crossystem_arch.c \ 3245d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler host/lib/crossystem.c \ 3255d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler host/lib/file_keys.c \ 3265d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler host/lib/fmap.c \ 3275d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler host/lib/host_common.c \ 3285d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler host/lib/host_key.c \ 3295d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler host/lib/host_keyblock.c \ 3305d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler host/lib/host_misc.c \ 3315d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler host/lib/host_signature.c \ 33281a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson host/lib/signature_digest.c \ 33381a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson utility/dump_kernel_config_lib.c 3345d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 335eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonHOSTLIB_OBJS = ${HOSTLIB_SRCS:%.c=${BUILD}/%.o} 3365d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerALL_OBJS += ${HOSTLIB_OBJS} 3375d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 338eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Might need this too. 339eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonCRYPTO_LIBS := $(shell ${PKG_CONFIG} --libs libcrypto) 340eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 34181a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson# Sigh. For historical reasons, the autoupdate installer must sometimes be a 34281a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson# 32-bit executable, even when everything else is 64-bit. But it only needs a 34381a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson# few functions, so let's just build those. 34481a0b3de707b4e00958faf36f41b8f3d7bac6808Bill RichardsonTINYHOSTLIB = ${BUILD}/libtinyvboot_host.a 34581a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson 34681a0b3de707b4e00958faf36f41b8f3d7bac6808Bill RichardsonTINYHOSTLIB_SRCS = \ 34781a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson cgpt/cgpt_create.c \ 34881a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson cgpt/cgpt_add.c \ 34981a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson cgpt/cgpt_boot.c \ 35081a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson cgpt/cgpt_show.c \ 35181a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson cgpt/cgpt_repair.c \ 35281a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson cgpt/cgpt_prioritize.c \ 35381a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson cgpt/cgpt_common.c \ 35481a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson utility/dump_kernel_config_lib.c \ 35581a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson firmware/lib/cgptlib/crc32.c \ 35681a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson firmware/lib/cgptlib/cgptlib_internal.c \ 3575fed2a667096341160db8643a4a057e328953a1dBill Richardson firmware/lib/utility_string.c \ 35881a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson firmware/stub/utility_stub.c 35981a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson 36081a0b3de707b4e00958faf36f41b8f3d7bac6808Bill RichardsonTINYHOSTLIB_OBJS = ${TINYHOSTLIB_SRCS:%.c=${BUILD}/%.o} 361eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 362eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 363eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Now for the userspace binaries 3645d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 3655d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerCGPT = ${BUILD}/cgpt/cgpt 3665d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 3675d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerCGPT_SRCS = \ 3685d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt.c \ 3695d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt_add.c \ 3705d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt_boot.c \ 3715d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt_common.c \ 3725d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt_create.c \ 3735d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt_find.c \ 3745d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt_legacy.c \ 3755d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt_prioritize.c \ 3765d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt_repair.c \ 3775d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cgpt_show.c \ 3785d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cmd_add.c \ 3795d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cmd_boot.c \ 3805d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cmd_create.c \ 3815d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cmd_find.c \ 3825d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cmd_legacy.c \ 3835d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cmd_prioritize.c \ 3845d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cmd_repair.c \ 3855d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler cgpt/cmd_show.c 3865d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 387eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonCGPT_OBJS = ${CGPT_SRCS:%.c=${BUILD}/%.o} 3885d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerALL_OBJS += ${CGPT_OBJS} 3895d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 3905d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 391eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Scripts to install directly (not compiled) 3925d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerUTIL_SCRIPTS = \ 3935d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler utility/dev_debug_vboot \ 3945d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler utility/enable_dev_usb_boot \ 3955d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler utility/vbutil_what_keys 3965d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 397c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardsonifeq (${MINIMAL},) 398c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill RichardsonUTIL_SCRIPTS += \ 399c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson utility/dev_make_keypair 400c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardsonendif 401c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson 402eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# These utilities should be linked statically. 403eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonUTIL_NAMES_STATIC = \ 404339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/crossystem \ 405339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/gbb_utility 406eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 407eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonUTIL_NAMES = ${UTIL_NAMES_STATIC} \ 408339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/dev_sign_file \ 409339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/dump_kernel_config \ 410339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/dumpRSAPublicKey \ 411339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/tpm_init_temp_fix \ 412339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/tpmc \ 413339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/vbutil_firmware \ 414339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/vbutil_kernel \ 415339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/vbutil_key \ 416339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/vbutil_keyblock \ 4175d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 418eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${MINIMAL},) 4195d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerUTIL_NAMES += \ 420339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/bmpblk_font \ 421339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/bmpblk_utility \ 422339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/eficompress \ 423339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/efidecompress \ 424339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/load_kernel_test \ 425339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/pad_digest_utility \ 426339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/signature_digest_utility \ 427339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson utility/verify_data 4285d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spanglerendif 4295d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 430339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill RichardsonUTIL_BINS_STATIC := $(addprefix ${BUILD}/,${UTIL_NAMES_STATIC}) 431339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill RichardsonUTIL_BINS = $(addprefix ${BUILD}/,${UTIL_NAMES}) 4321912bbae89b82c10819b01d039e140e39c668fc7Bill RichardsonALL_OBJS += $(addsuffix .o,${UTIL_BINS} ${UTIL_BINS_STATIC}) 4335d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 434c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson 435c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson# Scripts for signing stuff. 436c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill RichardsonSIGNING_SCRIPTS = \ 437c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson utility/tpm-nvsize \ 438c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson utility/chromeos-tpm-recovery 439c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson 440c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson# These go in a different place. 441c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill RichardsonSIGNING_SCRIPTS_DEV = \ 442c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson scripts/image_signing/resign_firmwarefd.sh \ 443c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson scripts/image_signing/make_dev_firmware.sh \ 444c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson scripts/image_signing/make_dev_ssd.sh \ 445c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson scripts/image_signing/set_gbb_flags.sh 446c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson 447c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson# Installed, but not made executable. 448c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill RichardsonSIGNING_COMMON = scripts/image_signing/common_minimal.sh 449eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 450eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 451eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# The unified firmware utility will eventually replace all the others 452eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonFUTIL_BIN = ${BUILD}/futility/futility 4536db8c75021e2edfa400ae707a8544d041e3c415fBill Richardson# But we still need both static (tiny) and dynamic (with openssl) versions. 4546db8c75021e2edfa400ae707a8544d041e3c415fBill RichardsonFUTIL_STATIC_BIN = ${FUTIL_BIN}_s 455eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 456feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson# These are the others it will replace. 45720807b6158b6a43baf0974bc763890888ba1f841Bill RichardsonFUTIL_OLD = bmpblk_font bmpblk_utility cgpt chromeos-tpm-recovery crossystem \ 45820807b6158b6a43baf0974bc763890888ba1f841Bill Richardson dev_debug_vboot dev_make_keypair dev_sign_file dumpRSAPublicKey \ 45920807b6158b6a43baf0974bc763890888ba1f841Bill Richardson dump_fmap dump_kernel_config eficompress efidecompress \ 46020807b6158b6a43baf0974bc763890888ba1f841Bill Richardson enable_dev_usb_boot gbb_utility load_kernel_test \ 46120807b6158b6a43baf0974bc763890888ba1f841Bill Richardson make_dev_firmware.sh make_dev_ssd.sh pad_digest_utility \ 46220807b6158b6a43baf0974bc763890888ba1f841Bill Richardson resign_firmwarefd.sh set_gbb_flags.sh signature_digest_utility \ 46320807b6158b6a43baf0974bc763890888ba1f841Bill Richardson tpm-nvsize tpm_init_temp_fix tpmc vbutil_firmware vbutil_kernel \ 46420807b6158b6a43baf0974bc763890888ba1f841Bill Richardson vbutil_key vbutil_keyblock vbutil_what_keys verify_data 465feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson 4666db8c75021e2edfa400ae707a8544d041e3c415fBill RichardsonFUTIL_STATIC_SRCS = \ 467feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson futility/futility.c \ 46820807b6158b6a43baf0974bc763890888ba1f841Bill Richardson futility/cmd_dump_fmap.c \ 469feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson futility/cmd_foo.c 470eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 4716db8c75021e2edfa400ae707a8544d041e3c415fBill RichardsonFUTIL_SRCS = \ 4726db8c75021e2edfa400ae707a8544d041e3c415fBill Richardson $(FUTIL_STATIC_SRCS) \ 4736db8c75021e2edfa400ae707a8544d041e3c415fBill Richardson futility/cmd_hey.c 4746db8c75021e2edfa400ae707a8544d041e3c415fBill Richardson 475eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonFUTIL_LDS = futility/futility.lds 476eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 4776db8c75021e2edfa400ae707a8544d041e3c415fBill RichardsonFUTIL_STATIC_OBJS = ${FUTIL_STATIC_SRCS:%.c=${BUILD}/%.o} 478eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonFUTIL_OBJS = ${FUTIL_SRCS:%.c=${BUILD}/%.o} 479eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 480eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonALL_OBJS += ${FUTIL_OBJS} 481eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 482eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 483eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Library of handy test functions. 484eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonTESTLIB = ${BUILD}/tests/test.a 485eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 486eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonTESTLIB_SRCS = \ 487eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson tests/test_common.c \ 488eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson tests/timer_utils.c \ 489eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson tests/crc32_test.c 490eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 491eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonTESTLIB_OBJS = ${TESTLIB_SRCS:%.c=${BUILD}/%.o} 492eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonALL_OBJS += ${TESTLIB_OBJS} 493eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 494eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 495eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# And some compiled tests. 496eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonTEST_NAMES = \ 497339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/cgptlib_test \ 498339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/rollback_index2_tests \ 499339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/rollback_index3_tests \ 500339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/rsa_padding_test \ 501339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/rsa_utility_tests \ 502339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/rsa_verify_benchmark \ 503339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/sha_benchmark \ 504339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/sha_tests \ 505339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/stateful_util_tests \ 506339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/tlcl_tests \ 507339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/tpm_bootmode_tests \ 508339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/utility_string_tests \ 509339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/utility_tests \ 510339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_api_init_tests \ 511339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_api_devmode_tests \ 512339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_api_firmware_tests \ 513339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_api_kernel_tests \ 514339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_api_kernel2_tests \ 515339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_api_kernel3_tests \ 516339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_api_kernel4_tests \ 517339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_audio_tests \ 518339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_common_tests \ 519339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_common2_tests \ 520339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_common3_tests \ 521339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_display_tests \ 522339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_firmware_tests \ 523339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_kernel_tests \ 524339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/vboot_nvstorage_test \ 525339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/futility/test_not_really 526eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 527eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# TODO: port these tests to new API, if not already eqivalent 528eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# functionality in other tests. These don't even compile at present. 529eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# 530eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# big_firmware_tests 531eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# big_kernel_tests 532eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# firmware_image_tests 533eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# firmware_rollback_tests 534eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# firmware_splicing_tests 535eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# firmware_verify_benchmark 536eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# kernel_image_tests 537eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# kernel_rollback_tests 538eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# kernel_splicing_tests 539eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# kernel_verify_benchmark 540eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# rollback_index_test 541eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# verify_firmware_fuzz_driver 542eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# verify_kernel_fuzz_driver 543eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# utility/load_firmware_test 544eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 545eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# And a few more... 546339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill RichardsonTLCL_TEST_NAMES = \ 547339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/tpm_lite/tpmtest_earlyextend \ 548339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/tpm_lite/tpmtest_earlynvram \ 549339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/tpm_lite/tpmtest_earlynvram2 \ 550339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/tpm_lite/tpmtest_enable \ 551339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/tpm_lite/tpmtest_fastenable \ 552339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/tpm_lite/tpmtest_globallock \ 553339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/tpm_lite/tpmtest_redefine_unowned \ 554339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/tpm_lite/tpmtest_spaceperm \ 555339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/tpm_lite/tpmtest_testsetup \ 556339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/tpm_lite/tpmtest_timing \ 557339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/tpm_lite/tpmtest_writelimit 558eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 559eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonTEST_NAMES += ${TLCL_TEST_NAMES} 560eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 561339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson# Finally 562339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill RichardsonTEST_BINS = $(addprefix ${BUILD}/,${TEST_NAMES}) 5631912bbae89b82c10819b01d039e140e39c668fc7Bill RichardsonALL_OBJS += $(addsuffix .o,${TEST_BINS}) 564eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 565e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spangler# Directory containing test keys 566e061a256549607a56d771eb8ddae5d0dd90d519cRandall SpanglerTEST_KEYS = ${SRC_RUN}/tests/testkeys 567eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 568eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 569eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson############################################################################## 570eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Finally, some targets. High-level ones first. 571eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 572eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Create output directories if necessary. Do this via explicit shell commands 573eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# so it happens before trying to generate/include dependencies. 574eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonSUBDIRS := firmware host cgpt utility futility tests tests/tpm_lite 575eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson_dir_create := $(foreach d, \ 576eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson $(shell find ${SUBDIRS} -name '*.c' -exec dirname {} \; | sort -u), \ 577eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson $(shell [ -d ${BUILD}/${d} ] || mkdir -p ${BUILD}/${d})) 578eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 579eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 580eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Default target. 581eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: all 58259d7508c2261a8371715b28f663b8b2efbb5a895Randall Spanglerall: fwlib $(if ${FIRMWARE_ARCH},,host_stuff) $(if ${COV},coverage) 583eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 584eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Host targets 585eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: host_stuff 586eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonhost_stuff: hostlib cgpt utils futil tests 587eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 588eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: clean 589eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonclean: 590eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}/bin/rm -rf ${BUILD} 591eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 592eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: install 593c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardsoninstall: cgpt_install utils_install signing_install futil_install 594eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 595eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Don't delete intermediate object files 596eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.SECONDARY: 597eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 598eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 599eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 600eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Firmware library 601eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 602eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# TPM-specific flags. These depend on the particular TPM we're targeting for. 603eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# They are needed here only for compiling parts of the firmware code into 604eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# user-level tests. 605eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 606eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# TPM_BLOCKING_CONTINUESELFTEST is defined if TPM_ContinueSelfTest blocks until 607eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# the self test has completed. 608eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 60945cc0f2c0a48b377520842597769a5813cf55902Randall Spangler${FWLIB_OBJS}: CFLAGS += -DTPM_BLOCKING_CONTINUESELFTEST 610eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 611eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# TPM_MANUAL_SELFTEST is defined if the self test must be started manually 612eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# (with a call to TPM_ContinueSelfTest) instead of starting automatically at 613eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# power on. 614eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# 615eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# We sincerely hope that TPM_BLOCKING_CONTINUESELFTEST and TPM_MANUAL_SELFTEST 616eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# are not both defined at the same time. (See comment in code.) 617eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 618eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# CFLAGS += -DTPM_MANUAL_SELFTEST 619eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 620eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${FIRMWARE_ARCH},i386) 621eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Unrolling loops in cryptolib makes it faster 62245cc0f2c0a48b377520842597769a5813cf55902Randall Spangler${FWLIB_OBJS}: CFLAGS += -DUNROLL_LOOPS 623eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 624eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Workaround for coreboot on x86, which will power off asynchronously 625eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# without giving us a chance to react. This is not an example of the Right 626eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Way to do things. See chrome-os-partner:7689, and the commit message 627eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# that made this change. 62845cc0f2c0a48b377520842597769a5813cf55902Randall Spangler${FWLIB_OBJS}: CFLAGS += -DSAVE_LOCALE_IMMEDIATELY 629eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 630eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# On x86 we don't actually read the GBB data into RAM until it is needed. 631eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Therefore it makes sense to cache it rather than reading it each time. 632eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Enable this feature. 63345cc0f2c0a48b377520842597769a5813cf55902Randall Spangler${FWLIB_OBJS}: CFLAGS += -DCOPY_BMP_DATA 634eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonendif 635eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 636eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${FIRMWARE_ARCH},) 637eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Disable rollback TPM when compiling locally, since otherwise 638eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# load_kernel_test attempts to talk to the TPM. 63945cc0f2c0a48b377520842597769a5813cf55902Randall Spangler${FWLIB_OBJS}: CFLAGS += -DDISABLE_ROLLBACK_TPM 640eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonendif 641eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 642a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson# Linktest ensures firmware lib doesn't rely on outside libraries 643a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson${BUILD}/firmware/linktest/main_vbinit: ${VBINIT_OBJS} 64493943266c597ad66300445a04afa01270f2b5763Randall Spangler${BUILD}/firmware/linktest/main_vbinit: OBJS = ${VBINIT_OBJS} 6451912bbae89b82c10819b01d039e140e39c668fc7Bill RichardsonALL_OBJS += ${BUILD}/firmware/linktest/main_vbinit.o 646a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson${BUILD}/firmware/linktest/main_vbsf: ${VBSF_OBJS} 64793943266c597ad66300445a04afa01270f2b5763Randall Spangler${BUILD}/firmware/linktest/main_vbsf: OBJS = ${VBSF_OBJS} 6481912bbae89b82c10819b01d039e140e39c668fc7Bill RichardsonALL_OBJS += ${BUILD}/firmware/linktest/main_vbsf.o 649a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson${BUILD}/firmware/linktest/main: ${FWLIB} 650a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson${BUILD}/firmware/linktest/main: LIBS = ${FWLIB} 6511912bbae89b82c10819b01d039e140e39c668fc7Bill RichardsonALL_OBJS += ${BUILD}/firmware/linktest/main.o 65293943266c597ad66300445a04afa01270f2b5763Randall Spangler 65393943266c597ad66300445a04afa01270f2b5763Randall Spangler.phony: fwlinktest 65493943266c597ad66300445a04afa01270f2b5763Randall Spanglerfwlinktest: ${FWLIB} \ 65593943266c597ad66300445a04afa01270f2b5763Randall Spangler ${BUILD}/firmware/linktest/main_vbinit \ 65693943266c597ad66300445a04afa01270f2b5763Randall Spangler ${BUILD}/firmware/linktest/main_vbsf \ 65793943266c597ad66300445a04afa01270f2b5763Randall Spangler ${BUILD}/firmware/linktest/main 65893943266c597ad66300445a04afa01270f2b5763Randall Spangler 659eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: fwlib 660a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardsonfwlib: $(if ${FIRMWARE_ARCH},${FWLIB},fwlinktest) 661eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 662eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${FWLIB}: ${FWLIB_OBJS} 663661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " RM $(subst ${BUILD}/,,$@)\n" 664eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}rm -f $@ 665661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " AR $(subst ${BUILD}/,,$@)\n" 666eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}ar qc $@ $^ 667eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 668eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 669eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Host library 670eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 671a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson 672a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson# Link tests 673a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson${BUILD}/host/linktest/main: ${HOSTLIB} 674a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson${BUILD}/host/linktest/main: LIBS = ${HOSTLIB} 6751912bbae89b82c10819b01d039e140e39c668fc7Bill RichardsonALL_OBJS += ${BUILD}/host/linktest/main.o 676a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson 677eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: hostlib 678a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardsonhostlib: ${BUILD}/host/linktest/main 679eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 680eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/host/% ${HOSTLIB}: INCLUDES += \ 6810c3ba249abb1dc60f5ebabccf84ff13206440b83Bill Richardson -Ihost/include \ 6820c3ba249abb1dc60f5ebabccf84ff13206440b83Bill Richardson -Ihost/arch/${ARCH}/include \ 6830c3ba249abb1dc60f5ebabccf84ff13206440b83Bill Richardson -Ihost/lib/include 684eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 685eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# TODO: better way to make .a than duplicating this recipe each time? 686eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${HOSTLIB}: ${HOSTLIB_OBJS} ${FWLIB_OBJS} 687661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " RM $(subst ${BUILD}/,,$@)\n" 688eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}rm -f $@ 689661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " AR $(subst ${BUILD}/,,$@)\n" 690eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}ar qc $@ $^ 691eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 69281a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson 69381a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson# Ugh. This is a very cut-down version of HOSTLIB just for the installer. 69481a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson.PHONY: tinyhostlib 69581a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardsontinyhostlib: ${TINYHOSTLIB} 69681a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson ${Q}cp -f ${TINYHOSTLIB} ${HOSTLIB} 69781a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson 69881a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson${TINYHOSTLIB}: ${TINYHOSTLIB_OBJS} 699661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " RM $(subst ${BUILD}/,,$@)\n" 70081a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson ${Q}rm -f $@ 701661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " AR $(subst ${BUILD}/,,$@)\n" 70281a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson ${Q}ar qc $@ $^ 70381a0b3de707b4e00958faf36f41b8f3d7bac6808Bill Richardson 704eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 705eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# CGPT library and utility 706eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 707eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: cgpt 708eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsoncgpt: ${CGPT} 709eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 7100c3ba249abb1dc60f5ebabccf84ff13206440b83Bill Richardson${CGPT_OBJS}: INCLUDES += -Ihost/include 7110c3ba249abb1dc60f5ebabccf84ff13206440b83Bill Richardson 712eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${CGPT}: LDFLAGS += -static 713eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${CGPT}: LDLIBS += -luuid 714eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 715a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson${CGPT}: ${CGPT_OBJS} ${HOSTLIB} 716661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " LDcgpt $(subst ${BUILD}/,,$@)\n" 7176db8c75021e2edfa400ae707a8544d041e3c415fBill Richardson ${Q}${LD} -o ${CGPT} ${CFLAGS} ${LDFLAGS} $^ ${LDLIBS} 718eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 719eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: cgpt_install 720eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsoncgpt_install: ${CGPT} 721661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " INSTALL CGPT\n" 722c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson ${Q}mkdir -p ${UB_DIR} 723c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson ${Q}${INSTALL} -t ${UB_DIR} $^ 724eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 725eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 726eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Utilities 727eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 728eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# These have their own headers too. 7290c3ba249abb1dc60f5ebabccf84ff13206440b83Bill Richardson${BUILD}/utility/%: INCLUDES += \ 7300c3ba249abb1dc60f5ebabccf84ff13206440b83Bill Richardson -Ihost/include \ 7310c3ba249abb1dc60f5ebabccf84ff13206440b83Bill Richardson -Ihost/lib/include \ 7320c3ba249abb1dc60f5ebabccf84ff13206440b83Bill Richardson -Iutility/include 733eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 734eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Utilities for auto-update toolkits must be statically linked. 735eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${UTIL_BINS_STATIC}: LDFLAGS += -static 736eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 737a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson 738acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson.PHONY: utils 739c7c6e5d2f7076fe512b692411f0d05d4bf76d91fBill Richardsonutils: ${UTIL_BINS} ${UTIL_SCRIPTS} 740eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}cp -f ${UTIL_SCRIPTS} ${BUILD}/utility 741eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}chmod a+rx $(patsubst %,${BUILD}/%,${UTIL_SCRIPTS}) 742826db09fcec194951e1dc71002d6a92620fbb46bBill Richardson 743a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson${UTIL_BINS} ${UTIL_BINS_STATIC}: ${HOSTLIB} 744a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson${UTIL_BINS} ${UTIL_BINS_STATIC}: LIBS = ${HOSTLIB} 745a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson 746acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson.PHONY: utils_install 747c7c6e5d2f7076fe512b692411f0d05d4bf76d91fBill Richardsonutils_install: ${UTIL_BINS} ${UTIL_SCRIPTS} 748661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " INSTALL UTILS\n" 749c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson ${Q}mkdir -p ${UB_DIR} 750c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson ${Q}${INSTALL} -t ${UB_DIR} ${UTIL_BINS} ${UTIL_SCRIPTS} 751c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson 752c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson# And some signing stuff for the target 753c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson.PHONY: signing_install 754c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardsonsigning_install: ${SIGNING_SCRIPTS} ${SIGNING_SCRIPTS_DEV} ${SIGNING_COMMON} 755661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " INSTALL SIGNING\n" 756c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson ${Q}mkdir -p ${UB_DIR} 757c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson ${Q}${INSTALL} -t ${UB_DIR} ${SIGNING_SCRIPTS} 758feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson ${Q}${INSTALL} -t ${UB_DIR} ${SIGNING_SCRIPTS_DEV} 759feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson ${Q}${INSTALL} -t ${UB_DIR} -m 'u=rw,go=r,a-s' ${SIGNING_COMMON} 760feb2518166b1cd181e607c611cbb610f0c7300daBill Richardsonifneq (${VB_DIR},) 761c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardson ${Q}mkdir -p ${VB_DIR} 762feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson ${Q}for prog in $(notdir ${SIGNING_SCRIPTS_DEV}); do \ 763feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson ln -sf "${FT_DIR}/futility" "${VB_DIR}/$$prog"; done 764c9bf348239af9bcf6c1e9eb6b83cd0ad9b3ea084Bill Richardsonendif 7655d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 766eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 767eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# new Firmware Utility 7685d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 769eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: futil 7706db8c75021e2edfa400ae707a8544d041e3c415fBill Richardsonfutil: ${FUTIL_STATIC_BIN} ${FUTIL_BIN} 7716db8c75021e2edfa400ae707a8544d041e3c415fBill Richardson 7726db8c75021e2edfa400ae707a8544d041e3c415fBill Richardson${FUTIL_STATIC_BIN}: ${FUTIL_LDS} ${FUTIL_STATIC_OBJS} 7736db8c75021e2edfa400ae707a8544d041e3c415fBill Richardson @$(PRINTF) " LD $(subst ${BUILD}/,,$@)\n" 7746db8c75021e2edfa400ae707a8544d041e3c415fBill Richardson ${Q}${LD} -o $@ ${CFLAGS} ${LDFLAGS} -static $^ ${LDLIBS} 7755d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 776eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${FUTIL_BIN}: ${FUTIL_LDS} ${FUTIL_OBJS} 777661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " LD $(subst ${BUILD}/,,$@)\n" 7786db8c75021e2edfa400ae707a8544d041e3c415fBill Richardson ${Q}${LD} -o $@ ${CFLAGS} ${LDFLAGS} $^ ${LDLIBS} 7795d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 780eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: futil_install 781eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonfutil_install: ${FUTIL_BIN} 782661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " INSTALL futility\n" 783feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson ${Q}mkdir -p ${F_DIR} 7846db8c75021e2edfa400ae707a8544d041e3c415fBill Richardson ${Q}${INSTALL} -t ${F_DIR} ${FUTIL_BIN} ${FUTIL_STATIC_BIN} 785feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson ${Q}for prog in ${FUTIL_OLD}; do \ 786feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson ln -sf futility "${F_DIR}/$$prog"; done 7875d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 78820807b6158b6a43baf0974bc763890888ba1f841Bill Richardson# TODO(wfrichar): This will need some refactoring (crbug.com/228932) 78920807b6158b6a43baf0974bc763890888ba1f841Bill Richardson${BUILD}/futility/% ${HOSTLIB}: INCLUDES += \ 79020807b6158b6a43baf0974bc763890888ba1f841Bill Richardson -Ihost/include \ 79120807b6158b6a43baf0974bc763890888ba1f841Bill Richardson -Ihost/arch/${ARCH}/include \ 79220807b6158b6a43baf0974bc763890888ba1f841Bill Richardson -Ihost/lib/include 79320807b6158b6a43baf0974bc763890888ba1f841Bill Richardson${FUTIL_STATIC_BIN} ${FUTIL_BIN}: ${HOSTLIB} 79420807b6158b6a43baf0974bc763890888ba1f841Bill Richardson${FUTIL_STATIC_BIN} ${FUTIL_BIN}: LIBS = ${HOSTLIB} 79520807b6158b6a43baf0974bc763890888ba1f841Bill Richardson 796eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 7975d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# Utility to generate TLCL structure definition header file. 7985d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 799acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson${BUILD}/utility/tlcl_generator: CFLAGS += -fpack-struct 8005d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 8015d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerSTRUCTURES_TMP=${BUILD}/tlcl_structures.tmp 8025d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall SpanglerSTRUCTURES_SRC=firmware/lib/tpm_lite/include/tlcl_structures.h 8035d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 804acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson.PHONY: update_tlcl_structures 8055d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spanglerupdate_tlcl_structures: ${BUILD}/utility/tlcl_generator 806661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " Rebuilding TLCL structures\n" 807eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}${BUILD}/utility/tlcl_generator > ${STRUCTURES_TMP} 808eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}cmp -s ${STRUCTURES_TMP} ${STRUCTURES_SRC} || \ 8095d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler ( echo "%% Updating structures.h %%" && \ 810eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson cp ${STRUCTURES_TMP} ${STRUCTURES_SRC} ) 8115d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 812eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 8135d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# Tests 8145d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 815eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: tests 816eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsontests: ${TEST_BINS} 8175d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 818a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson${TEST_BINS}: ${HOSTLIB} ${TESTLIB} 819339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson${TEST_BINS}: INCLUDES += -Itests 820a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardson${TEST_BINS}: LIBS = ${HOSTLIB} ${TESTLIB} 8215d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 822eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${TESTLIB}: ${TESTLIB_OBJS} 823661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " RM $(subst ${BUILD}/,,$@)\n" 824eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}rm -f $@ 825661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " AR $(subst ${BUILD}/,,$@)\n" 826eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}ar qc $@ $^ 8275d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 8285d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 829eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 830eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Generic build rules. LIBS and OBJS can be overridden to tweak the generic 831eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# rules for specific targets. 8325d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 833eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/%: ${BUILD}/%.o ${OBJS} ${LIBS} 834661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " LD $(subst ${BUILD}/,,$@)\n" 8356db8c75021e2edfa400ae707a8544d041e3c415fBill Richardson ${Q}${LD} -o $@ ${CFLAGS} ${LDFLAGS} $< ${OBJS} ${LIBS} ${LDLIBS} 836eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 837eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/%.o: %.c 838661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " CC $(subst ${BUILD}/,,$@)\n" 839eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}${CC} ${CFLAGS} ${INCLUDES} -c -o $@ $< 840eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 841eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Rules to recompile a single source file for library and test 842eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# TODO: is there a tidier way to do this? 843eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/%_for_lib.o: CFLAGS += -DFOR_LIBRARY 844eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/%_for_lib.o: %.c 845661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " CC-for-lib $(subst ${BUILD}/,,$@)\n" 846eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}${CC} ${CFLAGS} ${INCLUDES} -c -o $@ $< 847eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 848eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/%_for_test.o: CFLAGS += -DFOR_TEST 849eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/%_for_test.o: %.c 850661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " CC-for-test $(subst ${BUILD}/,,$@)\n" 851eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}${CC} ${CFLAGS} ${INCLUDES} -c -o $@ $< 852eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 853eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# TODO: C++ files don't belong in vboot reference at all. Convert to C. 854eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/%.o: %.cc 855661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " CXX $(subst ${BUILD}/,,$@)\n" 856eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}${CXX} ${CFLAGS} ${INCLUDES} -c -o $@ $< 857eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 858eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# ---------------------------------------------------------------------------- 859eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Here are the special tweaks to the generic rules. 860eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 861eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# GBB utility needs C++ linker. TODO: It shouldn't. 862eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/gbb_utility: LD = ${CXX} 863eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 864feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson# Because we play some clever linker script games to add new commands without 865feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson# changing any header files, futility must be linked with ld.bfd, not gold. 866feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson${FUTIL_BIN}: LDFLAGS += -fuse-ld=bfd 8676db8c75021e2edfa400ae707a8544d041e3c415fBill Richardson${FUTIL_STATIC_BIN}: LDFLAGS += -fuse-ld=bfd 868feb2518166b1cd181e607c611cbb610f0c7300daBill Richardson 869eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Some utilities need external crypto functions 870eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/dumpRSAPublicKey: LDLIBS += ${CRYPTO_LIBS} 871eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/pad_digest_utility: LDLIBS += ${CRYPTO_LIBS} 872eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/signature_digest_utility: LDLIBS += ${CRYPTO_LIBS} 873eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/dev_sign_file: LDLIBS += ${CRYPTO_LIBS} 874eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/vbutil_firmware: LDLIBS += ${CRYPTO_LIBS} 875eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/vbutil_kernel: LDLIBS += ${CRYPTO_LIBS} 876eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/vbutil_key: LDLIBS += ${CRYPTO_LIBS} 877eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/vbutil_keyblock: LDLIBS += ${CRYPTO_LIBS} 878eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 879eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/host/linktest/main: LDLIBS += ${CRYPTO_LIBS} 880eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/tests/vboot_common2_tests: LDLIBS += ${CRYPTO_LIBS} 881eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/tests/vboot_common3_tests: LDLIBS += ${CRYPTO_LIBS} 882eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 883eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/bmpblk_utility: LD = ${CXX} 884eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/bmpblk_utility: LDLIBS = -llzma -lyaml 885eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 886eecc18fc953bd367d3cb5aa006df4b153d20a45eBill RichardsonBMPBLK_UTILITY_DEPS = \ 887eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${BUILD}/utility/bmpblk_util.o \ 888eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${BUILD}/utility/image_types.o \ 889eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${BUILD}/utility/eficompress_for_lib.o \ 890eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${BUILD}/utility/efidecompress_for_lib.o 8911912bbae89b82c10819b01d039e140e39c668fc7Bill Richardson 892eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/bmpblk_utility: OBJS = ${BMPBLK_UTILITY_DEPS} 893eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/bmpblk_utility: ${BMPBLK_UTILITY_DEPS} 8941912bbae89b82c10819b01d039e140e39c668fc7Bill RichardsonALL_OBJS += ${BMPBLK_UTILITY_DEPS} 895eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 896eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/bmpblk_font: OBJS += ${BUILD}/utility/image_types.o 897eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/utility/bmpblk_font: ${BUILD}/utility/image_types.o 8981912bbae89b82c10819b01d039e140e39c668fc7Bill RichardsonALL_OBJS += ${BUILD}/utility/image_types.o 899eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 900eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Allow multiple definitions, so tests can mock functions from other libraries 901eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/tests/%: CFLAGS += -Xlinker --allow-multiple-definition 9020c3ba249abb1dc60f5ebabccf84ff13206440b83Bill Richardson${BUILD}/tests/%: INCLUDES += -Ihost/include -Ihost/lib/include 903eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/tests/%: LDLIBS += -lrt -luuid 904eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/tests/%: LIBS += ${TESTLIB} 9055d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 9065d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler${BUILD}/tests/rollback_index2_tests: OBJS += \ 90717f8d341099120da78a6ca71165834eefb0960edRandall Spangler ${BUILD}/firmware/lib/rollback_index_for_test.o 908eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/tests/rollback_index2_tests: \ 909eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${BUILD}/firmware/lib/rollback_index_for_test.o 9101912bbae89b82c10819b01d039e140e39c668fc7Bill RichardsonALL_OBJS += ${BUILD}/firmware/lib/rollback_index_for_test.o 9115d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 912c3d488d155961d2849dfdaa4f0461df1aa95c2caRandall Spangler${BUILD}/tests/tlcl_tests: OBJS += \ 913c3d488d155961d2849dfdaa4f0461df1aa95c2caRandall Spangler ${BUILD}/firmware/lib/tpm_lite/tlcl_for_test.o 914c3d488d155961d2849dfdaa4f0461df1aa95c2caRandall Spangler${BUILD}/tests/tlcl_tests: \ 915c3d488d155961d2849dfdaa4f0461df1aa95c2caRandall Spangler ${BUILD}/firmware/lib/tpm_lite/tlcl_for_test.o 9161912bbae89b82c10819b01d039e140e39c668fc7Bill RichardsonALL_OBJS += ${BUILD}/firmware/lib/tpm_lite/tlcl_for_test.o 917c3d488d155961d2849dfdaa4f0461df1aa95c2caRandall Spangler 9185d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler${BUILD}/tests/vboot_audio_tests: OBJS += \ 91917f8d341099120da78a6ca71165834eefb0960edRandall Spangler ${BUILD}/firmware/lib/vboot_audio_for_test.o 920eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${BUILD}/tests/vboot_audio_tests: \ 921eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${BUILD}/firmware/lib/vboot_audio_for_test.o 9221912bbae89b82c10819b01d039e140e39c668fc7Bill RichardsonALL_OBJS += ${BUILD}/firmware/lib/vboot_audio_for_test.o 9235d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 924acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson${BUILD}/tests/rollback_index_test: INCLUDES += -I/usr/include 925acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson${BUILD}/tests/rollback_index_test: LIBS += -ltlcl 9265d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 927339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill RichardsonTLCL_TEST_BINS = $(addprefix ${BUILD}/,${TLCL_TEST_NAMES}) 928eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${TLCL_TEST_BINS}: OBJS += ${BUILD}/tests/tpm_lite/tlcl_tests.o 929eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson${TLCL_TEST_BINS}: ${BUILD}/tests/tpm_lite/tlcl_tests.o 9301912bbae89b82c10819b01d039e140e39c668fc7Bill RichardsonALL_OBJS += ${BUILD}/tests/tpm_lite/tlcl_tests.o 9315d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 932eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson############################################################################## 933eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson# Targets that exist just to run tests 9345d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 9355d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# Frequently-run tests 936eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: test_targets 937eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsontest_targets:: runcgpttests runmisctests 938844bce57471153664c78993dab453e87891bb969Randall Spangler 939eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${MINIMAL},) 940844bce57471153664c78993dab453e87891bb969Randall Spangler# Bitmap utility isn't compiled for minimal variant 941feb2518166b1cd181e607c611cbb610f0c7300daBill Richardsontest_targets:: runbmptests runfutiltests 942844bce57471153664c78993dab453e87891bb969Randall Spangler# Scripts don't work under qemu testing 943844bce57471153664c78993dab453e87891bb969Randall Spangler# TODO: convert scripts to makefile so they can be called directly 944eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsontest_targets:: runtestscripts 945844bce57471153664c78993dab453e87891bb969Randall Spanglerendif 946844bce57471153664c78993dab453e87891bb969Randall Spangler 947eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: test_setup 948eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsontest_setup:: cgpt utils futil tests 949eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 950844bce57471153664c78993dab453e87891bb969Randall Spangler# Qemu setup for cross-compiled tests. Need to copy qemu binary into the 951844bce57471153664c78993dab453e87891bb969Randall Spangler# sysroot. 952eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifneq (${QEMU_ARCH},) 953eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsontest_setup:: qemu_install 954844bce57471153664c78993dab453e87891bb969Randall Spangler 955844bce57471153664c78993dab453e87891bb969Randall Spangler.PHONY: qemu_install 956844bce57471153664c78993dab453e87891bb969Randall Spanglerqemu_install: 957eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonifeq (${SYSROOT},) 958eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson $(error SYSROOT must be set to the top of the target-specific root \ 959eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonwhen cross-compiling for qemu-based tests to run properly.) 960eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonendif 961661ae9e9cbaad430b87b443712d2608f9ce59883Simon Glass @$(PRINTF) " Copying qemu binary.\n" 962eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}cp -fu /usr/bin/${QEMU_BIN} ${BUILD}/${QEMU_BIN} 963eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${Q}chmod a+rx ${BUILD}/${QEMU_BIN} 964844bce57471153664c78993dab453e87891bb969Randall Spanglerendif 965844bce57471153664c78993dab453e87891bb969Randall Spangler 966acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson.PHONY: runtests 967a130e0b0a38efa01195f5a7be635a66f0dd60c29Bill Richardsonruntests: test_setup test_targets 9685d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 9695d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# Generate test keys 970acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson.PHONY: genkeys 971844bce57471153664c78993dab453e87891bb969Randall Spanglergenkeys: utils 9725d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler tests/gen_test_keys.sh 9735d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 9745d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# Generate test cases for fuzzing 975acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson.PHONY: genfuzztestcases 976a808dc944284e6eba39a8f19ddb46bc61c34de8aRandall Spanglergenfuzztestcases: utils 9775d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler tests/gen_fuzz_test_cases.sh 9785d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 979acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson.PHONY: runbmptests 980eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonrunbmptests: test_setup 981eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson cd tests/bitmaps && BMPBLK=${BUILD_RUN}/utility/bmpblk_utility \ 9825d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler ./TestBmpBlock.py -v 9835d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 984acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson.PHONY: runcgpttests 985eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonruncgpttests: test_setup 986eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/cgptlib_test 9875d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 988844bce57471153664c78993dab453e87891bb969Randall Spangler.PHONY: runtestscripts 989eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonruntestscripts: test_setup genfuzztestcases 990eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson tests/run_cgpt_tests.sh ${BUILD_RUN}/cgpt/cgpt 9915d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler tests/run_preamble_tests.sh 9925d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler tests/run_rsa_tests.sh 993844bce57471153664c78993dab453e87891bb969Randall Spangler tests/run_vbutil_kernel_arg_tests.sh 9945d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler tests/run_vbutil_tests.sh 9955d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 996844bce57471153664c78993dab453e87891bb969Randall Spangler.PHONY: runmisctests 997eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonrunmisctests: test_setup 998eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/rollback_index2_tests 999a3eac79f5070747e326da631c1eec155f0389919Randall Spangler ${RUNTEST} ${BUILD_RUN}/tests/rollback_index3_tests 1000eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/rsa_utility_tests 1001eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/sha_tests 1002eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/stateful_util_tests 1003c3d488d155961d2849dfdaa4f0461df1aa95c2caRandall Spangler ${RUNTEST} ${BUILD_RUN}/tests/tlcl_tests 1004eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/tpm_bootmode_tests 1005eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/utility_string_tests 1006eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/utility_tests 1007eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_devmode_tests 1008eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_firmware_tests 10090714d9de56da3a5c686b26755d15aa6788c727d4Randall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_init_tests 10100714d9de56da3a5c686b26755d15aa6788c727d4Randall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_kernel_tests 10117f43669630cb42e40ca6ddc1128eefea8fd339d9Randall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_kernel2_tests 10127f43669630cb42e40ca6ddc1128eefea8fd339d9Randall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_kernel3_tests 10137f43669630cb42e40ca6ddc1128eefea8fd339d9Randall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_kernel4_tests 1014eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/vboot_audio_tests 1015e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_common_tests 1016e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_common2_tests ${TEST_KEYS} 1017e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_common3_tests ${TEST_KEYS} 1018786a5dca74387de5ffdc51ca5a099a4e90f406daRandall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_display_tests 1019eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/vboot_firmware_tests 102049cb0d3471e768da11fe76b65769bd57dca38bd7Randall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_kernel_tests 10216dbf9d9160b2927d76017d0f51919e0880f9b2ccRandall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_nvstorage_test 1022eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson 1023eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardson.PHONY: runfutiltests 1024feb2518166b1cd181e607c611cbb610f0c7300daBill Richardsonrunfutiltests: override DESTDIR = ${TEST_INSTALL_DIR} 1025eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonrunfutiltests: test_setup install 1026339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson tests/futility/run_test_scripts.sh ${DESTDIR} 1027339f7e030cebe98a072d37acccbd1f0b4c1dea9bBill Richardson ${RUNTEST} ${BUILD_RUN}/tests/futility/test_not_really 1028844bce57471153664c78993dab453e87891bb969Randall Spangler 10295d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# Run long tests, including all permutations of encryption keys (instead of 1030786a5dca74387de5ffdc51ca5a099a4e90f406daRandall Spangler# just the ones we use) and tests of currently-unused code. 10315d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# Not run by automated build. 1032acb2ee977b8dd139b01b68d0e269ea6bcc425c2bBill Richardson.PHONY: runlongtests 1033eecc18fc953bd367d3cb5aa006df4b153d20a45eBill Richardsonrunlongtests: test_setup genkeys genfuzztestcases 1034e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_common2_tests ${TEST_KEYS} --all 1035e061a256549607a56d771eb8ddae5d0dd90d519cRandall Spangler ${RUNTEST} ${BUILD_RUN}/tests/vboot_common3_tests ${TEST_KEYS} --all 10365d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler tests/run_preamble_tests.sh --all 10375d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler tests/run_vbutil_tests.sh --all 10385d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 10395d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# TODO: tests to run when ported to new API 10405d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# ./run_image_verification_tests.sh 10415d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# # Splicing tests 10425d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# ${BUILD}/tests/firmware_splicing_tests 10435d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# ${BUILD}/tests/kernel_splicing_tests 10445d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# # Rollback Tests 10455d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# ${BUILD}/tests/firmware_rollback_tests 10465d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler# ${BUILD}/tests/kernel_rollback_tests 10475d9bbf2bbd7b8dfad45d8ddfea6512987736e523Randall Spangler 104859d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler# Code coverage 104959d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler.PHONY: coverage_init 105059d7508c2261a8371715b28f663b8b2efbb5a895Randall Spanglercoverage_init: test_setup 105159d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler rm -f ${COV_INFO}* 105259d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler lcov -c -i -d . -b . -o ${COV_INFO}.initial 105359d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler 105459d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler.PHONY: coverage_html 105559d7508c2261a8371715b28f663b8b2efbb5a895Randall Spanglercoverage_html: 105659d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler lcov -c -d . -b . -o ${COV_INFO}.tests 105759d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler lcov -a ${COV_INFO}.initial -a ${COV_INFO}.tests -o ${COV_INFO}.total 105859d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler lcov -r ${COV_INFO}.total '/usr/*' '*/linktest/*' -o ${COV_INFO}.local 105959d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler genhtml ${COV_INFO}.local -o ${BUILD}/coverage 106059d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler 106159d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler# Generate addtional coverage stats just for firmware subdir, because the 106259d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler# per-directory stats for the whole project don't include their own subdirs. 106349cb0d3471e768da11fe76b65769bd57dca38bd7Randall Spangler lcov -r ${COV_INFO}.local '*/stub/*' -o ${COV_INFO}.nostub 106449cb0d3471e768da11fe76b65769bd57dca38bd7Randall Spangler lcov -e ${COV_INFO}.nostub '${SRCDIR}/firmware/*' \ 106559d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler -o ${COV_INFO}.firmware 106659d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler 106759d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler.PHONY: coverage 106859d7508c2261a8371715b28f663b8b2efbb5a895Randall Spanglerifeq (${COV},) 106959d7508c2261a8371715b28f663b8b2efbb5a895Randall Spanglercoverage: 107059d7508c2261a8371715b28f663b8b2efbb5a895Randall Spangler $(error Build coverage like this: make clean && COV=1 make) 107159d7508c2261a8371715b28f663b8b2efbb5a895Randall Spanglerelse 107259d7508c2261a8371715b28f663b8b2efbb5a895Randall Spanglercoverage: coverage_init runtests coverage_html 107359d7508c2261a8371715b28f663b8b2efbb5a895Randall Spanglerendif 10741912bbae89b82c10819b01d039e140e39c668fc7Bill Richardson 10751912bbae89b82c10819b01d039e140e39c668fc7Bill Richardson# Include generated dependencies 10761912bbae89b82c10819b01d039e140e39c668fc7Bill RichardsonALL_DEPS += ${ALL_OBJS:%.o=%.o.d} 10771912bbae89b82c10819b01d039e140e39c668fc7Bill Richardson-include ${ALL_DEPS} 1078