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 | 10 LIBS = $(FWLIB) # Firmware library must be self-contained |
11 | 11 |
12 # Disable rollback TPM when compiling locally, since otherwise | 12 # Disable rollback TPM when compiling locally, since otherwise |
13 # load_kernel_test attempts to talk to the TPM. | 13 # load_kernel_test attempts to talk to the TPM. |
| 14 ifeq ($(FIRMWARE_ARCH),) |
14 CFLAGS += -DDISABLE_ROLLBACK_TPM | 15 CFLAGS += -DDISABLE_ROLLBACK_TPM |
| 16 endif |
15 | 17 |
16 INCLUDES = \ | 18 INCLUDES = \ |
17 -I$(FWTOP)/include \ | 19 -I$(FWTOP)/include \ |
18 -I$(LIBDIR)/include \ | 20 -I$(LIBDIR)/include \ |
19 -I$(LIBDIR)/cgptlib/include \ | 21 -I$(LIBDIR)/cgptlib/include \ |
20 -I$(LIBDIR)/cryptolib/include \ | 22 -I$(LIBDIR)/cryptolib/include \ |
21 » -I$(LIBDIR)/tpm_lite/include \ | 23 » -I$(LIBDIR)/tpm_lite/include |
22 » -I$(STUBDIR)/include | 24 |
| 25 ifeq ($(FIRMWARE_ARCH),) |
| 26 INCLUDES += -I$(STUBDIR)/include |
| 27 else |
| 28 INCLUDES += -I$(FWDIR)/arch/$(FIRMWARE_ARCH)/include |
| 29 endif |
23 | 30 |
24 # find ./lib -iname '*.c' | sort | 31 # find ./lib -iname '*.c' | sort |
25 LIB_SRCS = \ | 32 LIB_SRCS = \ |
26 ./lib/cgptlib/cgptlib.c \ | 33 ./lib/cgptlib/cgptlib.c \ |
27 ./lib/cgptlib/cgptlib_internal.c \ | 34 ./lib/cgptlib/cgptlib_internal.c \ |
28 ./lib/cgptlib/crc32.c \ | 35 ./lib/cgptlib/crc32.c \ |
29 ./lib/cryptolib/padding.c \ | 36 ./lib/cryptolib/padding.c \ |
30 ./lib/cryptolib/rsa.c \ | 37 ./lib/cryptolib/rsa.c \ |
31 ./lib/cryptolib/rsa_utility.c \ | 38 ./lib/cryptolib/rsa_utility.c \ |
32 ./lib/cryptolib/sha1.c \ | 39 ./lib/cryptolib/sha1.c \ |
(...skipping 12 matching lines...) Expand all Loading... |
45 STUB_SRCS = \ | 52 STUB_SRCS = \ |
46 ./stub/boot_device_stub.c \ | 53 ./stub/boot_device_stub.c \ |
47 ./stub/load_firmware_stub.c \ | 54 ./stub/load_firmware_stub.c \ |
48 ./stub/tpm_lite_stub.c \ | 55 ./stub/tpm_lite_stub.c \ |
49 ./stub/utility_stub.c | 56 ./stub/utility_stub.c |
50 | 57 |
51 STUB_OBJS = $(STUB_SRCS:%.c=${BUILD_ROOT}/%.o) | 58 STUB_OBJS = $(STUB_SRCS:%.c=${BUILD_ROOT}/%.o) |
52 | 59 |
53 ALL_SRCS = ${LIB_SRCS} ${STUB_SRCS} version.c | 60 ALL_SRCS = ${LIB_SRCS} ${STUB_SRCS} version.c |
54 | 61 |
| 62 ifeq ($(FIRMWARE_ARCH),) |
55 test : $(STUB_OBJS) $(FWLIB) update-version | 63 test : $(STUB_OBJS) $(FWLIB) update-version |
56 $(CC) $(CFLAGS) $(INCLUDES) -o $(BUILD_ROOT)/a.out \ | 64 $(CC) $(CFLAGS) $(INCLUDES) -o $(BUILD_ROOT)/a.out \ |
57 $(TESTDIR)/main.c $(STUB_OBJS) $(LIBS) | 65 $(TESTDIR)/main.c $(STUB_OBJS) $(LIBS) |
| 66 else |
| 67 test : $(FWLIB) |
| 68 endif |
58 | 69 |
59 # This is executed at every make, to see if anything has changed | 70 # This is executed at every make, to see if anything has changed |
60 update-version : | 71 update-version : |
61 find \( -name '*.[ch]' -o -name 'Makefile*' \) -a \! -name version.c \ | 72 find \( -name '*.[ch]' -o -name 'Makefile*' \) -a \! -name version.c \ |
62 | sort | xargs cat | md5sum | cut -c 25-32 > \ | 73 | sort | xargs cat | md5sum | cut -c 25-32 > \ |
63 ${BUILD_ROOT}/x.tmp && \ | 74 ${BUILD_ROOT}/x.tmp && \ |
64 echo "char* VbootVersion = \"VBOOv=$$(cat ${BUILD_ROOT}/x.tmp)\";" > \ | 75 echo "char* VbootVersion = \"VBOOv=$$(cat ${BUILD_ROOT}/x.tmp)\";" > \ |
65 ${BUILD_ROOT}/version.tmp && \ | 76 ${BUILD_ROOT}/version.tmp && \ |
66 (cmp -s ${BUILD_ROOT}/version.tmp version.c || \ | 77 (cmp -s ${BUILD_ROOT}/version.tmp version.c || \ |
67 ( echo "** Updating version.c **" && \ | 78 ( echo "** Updating version.c **" && \ |
68 cp ${BUILD_ROOT}/version.tmp version.c)) | 79 cp ${BUILD_ROOT}/version.tmp version.c)) |
69 | 80 |
70 include ../common.mk | 81 include ../common.mk |
71 | 82 |
72 $(FWLIB) : $(LIB_OBJS) | 83 $(FWLIB) : $(LIB_OBJS) |
73 rm -f $@ | 84 rm -f $@ |
74 ar qc $@ $^ | 85 ar qc $@ $^ |
OLD | NEW |