mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-26 19:25:02 +00:00
Fix integration bugs (vboot side)
BUG=chromium-os:8621 TEST=See below 1. Build and run tests of vboot (including linktest) $ make && make runtests 2. Check if *_stub.o are not in vboot_fw.a $ nm /build/<board>/usr/lib/vboot_fw.a | grep _stub.o 3. Build and boot x86-generic image $ ./build_packages --board=x86-generic && ./build_image --board=x86-generic (Then successfully boot the image you just built) See CL=4372001 for u-boot side changes Review URL: http://codereview.chromium.org/4266002 Change-Id: Icc2bcc551c998f370e4b737fbe442ebf029cd81c
This commit is contained in:
2
Makefile
2
Makefile
@@ -21,7 +21,7 @@ export INCLUDES = -I$(FWDIR)/include -I$(FWDIR)/stub/include
|
||||
|
||||
export BUILD = ${TOP}/build
|
||||
export FWLIB = ${BUILD}/vboot_fw.a
|
||||
export HOSTLIB= ${BUILD}/vboot_host.a
|
||||
export HOSTLIB = ${BUILD}/vboot_host.a
|
||||
|
||||
SUBDIRS = firmware host utility cgpt tests tests/tpm_lite
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ LDFLAGS += -luuid
|
||||
BUILD_ROOT := ${BUILD}/cgpt
|
||||
|
||||
INCLUDES = -I$(FWDIR)/lib/cgptlib/include -I$(FWDIR)/include
|
||||
LIBS = ${FWLIB}
|
||||
LIBS = ${HOSTLIB}
|
||||
|
||||
DESTDIR ?= /usr/bin
|
||||
|
||||
|
||||
@@ -40,17 +40,21 @@ LIB_SRCS = \
|
||||
./lib/vboot_firmware.c \
|
||||
./lib/vboot_kernel.c
|
||||
|
||||
LIB_OBJS = $(LIB_SRCS:%.c=${BUILD_ROOT}/%.o)
|
||||
|
||||
STUB_SRCS = \
|
||||
./stub/boot_device_stub.c \
|
||||
./stub/load_firmware_stub.c \
|
||||
./stub/tpm_lite_stub.c \
|
||||
./stub/utility_stub.c
|
||||
|
||||
STUB_OBJS = $(STUB_SRCS:%.c=${BUILD_ROOT}/%.o)
|
||||
|
||||
ALL_SRCS = ${LIB_SRCS} ${STUB_SRCS} version.c
|
||||
|
||||
test : $(FWLIB) update-version
|
||||
test : $(STUB_OBJS) $(FWLIB) update-version
|
||||
$(CC) $(CFLAGS) $(INCLUDES) -o $(BUILD_ROOT)/a.out \
|
||||
$(TESTDIR)/main.c $(LIBS)
|
||||
$(TESTDIR)/main.c $(STUB_OBJS) $(LIBS)
|
||||
|
||||
# This is executed at every make, to see if anything has changed
|
||||
update-version :
|
||||
@@ -65,6 +69,6 @@ update-version :
|
||||
|
||||
include ../common.mk
|
||||
|
||||
$(FWLIB) : $(ALL_OBJS)
|
||||
$(FWLIB) : $(LIB_OBJS)
|
||||
rm -f $@
|
||||
ar qc $@ $^
|
||||
|
||||
35
firmware/include/tlcl_stub.h
Normal file
35
firmware/include/tlcl_stub.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/* Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
/* TPM Lightweight Command Library.
|
||||
*
|
||||
* A low-level library for interfacing to TPM hardware or an emulator.
|
||||
*/
|
||||
|
||||
#ifndef VBOOT_REFERENCE_TLCL_STUB_H_
|
||||
#define VBOOT_REFERENCE_TLCL_STUB_H_
|
||||
|
||||
#include "sysincludes.h"
|
||||
#include "tss_constants.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Functions to be implemented by the stub library */
|
||||
|
||||
/* Initialize the stub library */
|
||||
void TlclStubInit(void);
|
||||
|
||||
/* Close and open the device. This is needed for running more complex commands
|
||||
* at user level, such as TPM_TakeOwnership, since the TPM device can be opened
|
||||
* only by one process at a time.
|
||||
*/
|
||||
void TlclCloseDevice(void);
|
||||
void TlclOpenDevice(void);
|
||||
|
||||
/* Send data to the TPM and receive a response. Returns 0 if success,
|
||||
* nonzero if error. */
|
||||
uint32_t TlclStubSendReceive(const uint8_t* request, int request_length,
|
||||
uint8_t* response, int max_length);
|
||||
|
||||
#endif /* VBOOT_REFERENCE_TLCL_STUB_H_ */
|
||||
@@ -6,8 +6,8 @@
|
||||
* the firmware
|
||||
*/
|
||||
|
||||
#ifndef TPM_LITE_TSS_CONSTANTS_H_
|
||||
#define TPM_LITE_TSS_CONSTANTS_H_
|
||||
#ifndef VBOOT_REFERENCE_TSS_CONSTANTS_H_
|
||||
#define VBOOT_REFERENCE_TSS_CONSTANTS_H_
|
||||
|
||||
#include "sysincludes.h"
|
||||
|
||||
@@ -87,4 +87,4 @@ typedef struct tdTPM_STCLEAR_FLAGS{
|
||||
TSS_BOOL bGlobalLock;
|
||||
} TPM_STCLEAR_FLAGS;
|
||||
|
||||
#endif /* TPM_LITE_TSS_CONSTANTS_H_ */
|
||||
#endif /* VBOOT_REFERENCE_TSS_CONSTANTS_H_ */
|
||||
@@ -13,24 +13,7 @@
|
||||
|
||||
#include "sysincludes.h"
|
||||
#include "tss_constants.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Functions to be implemented by the stub library */
|
||||
|
||||
/* Initialize the stub library */
|
||||
void TlclStubInit(void);
|
||||
|
||||
/* Close and open the device. This is needed for running more complex commands
|
||||
* at user level, such as TPM_TakeOwnership, since the TPM device can be opened
|
||||
* only by one process at a time.
|
||||
*/
|
||||
void TlclCloseDevice(void);
|
||||
void TlclOpenDevice(void);
|
||||
|
||||
/* Send data to the TPM and receive a response. Returns 0 if success,
|
||||
* nonzero if error. */
|
||||
uint32_t TlclStubSendReceive(const uint8_t* request, int request_length,
|
||||
uint8_t* response, int max_length);
|
||||
#include "tlcl_stub.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Functions implemented in tlcl.c */
|
||||
|
||||
@@ -13,7 +13,7 @@ INCLUDES += \
|
||||
-I$(FWDIR)/lib/cryptolib/include
|
||||
|
||||
# find ./lib -iname '*.c' | sort
|
||||
ALL_SRCS = \
|
||||
LIB_SRCS = \
|
||||
./lib/file_keys.c \
|
||||
./lib/host_common.c \
|
||||
./lib/host_key.c \
|
||||
@@ -22,12 +22,22 @@ ALL_SRCS = \
|
||||
./lib/host_signature.c \
|
||||
./lib/signature_digest.c
|
||||
|
||||
STUB_SRCS = \
|
||||
../firmware/stub/boot_device_stub.c \
|
||||
../firmware/stub/load_firmware_stub.c \
|
||||
../firmware/stub/tpm_lite_stub.c \
|
||||
../firmware/stub/utility_stub.c
|
||||
|
||||
ALL_SRCS = ${LIB_SRCS} ${STUB_SRCS}
|
||||
|
||||
test : $(HOSTLIB)
|
||||
$(CC) $(CFLAGS) $(INCLUDES) -o $(BUILD_ROOT)/a.out $(TESTDIR)/main.c \
|
||||
$(HOSTLIB) $(FWLIB) -lcrypto
|
||||
$(HOSTLIB) -lcrypto
|
||||
|
||||
include ../common.mk
|
||||
|
||||
$(HOSTLIB) : $(ALL_OBJS)
|
||||
rm -f $@
|
||||
ar qc $@ $^
|
||||
$(HOSTLIB) : $(ALL_OBJS) $(FWLIB)
|
||||
rm -rf $@ $(BUILD_ROOT)/.tmp
|
||||
mkdir -p $(BUILD_ROOT)/.tmp
|
||||
cd $(BUILD_ROOT)/.tmp ; ar x $(FWLIB)
|
||||
ar qc $@ $^ $(BUILD_ROOT)/.tmp/*.o
|
||||
|
||||
@@ -27,7 +27,7 @@ TEST_LIB_OBJS = $(TEST_LIB_SRCS:%.c=${BUILD_ROOT}/%.o)
|
||||
ALL_DEPS = $(addsuffix .d,${TEST_BINS} ${TEST_LIB_OBJS})
|
||||
CFLAGS += -MMD -MF $@.d
|
||||
|
||||
LIBS := ${TEST_LIB} $(HOSTLIB) $(FWLIB)
|
||||
LIBS := ${TEST_LIB} $(HOSTLIB)
|
||||
|
||||
ifneq (${RUNTESTS},)
|
||||
EXTRA_TARGET = runtests
|
||||
@@ -44,9 +44,9 @@ ${TEST_LIB}: ${TEST_LIB_OBJS}
|
||||
${BUILD_ROOT}/rollback_index_test.o : rollback_index_test.c
|
||||
$(CC) $(CFLAGS) -I/usr/include $(INCLUDES) -MMD -MF $@.d -c -o $@ $<
|
||||
|
||||
${BUILD_ROOT}/rollback_index_test: rollback_index_test.c ${HOSTLIB} ${FWLIB}
|
||||
${BUILD_ROOT}/rollback_index_test: rollback_index_test.c ${HOSTLIB}
|
||||
$(CC) $(CFLAGS) -I/usr/include $(INCLUDES) $< -o $@ \
|
||||
-ltlcl ${HOSTLIB} ${FWLIB} -lcrypto -lrt
|
||||
-ltlcl ${HOSTLIB} -lcrypto -lrt
|
||||
|
||||
${BUILD_ROOT}/%.o : %.c
|
||||
$(CC) $(CFLAGS) $(INCLUDES) -MMD -MF $@.d -c -o $@ $<
|
||||
|
||||
@@ -31,7 +31,7 @@ SHARED_TEST_OBJ = $(BUILD_ROOT)/tlcl_tests.o
|
||||
ALL_DEPS = $(addsuffix .d,${TEST_BINS})
|
||||
CFLAGS += -MMD -MF $@.d
|
||||
|
||||
LIBS := ${TEST_LIB} $(HOSTLIB) $(FWLIB)
|
||||
LIBS := ${TEST_LIB} $(HOSTLIB)
|
||||
|
||||
all: $(TEST_BINS)
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ INCLUDES += -I./include \
|
||||
-I$(HOSTDIR)/include
|
||||
CFLAGS += $(INCLUDES)
|
||||
CFLAGS += -MMD -MF $@.d
|
||||
LIBS = $(HOSTLIB) $(FWLIB)
|
||||
LIBS = $(HOSTLIB)
|
||||
HOSTCC = cc
|
||||
|
||||
BUILD_ROOT = ${BUILD}/utility
|
||||
|
||||
Reference in New Issue
Block a user