| OLD | NEW |
| 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 FWTOP := $(shell pwd) | 5 FWTOP := $(shell pwd) |
| 6 LIBDIR = $(FWTOP)/lib | 6 LIBDIR = $(FWTOP)/lib |
| 7 STUBDIR = $(FWTOP)/stub | 7 STUBDIR = $(FWTOP)/stub |
| 8 TESTDIR = $(FWTOP)/linktest | 8 TESTDIR = $(FWTOP)/linktest |
| 9 BUILD_ROOT := ${BUILD}/$(shell basename ${FWTOP}) | 9 BUILD_ROOT := ${BUILD}/$(shell basename ${FWTOP}) |
| 10 LIBS = $(FWLIB) # Firmware library must be self-contained |
| 11 |
| 12 # Disable rollback TPM when compiling locally, since otherwise |
| 13 # load_kernel_test attempts to talk to the TPM. |
| 14 CFLAGS += -DDISABLE_ROLLBACK_TPM |
| 10 | 15 |
| 11 INCLUDES = \ | 16 INCLUDES = \ |
| 12 -I$(FWTOP)/include \ | 17 -I$(FWTOP)/include \ |
| 13 -I$(LIBDIR)/include \ | 18 -I$(LIBDIR)/include \ |
| 14 -I$(LIBDIR)/cgptlib/include \ | 19 -I$(LIBDIR)/cgptlib/include \ |
| 15 -I$(LIBDIR)/cryptolib/include \ | 20 -I$(LIBDIR)/cryptolib/include \ |
| 21 -I$(LIBDIR)/tpm_lite/include \ |
| 16 -I$(STUBDIR)/include | 22 -I$(STUBDIR)/include |
| 17 | 23 |
| 18 | |
| 19 # find ./lib -iname '*.c' | sort | 24 # find ./lib -iname '*.c' | sort |
| 20 LIB_SRCS = \ | 25 LIB_SRCS = \ |
| 21 ./lib/cgptlib/cgptlib.c \ | 26 ./lib/cgptlib/cgptlib.c \ |
| 22 ./lib/cgptlib/cgptlib_internal.c \ | 27 ./lib/cgptlib/cgptlib_internal.c \ |
| 23 ./lib/cgptlib/crc32.c \ | 28 ./lib/cgptlib/crc32.c \ |
| 24 ./lib/cryptolib/padding.c \ | 29 ./lib/cryptolib/padding.c \ |
| 25 ./lib/cryptolib/rsa.c \ | 30 ./lib/cryptolib/rsa.c \ |
| 26 ./lib/cryptolib/rsa_utility.c \ | 31 ./lib/cryptolib/rsa_utility.c \ |
| 27 ./lib/cryptolib/sha1.c \ | 32 ./lib/cryptolib/sha1.c \ |
| 28 ./lib/cryptolib/sha2.c \ | 33 ./lib/cryptolib/sha2.c \ |
| 29 ./lib/cryptolib/sha_utility.c \ | 34 ./lib/cryptolib/sha_utility.c \ |
| 30 ./lib/rollback_index.c \ | 35 ./lib/rollback_index.c \ |
| 31 ./lib/stateful_util.c \ | 36 ./lib/stateful_util.c \ |
| 37 ./lib/tpm_lite/tlcl.c \ |
| 32 ./lib/vboot_common.c \ | 38 ./lib/vboot_common.c \ |
| 33 ./lib/vboot_firmware.c \ | 39 ./lib/vboot_firmware.c \ |
| 34 ./lib/vboot_kernel.c | 40 ./lib/vboot_kernel.c |
| 35 | 41 |
| 36 STUB_SRCS = \ | 42 STUB_SRCS = \ |
| 37 ./stub/boot_device_stub.c \ | 43 ./stub/boot_device_stub.c \ |
| 38 ./stub/load_firmware_stub.c \ | 44 ./stub/load_firmware_stub.c \ |
| 39 » ./stub/tlcl.c \ | 45 » ./stub/tpm_lite_stub.c \ |
| 40 ./stub/utility_stub.c | 46 ./stub/utility_stub.c |
| 41 | 47 |
| 42 ALL_SRCS = ${LIB_SRCS} ${STUB_SRCS} version.c | 48 ALL_SRCS = ${LIB_SRCS} ${STUB_SRCS} version.c |
| 43 | 49 |
| 44 test : $(FWLIB) update-version | 50 test : $(FWLIB) update-version |
| 45 $(CC) $(CFLAGS) $(INCLUDES) -o $(BUILD_ROOT)/a.out \ | 51 $(CC) $(CFLAGS) $(INCLUDES) -o $(BUILD_ROOT)/a.out \ |
| 46 » » $(TESTDIR)/main.c $(FWLIB) | 52 » » $(TESTDIR)/main.c $(LIBS) |
| 47 | 53 |
| 48 # This is executed at every make, to see if anything has changed | 54 # This is executed at every make, to see if anything has changed |
| 49 update-version : | 55 update-version : |
| 50 find \( -name '*.[ch]' -o -name 'Makefile*' \) -a \! -name version.c \ | 56 find \( -name '*.[ch]' -o -name 'Makefile*' \) -a \! -name version.c \ |
| 51 | sort | xargs cat | md5sum | cut -c 25-32 > \ | 57 | sort | xargs cat | md5sum | cut -c 25-32 > \ |
| 52 ${BUILD_ROOT}/x.tmp && \ | 58 ${BUILD_ROOT}/x.tmp && \ |
| 53 echo "char* VbootVersion = \"VBOOv=$$(cat ${BUILD_ROOT}/x.tmp)\";" > \ | 59 echo "char* VbootVersion = \"VBOOv=$$(cat ${BUILD_ROOT}/x.tmp)\";" > \ |
| 54 ${BUILD_ROOT}/version.tmp && \ | 60 ${BUILD_ROOT}/version.tmp && \ |
| 55 (cmp -s ${BUILD_ROOT}/version.tmp version.c || \ | 61 (cmp -s ${BUILD_ROOT}/version.tmp version.c || \ |
| 56 ( echo "** Updating version.c **" && \ | 62 ( echo "** Updating version.c **" && \ |
| 57 cp ${BUILD_ROOT}/version.tmp version.c)) | 63 cp ${BUILD_ROOT}/version.tmp version.c)) |
| 58 | 64 |
| 59 include ../common.mk | 65 include ../common.mk |
| 60 | 66 |
| 61 $(FWLIB) : $(ALL_OBJS) | 67 $(FWLIB) : $(ALL_OBJS) |
| 62 rm -f $@ | 68 rm -f $@ |
| 63 ar qc $@ $^ | 69 ar qc $@ $^ |
| OLD | NEW |