blob: 80a0da92a8af51737d60dc829f681cb747e9d3a9 [file] [log] [blame]
Stefan Reinauer9aea04a2012-03-30 12:01:06 -07001##
2## This file is part of the coreboot project.
3##
4## Copyright (C) 2011 The ChromiumOS Authors. All rights reserved.
5##
6## This program is free software; you can redistribute it and/or modify
7## it under the terms of the GNU General Public License as published by
8## the Free Software Foundation; version 2 of the License.
9##
10## This program is distributed in the hope that it will be useful,
11## but WITHOUT ANY WARRANTY; without even the implied warranty of
12## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13## GNU General Public License for more details.
14##
15## You should have received a copy of the GNU General Public License
16## along with this program; if not, write to the Free Software
17## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18##
19
20romstage-y += chromeos.c
21ramstage-y += chromeos.c
Furquan Shaikh99ac98f2014-04-23 10:18:48 -070022romstage-$(CONFIG_ARCH_ROMSTAGE_X86_32) += vbnv.c
23ramstage-$(CONFIG_ARCH_RAMSTAGE_X86_32) += vbnv.c
24romstage-$(CONFIG_ARCH_ROMSTAGE_X86_32) += vboot.c
Stefan Reinauer9aea04a2012-03-30 12:01:06 -070025ramstage-y += gnvs.c
Stefan Reinauer357bb2d2012-08-09 13:44:38 -070026romstage-y += fmap.c
27ramstage-y += fmap.c
Aaron Durbin06ece7d2014-02-14 00:30:04 -060028ramstage-$(CONFIG_CHROMEOS_RAMOOPS) += ramoops.c
Duncan Laurie86bf3f52012-08-15 13:14:58 -070029smm-y += fmap.c
Aaron Durbinfd795622013-03-01 17:12:26 -060030
Aaron Durbin0703ec42013-03-27 00:16:11 -050031ifeq ($(MOCK_TPM),1)
Furquan Shaikh99ac98f2014-04-23 10:18:48 -070032CFLAGS_common += -DMOCK_TPM=1
Aaron Durbin0703ec42013-03-27 00:16:11 -050033else
Furquan Shaikh99ac98f2014-04-23 10:18:48 -070034CFLAGS_common += -DMOCK_TPM=0
Aaron Durbin0703ec42013-03-27 00:16:11 -050035endif
36
Aaron Durbinfd795622013-03-01 17:12:26 -060037ifeq ($(CONFIG_VBOOT_VERIFY_FIRMWARE),y)
38romstage-y += vboot_loader.c
39rmodules-y += vboot_wrapper.c
40
41VB_LIB = $(obj)/external/vboot_reference/vboot_fw.a
Furquan Shaikh99ac98f2014-04-23 10:18:48 -070042# Currently, vboot comes into picture only during the romstage, thus
43# is compiled for being used in romstage only. Since, we are splitting
44# up all components in one of the three stages of coreboot, vboot seems
45# most logical to fall under the romstage. Thus, all references to arch
46# and other compiler stuff for vboot is using the romstage arch.
47VB_FIRMWARE_ARCH := $(ARCHDIR-$(ARCH-ROMSTAGE-y))
Aaron Durbinfd795622013-03-01 17:12:26 -060048VB_SOURCE := vboot_reference
49
50# Add the vboot include paths.
Patrick Georgi58f73a62014-05-17 14:00:12 +020051CPPFLAGS_common += -I$(VB_SOURCE)/firmware/include
Aaron Durbinfd795622013-03-01 17:12:26 -060052
53VBOOT_STUB_ELF = $(obj)/vendorcode/google/chromeos/vbootstub.elf
Aaron Durbin3eb8eb72014-03-10 16:13:58 -050054VBOOT_STUB = $(VBOOT_STUB_ELF).rmod
Aaron Durbinfd795622013-03-01 17:12:26 -060055VBOOT_STUB_DOTO = $(VBOOT_STUB_ELF:.elf=.o)
56
57# Dependency for the vboot rmodules. Ordering matters.
58VBOOT_STUB_DEPS += $(obj)/vendorcode/google/chromeos/vboot_wrapper.rmodules.o
59VBOOT_STUB_DEPS += $(obj)/lib/memcmp.rmodules.o
60VBOOT_STUB_DEPS += $(obj)/arch/x86/lib/memset.rmodules.o
61VBOOT_STUB_DEPS += $(obj)/arch/x86/lib/memcpy.rmodules.o
62VBOOT_STUB_DEPS += $(VB_LIB)
Aaron Durbin54553d92013-03-19 12:43:18 -050063# Remove the '-include' option since that will break vboot's build and ensure
64# vboot_reference can get to coreboot's include files.
Furquan Shaikh99ac98f2014-04-23 10:18:48 -070065VBOOT_CFLAGS += $(patsubst -I%,-I../%,$(filter-out -include $(src)/include/kconfig.h, $(CFLAGS_romstage)))
Aaron Durbinfd795622013-03-01 17:12:26 -060066VBOOT_CFLAGS += -DVBOOT_DEBUG
67
68$(VBOOT_STUB_DOTO): $(VBOOT_STUB_DEPS)
Furquan Shaikh99ac98f2014-04-23 10:18:48 -070069 $(CC_romstage) $(LDFLAGS) -nostdlib -r -o $@ $^
Aaron Durbinfd795622013-03-01 17:12:26 -060070
71# Link the vbootstub module with a 64KiB-byte heap.
72$(eval $(call rmodule_link,$(VBOOT_STUB_ELF), $(VBOOT_STUB_DOTO), 0x10000))
73
74# Build vboot library without the default includes from coreboot proper.
75$(VB_LIB):
76 @printf " MAKE $(subst $(obj)/,,$(@))\n"
77 $(Q)FIRMWARE_ARCH=$(VB_FIRMWARE_ARCH) \
Furquan Shaikh99ac98f2014-04-23 10:18:48 -070078 CC="$(CC_romstage)" \
Aaron Durbinfd795622013-03-01 17:12:26 -060079 CFLAGS="$(VBOOT_CFLAGS)" \
80 make -C $(VB_SOURCE) \
81 BUILD=../$(dir $(VB_LIB)) \
82 V=$(V) \
83 fwlib
84
85endif