blob: c03d639b26b7a392b631c71341dc054f3e60bfbc [file] [log] [blame]
Daisuke Nojiri742fc8d2014-10-10 10:51:06 -07001##
2## This file is part of the coreboot project.
3##
4## Copyright (C) 2014 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##
Daisuke Nojiri742fc8d2014-10-10 10:51:06 -070015
Furquan Shaikh0325dc62016-07-25 13:02:36 -070016bootblock-y += bootmode.c
17romstage-y += bootmode.c
18ramstage-y += bootmode.c
19verstage-y += bootmode.c
20postcar-y += bootmode.c
21
22ifeq ($(CONFIG_VBOOT),y)
23
Patrick Georgi27ef6022015-04-30 14:25:14 +020024libverstage-generic-ccopts += -D__PRE_RAM__ -D__VERSTAGE__
Aaron Durbin26681ec2015-05-01 16:48:54 -050025verstage-generic-ccopts += -D__PRE_RAM__ -D__VERSTAGE__
Daisuke Nojiri742fc8d2014-10-10 10:51:06 -070026
Furquan Shaikh2a12e2e2016-07-25 11:48:03 -070027bootblock-y += vbnv.c
28verstage-y += vbnv.c
29romstage-y += vbnv.c
30ramstage-y += vbnv.c
31
32bootblock-$(CONFIG_VBOOT_VBNV_CMOS) += vbnv_cmos.c
33verstage-$(CONFIG_VBOOT_VBNV_CMOS) += vbnv_cmos.c
34romstage-$(CONFIG_VBOOT_VBNV_CMOS) += vbnv_cmos.c
35ramstage-$(CONFIG_VBOOT_VBNV_CMOS) += vbnv_cmos.c
36
37bootblock-$(CONFIG_VBOOT_VBNV_CMOS_BACKUP_TO_FLASH) += vbnv_flash.c
38verstage-$(CONFIG_VBOOT_VBNV_CMOS_BACKUP_TO_FLASH) += vbnv_flash.c
39romstage-$(CONFIG_VBOOT_VBNV_CMOS_BACKUP_TO_FLASH) += vbnv_flash.c
40ramstage-$(CONFIG_VBOOT_VBNV_CMOS_BACKUP_TO_FLASH) += vbnv_flash.c
41
42bootblock-$(CONFIG_VBOOT_VBNV_EC) += vbnv_ec.c
43verstage-$(CONFIG_VBOOT_VBNV_EC) += vbnv_ec.c
44romstage-$(CONFIG_VBOOT_VBNV_EC) += vbnv_ec.c
45ramstage-$(CONFIG_VBOOT_VBNV_EC) += vbnv_ec.c
46
47bootblock-$(CONFIG_VBOOT_VBNV_FLASH) += vbnv_flash.c
48verstage-$(CONFIG_VBOOT_VBNV_FLASH) += vbnv_flash.c
49romstage-$(CONFIG_VBOOT_VBNV_FLASH) += vbnv_flash.c
50ramstage-$(CONFIG_VBOOT_VBNV_FLASH) += vbnv_flash.c
51
Aaron Durbin17200ad2015-05-01 16:48:54 -050052bootblock-y += vboot_loader.c
53romstage-y += vboot_loader.c
54ramstage-y += vboot_loader.c
55verstage-y += vboot_loader.c
Andrey Petrov60c64322016-04-14 14:12:47 -070056postcar-y += vboot_loader.c
Aaron Durbin17200ad2015-05-01 16:48:54 -050057
Furquan Shaikh2a12e2e2016-07-25 11:48:03 -070058bootblock-y += vboot_common.c
59verstage-y += vboot_common.c
60romstage-y += vboot_common.c
61ramstage-y += vboot_common.c
62postcar-y += vboot_common.c
Daisuke Nojiri742fc8d2014-10-10 10:51:06 -070063
Daisuke Nojiri54af6252014-11-04 12:32:29 -080064bootblock-y += common.c
Aaron Durbin588ad7b2015-09-29 17:56:59 -050065libverstage-y += vboot_logic.c
Daisuke Nojiri5d302c72015-04-09 08:18:22 -070066verstage-y += common.c
Aaron Durbin588ad7b2015-09-29 17:56:59 -050067verstage-y += verstage.c
Furquan Shaikh2a12e2e2016-07-25 11:48:03 -070068ifeq (${CONFIG_VBOOT_MOCK_SECDATA},y)
Patrick Georgi27ef6022015-04-30 14:25:14 +020069libverstage-y += secdata_mock.c
Furquan Shaikhfb814742016-11-07 23:33:46 -080070romstage-$(CONFIG_SEPARATE_VERSTAGE) += secdata_mock.c
Daisuke Nojiri5d302c72015-04-09 08:18:22 -070071else
Furquan Shaikh2a12e2e2016-07-25 11:48:03 -070072libverstage-y += secdata_tpm.c
Furquan Shaikhfb814742016-11-07 23:33:46 -080073romstage-$(CONFIG_SEPARATE_VERSTAGE) += secdata_tpm.c
Daisuke Nojiri5d302c72015-04-09 08:18:22 -070074endif
Daisuke Nojiri742fc8d2014-10-10 10:51:06 -070075romstage-y += vboot_handoff.c common.c
76
Aaron Durbin17200ad2015-05-01 16:48:54 -050077ramstage-y += common.c
Andrey Petrov60c64322016-04-14 14:12:47 -070078postcar-y += common.c
Aaron Durbin17200ad2015-05-01 16:48:54 -050079
Aaron Durbind1cf44c2015-05-08 15:58:06 -050080ifeq ($(CONFIG_SEPARATE_VERSTAGE),y)
81VB_FIRMWARE_ARCH := $(ARCHDIR-$(ARCH-verstage-y))
82else
83ifeq ($(CONFIG_VBOOT_STARTS_IN_BOOTBLOCK),y)
84VB_FIRMWARE_ARCH := $(ARCHDIR-$(ARCH-bootblock-y))
85else
86VB_FIRMWARE_ARCH := $(ARCHDIR-$(ARCH-romstage-y))
87endif
88endif # CONFIG_SEPARATE_VERSTAGE
89
Bill Richardsonc8603152015-01-27 17:28:18 -080090VB2_LIB = $(obj)/external/vboot_reference/vboot_fw20.a
Paul Kocialkowski6a106942015-08-03 23:03:27 +020091VBOOT_CFLAGS += $(patsubst -I%,-I$(top)/%, $(filter-out -I$(obj), $(filter-out -include $(src)/include/kconfig.h, $(CPPFLAGS_libverstage))))
Patrick Georgi375570e2015-05-11 19:25:21 +020092VBOOT_CFLAGS += $(CFLAGS_libverstage)
Patrick Georgi27ef6022015-04-30 14:25:14 +020093VBOOT_CFLAGS += $(libverstage-c-ccopts)
Paul Kocialkowski6a106942015-08-03 23:03:27 +020094VBOOT_CFLAGS += -I$(abspath $(obj)) -include $(top)/src/include/kconfig.h -Wno-missing-prototypes
Daisuke Nojiri742fc8d2014-10-10 10:51:06 -070095VBOOT_CFLAGS += -DVBOOT_DEBUG
96
97$(VB2_LIB): $(obj)/config.h
98 @printf " MAKE $(subst $(obj)/,,$(@))\n"
99 $(Q)FIRMWARE_ARCH=$(VB_FIRMWARE_ARCH) \
100 CC="$(CC_verstage)" \
101 CFLAGS="$(VBOOT_CFLAGS)" VBOOT2="y" \
Paul Kocialkowski46114512016-07-24 12:10:38 +0200102 $(MAKE) -C $(VBOOT_SOURCE) \
Paul Kocialkowski6a106942015-08-03 23:03:27 +0200103 BUILD=$(abspath $(dir $(VB2_LIB))) \
Daisuke Nojiri742fc8d2014-10-10 10:51:06 -0700104 V=$(V) \
Bill Richardsonc8603152015-01-27 17:28:18 -0800105 fwlib20
Daisuke Nojiri742fc8d2014-10-10 10:51:06 -0700106
Patrick Georgi27ef6022015-04-30 14:25:14 +0200107libverstage-srcs += $(VB2_LIB)
Patrick Georgiba808872015-04-27 18:09:22 +0200108
Patrick Georgiefc6aa02015-04-27 18:13:50 +0200109ifeq ($(CONFIG_SEPARATE_VERSTAGE),y)
Furquan Shaikhb038f412016-11-07 23:47:11 -0800110
111# This works under the assumption that romstage and verstage use the same
112# architecture and thus CC_verstage is the same as CC_romstage. If this is not
113# true, VB2_LIB needs to ensure that correct CC is being used.
114ifeq ($(CONFIG_VBOOT_HAS_REC_HASH_SPACE),y)
115romstage-srcs += $(VB2_LIB)
116endif
117
Patrick Georgi1cab0122015-11-26 16:39:23 +0100118cbfs-files-$(CONFIG_SEPARATE_VERSTAGE) += $(CONFIG_CBFS_PREFIX)/verstage
119$(CONFIG_CBFS_PREFIX)/verstage-file := $(objcbfs)/verstage.elf
120$(CONFIG_CBFS_PREFIX)/verstage-type := stage
Julius Werner09f29212015-09-29 13:51:35 -0700121$(CONFIG_CBFS_PREFIX)/verstage-compression := $(CBFS_PRERAM_COMPRESS_FLAG)
Furquan Shaikh94b18a12016-05-04 23:25:16 -0700122
Patrick Georgi1cab0122015-11-26 16:39:23 +0100123ifeq ($(CONFIG_ARCH_VERSTAGE_X86_32)$(CONFIG_ARCH_VERSTAGE_X86_64),y)
Furquan Shaikh94b18a12016-05-04 23:25:16 -0700124$(CONFIG_CBFS_PREFIX)/verstage-options := -a 64 -S ".car.data"
125
126# If CAR does not support execution of code, verstage on x86 is expected to be
127# xip.
128ifneq ($(CONFIG_NO_XIP_EARLY_STAGES),y)
129$(CONFIG_CBFS_PREFIX)/verstage-options += --xip
130endif
Patrick Georgi1cab0122015-11-26 16:39:23 +0100131
132endif
133
Patrick Georgiefc6aa02015-04-27 18:13:50 +0200134else
Aaron Durbind1cf44c2015-05-08 15:58:06 -0500135ifeq ($(CONFIG_VBOOT_STARTS_IN_BOOTBLOCK),y)
Patrick Georgiefc6aa02015-04-27 18:13:50 +0200136bootblock-srcs += $(objgenerated)/libverstage.a
Aaron Durbin57e37282015-04-28 16:17:25 -0500137else
138romstage-srcs += $(objgenerated)/libverstage.a
Patrick Georgiefc6aa02015-04-27 18:13:50 +0200139endif
Aaron Durbin57e37282015-04-28 16:17:25 -0500140endif # CONFIG_SEPARATE_VERSTAGE
Patrick Georgic8d4abd2016-01-20 15:54:31 +0100141
142# Define a list of files that need to be in RO only.
143# All other files will be installed into RO and RW regions
144# Use $(sort) to cut down on extra spaces that would be translated to commas
145regions-for-file = $(subst $(spc),$(comma),$(sort \
146 $(if $(filter \
147 $(if $(filter y,$(CONFIG_VBOOT_STARTS_IN_BOOTBLOCK)),, \
148 %/romstage) \
149 mts \
150 %/verstage \
Patrick Georgieda794d2016-02-05 11:01:24 +0100151 locales \
152 locale_%.bin \
153 font.bin \
154 vbgfx.bin \
Lee Leahy5e347522017-01-04 08:51:52 -0800155 rmu.bin \
Patrick Georgic8d4abd2016-01-20 15:54:31 +0100156 ,$(1)),COREBOOT,COREBOOT FW_MAIN_A FW_MAIN_B)))
Furquan Shaikh0325dc62016-07-25 13:02:36 -0700157
158endif # CONFIG_VBOOT