Stefan Reinauer | 9aea04a | 2012-03-30 12:01:06 -0700 | [diff] [blame] | 1 | ## |
| 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 | |
| 20 | romstage-y += chromeos.c |
| 21 | ramstage-y += chromeos.c |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 22 | romstage-$(CONFIG_ARCH_ROMSTAGE_X86_32) += vbnv.c |
| 23 | ramstage-$(CONFIG_ARCH_RAMSTAGE_X86_32) += vbnv.c |
| 24 | romstage-$(CONFIG_ARCH_ROMSTAGE_X86_32) += vboot.c |
Stefan Reinauer | 9aea04a | 2012-03-30 12:01:06 -0700 | [diff] [blame] | 25 | ramstage-y += gnvs.c |
Stefan Reinauer | 357bb2d | 2012-08-09 13:44:38 -0700 | [diff] [blame] | 26 | romstage-y += fmap.c |
| 27 | ramstage-y += fmap.c |
Aaron Durbin | 06ece7d | 2014-02-14 00:30:04 -0600 | [diff] [blame] | 28 | ramstage-$(CONFIG_CHROMEOS_RAMOOPS) += ramoops.c |
Duncan Laurie | 86bf3f5 | 2012-08-15 13:14:58 -0700 | [diff] [blame] | 29 | smm-y += fmap.c |
Aaron Durbin | fd79562 | 2013-03-01 17:12:26 -0600 | [diff] [blame] | 30 | |
Aaron Durbin | 0703ec4 | 2013-03-27 00:16:11 -0500 | [diff] [blame] | 31 | ifeq ($(MOCK_TPM),1) |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 32 | CFLAGS_common += -DMOCK_TPM=1 |
Aaron Durbin | 0703ec4 | 2013-03-27 00:16:11 -0500 | [diff] [blame] | 33 | else |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 34 | CFLAGS_common += -DMOCK_TPM=0 |
Aaron Durbin | 0703ec4 | 2013-03-27 00:16:11 -0500 | [diff] [blame] | 35 | endif |
| 36 | |
Aaron Durbin | fd79562 | 2013-03-01 17:12:26 -0600 | [diff] [blame] | 37 | ifeq ($(CONFIG_VBOOT_VERIFY_FIRMWARE),y) |
| 38 | romstage-y += vboot_loader.c |
| 39 | rmodules-y += vboot_wrapper.c |
| 40 | |
| 41 | VB_LIB = $(obj)/external/vboot_reference/vboot_fw.a |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 42 | # 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. |
| 47 | VB_FIRMWARE_ARCH := $(ARCHDIR-$(ARCH-ROMSTAGE-y)) |
Aaron Durbin | fd79562 | 2013-03-01 17:12:26 -0600 | [diff] [blame] | 48 | VB_SOURCE := vboot_reference |
| 49 | |
| 50 | # Add the vboot include paths. |
Patrick Georgi | 58f73a6 | 2014-05-17 14:00:12 +0200 | [diff] [blame^] | 51 | CPPFLAGS_common += -I$(VB_SOURCE)/firmware/include |
Aaron Durbin | fd79562 | 2013-03-01 17:12:26 -0600 | [diff] [blame] | 52 | |
| 53 | VBOOT_STUB_ELF = $(obj)/vendorcode/google/chromeos/vbootstub.elf |
Aaron Durbin | 3eb8eb7 | 2014-03-10 16:13:58 -0500 | [diff] [blame] | 54 | VBOOT_STUB = $(VBOOT_STUB_ELF).rmod |
Aaron Durbin | fd79562 | 2013-03-01 17:12:26 -0600 | [diff] [blame] | 55 | VBOOT_STUB_DOTO = $(VBOOT_STUB_ELF:.elf=.o) |
| 56 | |
| 57 | # Dependency for the vboot rmodules. Ordering matters. |
| 58 | VBOOT_STUB_DEPS += $(obj)/vendorcode/google/chromeos/vboot_wrapper.rmodules.o |
| 59 | VBOOT_STUB_DEPS += $(obj)/lib/memcmp.rmodules.o |
| 60 | VBOOT_STUB_DEPS += $(obj)/arch/x86/lib/memset.rmodules.o |
| 61 | VBOOT_STUB_DEPS += $(obj)/arch/x86/lib/memcpy.rmodules.o |
| 62 | VBOOT_STUB_DEPS += $(VB_LIB) |
Aaron Durbin | 54553d9 | 2013-03-19 12:43:18 -0500 | [diff] [blame] | 63 | # Remove the '-include' option since that will break vboot's build and ensure |
| 64 | # vboot_reference can get to coreboot's include files. |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 65 | VBOOT_CFLAGS += $(patsubst -I%,-I../%,$(filter-out -include $(src)/include/kconfig.h, $(CFLAGS_romstage))) |
Aaron Durbin | fd79562 | 2013-03-01 17:12:26 -0600 | [diff] [blame] | 66 | VBOOT_CFLAGS += -DVBOOT_DEBUG |
| 67 | |
| 68 | $(VBOOT_STUB_DOTO): $(VBOOT_STUB_DEPS) |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 69 | $(CC_romstage) $(LDFLAGS) -nostdlib -r -o $@ $^ |
Aaron Durbin | fd79562 | 2013-03-01 17:12:26 -0600 | [diff] [blame] | 70 | |
| 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 Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 78 | CC="$(CC_romstage)" \ |
Aaron Durbin | fd79562 | 2013-03-01 17:12:26 -0600 | [diff] [blame] | 79 | CFLAGS="$(VBOOT_CFLAGS)" \ |
| 80 | make -C $(VB_SOURCE) \ |
| 81 | BUILD=../$(dir $(VB_LIB)) \ |
| 82 | V=$(V) \ |
| 83 | fwlib |
| 84 | |
| 85 | endif |