blob: 9650fd5fd9c60d3f3d7b90c7a56a54a208032d6b [file] [log] [blame]
Stefan Reinauer179206a2012-11-30 12:19:59 -08001#
2# This file is part of the coreboot project.
3#
4# Copyright (C) 2009 coresystems GmbH
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
Paul Menzela46a7122013-02-23 18:37:27 +010017# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Stefan Reinauer179206a2012-11-30 12:19:59 -080018#
Aaron Durbin0f333072014-01-30 17:19:46 -060019subdirs-y += loaders
Stefan Reinauer24ef1342011-04-14 22:28:00 +000020
Edward O'Callaghancdabc882014-11-11 12:22:04 +110021bootblock-y += cbfs.c cbfs_core.c
Vadim Bendeburyadcb0952014-05-01 12:23:09 -070022bootblock-$(CONFIG_COMMON_CBFS_SPI_WRAPPER) += cbfs_spi.c
23
Kyösti Mälkki8659e402014-12-21 08:55:47 +020024bootblock-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
Hung-Te Linfe187922013-02-01 01:09:24 +080025bootblock-y += memchr.c
Hung-Te Linfe187922013-02-01 01:09:24 +080026bootblock-y += memcmp.c
27
Daisuke Nojiribcc1d422014-06-19 19:16:24 -070028verstage-y += delay.c
29verstage-y += cbfs.c
30verstage-y += memcmp.c
31verstage-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
32
33
Gabe Black1025f3a2011-09-16 02:18:56 -070034romstage-y += memchr.c
Stefan Reinauer24ef1342011-04-14 22:28:00 +000035romstage-y += memcmp.c
Furquan Shaikh133096b2014-07-31 09:28:55 -070036$(foreach arch,$(ARCH_SUPPORTED),\
37 $(eval rmodules_$(arch)-y += memcmp.c))
38
Stefan Reinauer3905e3d2013-08-29 16:01:05 -070039romstage-$(CONFIG_I2C_TPM) += delay.c
Edward O'Callaghancdabc882014-11-11 12:22:04 +110040romstage-y += cbfs.c cbfs_core.c
Vadim Bendeburyadcb0952014-05-01 12:23:09 -070041romstage-$(CONFIG_COMMON_CBFS_SPI_WRAPPER) += cbfs_spi.c
Edward O'Callaghancd31afd2014-11-11 12:27:06 +110042romstage-$(CONFIG_COMPRESS_RAMSTAGE) += lzma.c lzmadecode.c
David Hendricks560c6432014-02-13 13:07:50 -080043romstage-$(CONFIG_PRIMITIVE_MEMTEST) += primitive_memtest.c
44ramstage-$(CONFIG_PRIMITIVE_MEMTEST) += primitive_memtest.c
Stefan Reinauer24ef1342011-04-14 22:28:00 +000045romstage-$(CONFIG_CACHE_AS_RAM) += ramtest.c
Vladimir Serbinenko45988da2013-03-30 02:02:13 +010046
Kyösti Mälkkif8bf5a12013-10-11 22:08:02 +030047ifeq ($(CONFIG_EARLY_CBMEM_INIT),y)
Aaron Durbinc15551a2013-03-23 00:00:54 -050048romstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
Kyösti Mälkkia2f6af32013-09-10 13:50:32 +030049romstage-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
Kyösti Mälkkia2f6af32013-09-10 13:50:32 +030050endif
Denis 'GNUtoo' Carikli8a0a8482013-06-20 16:24:14 +020051
Stefan Reinauerfb89dd02012-03-30 16:28:20 -070052romstage-y += compute_ip_checksum.c
Patrick Georgi6d0cba72014-11-29 11:32:12 +010053ifeq ($(CONFIG_COMPILER_GCC),y)
Furquan Shaikh99ac98f2014-04-23 10:18:48 -070054romstage-$(CONFIG_ARCH_ROMSTAGE_X86_32) += gcc.c
Edward O'Callaghan4ba8ba42014-05-23 01:29:00 +100055ramstage-$(CONFIG_ARCH_RAMSTAGE_X86_32) += gcc.c
56endif
Stefan Reinauer24ef1342011-04-14 22:28:00 +000057
Stefan Reinauer1e753292012-11-30 12:23:45 -080058ramstage-y += hardwaremain.c
59ramstage-y += selfboot.c
Stefan Reinauer3e4e3032013-03-20 14:08:04 -070060ramstage-y += coreboot_table.c
Aaron Durbin49048022014-02-18 21:55:02 -060061ramstage-y += bootmem.c
Gabe Black1025f3a2011-09-16 02:18:56 -070062ramstage-y += memchr.c
Patrick Georgi8463dd92010-09-30 16:55:02 +000063ramstage-y += memcmp.c
Patrick Georgi8463dd92010-09-30 16:55:02 +000064ramstage-y += malloc.c
Duncan Laurief5e9ac42012-06-23 13:33:32 -070065smm-$(CONFIG_SMM_TSEG) += malloc.c
Patrick Georgi8463dd92010-09-30 16:55:02 +000066ramstage-y += delay.c
67ramstage-y += fallback_boot.c
68ramstage-y += compute_ip_checksum.c
Edward O'Callaghancdabc882014-11-11 12:22:04 +110069ramstage-y += cbfs.c cbfs_core.c
Vadim Bendeburyadcb0952014-05-01 12:23:09 -070070ramstage-$(CONFIG_COMMON_CBFS_SPI_WRAPPER) += cbfs_spi.c
Edward O'Callaghancd31afd2014-11-11 12:27:06 +110071ramstage-y += lzma.c lzmadecode.c
Ronald G. Minnich9764d4c2012-06-12 16:29:32 -070072ramstage-y += stack.c
Stefan Reinauer24ef1342011-04-14 22:28:00 +000073ramstage-y += clog2.c
Alexandru Gagniucaf4bd592014-01-12 15:42:58 -060074romstage-y += clog2.c
Vadim Bendebury3e316002011-09-30 12:02:18 -070075ramstage-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
Stefan Reinauer24ef1342011-04-14 22:28:00 +000076ramstage-$(CONFIG_BOOTSPLASH) += jpeg.c
Rudolf Marek7f0e9302011-09-02 23:23:41 +020077ramstage-$(CONFIG_TRACE) += trace.c
Vadim Bendebury6f72d692011-09-21 16:12:39 -070078ramstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
Stefan Reinauerd37ab452012-12-18 16:23:28 -080079ramstage-$(CONFIG_COVERAGE) += libgcov.c
Ronald G. Minnichb3b72f32013-03-13 14:35:01 -070080ramstage-$(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT) += edid.c
Aaron Durbina05a8522013-03-22 20:44:46 -050081ramstage-y += memrange.c
Aaron Durbin4409a5e2013-05-06 12:20:52 -050082ramstage-$(CONFIG_COOP_MULTITASKING) += thread.c
Aaron Durbin340ca912013-04-30 09:58:12 -050083ramstage-$(CONFIG_TIMER_QUEUE) += timer_queue.c
Stefan Reinauer16ce01b2011-01-28 08:05:54 +000084
Kyösti Mälkkiae98e832014-11-28 11:24:19 +020085romstage-y += cbmem_common.c dynamic_cbmem.c
86ramstage-y += cbmem_common.c dynamic_cbmem.c
Aaron Durbindf3a1092013-03-13 12:41:44 -050087
Stefan Reinauer2f38b072013-07-18 16:24:08 -070088ramstage-y += hexdump.c
89romstage-y += hexdump.c
90
Isaac Christensen0b4e8df2014-10-01 11:50:20 -060091romstage-$(CONFIG_REG_SCRIPT) += reg_script.c
Duncan Laurie72748002013-10-31 08:26:23 -070092ramstage-$(CONFIG_REG_SCRIPT) += reg_script.c
93
Kyösti Mälkkic7c02672014-12-26 13:28:35 +020094romstage-$(CONFIG_RELOCATABLE_RAMSTAGE) += ramstage_cache.c
Aaron Durbin75e29742013-10-10 20:37:04 -050095
Edward O'Callaghancdabc882014-11-11 12:22:04 +110096smm-y += cbfs.c cbfs_core.c memcmp.c
Edward O'Callaghan9b229852014-06-26 18:12:11 +100097smm-$(CONFIG_COMPILER_GCC) += gcc.c
Stefan Reinauere9f32582010-03-29 13:04:13 +000098
Kyösti Mälkkic36af7b2014-11-18 12:41:16 +020099bootblock-y += version.c
100romstage-y += version.c
101ramstage-y += version.c
102smm-y += version.c
103
104$(obj)/lib/version.bootblock.o : $(obj)/build.h
105$(obj)/lib/version.romstage.o : $(obj)/build.h
Patrick Georgi8463dd92010-09-30 16:55:02 +0000106$(obj)/lib/version.ramstage.o : $(obj)/build.h
Kyösti Mälkkic36af7b2014-11-18 12:41:16 +0200107$(obj)/lib/version.smm.o : $(obj)/build.h
Stefan Reinauerba9dae22011-07-29 15:34:14 -0700108
Kyösti Mälkki5687fc92013-11-28 18:11:49 +0200109romstage-y += bootmode.c
110ramstage-y += bootmode.c
111
Patrick Georgi1b2f2a02014-11-28 22:00:22 +0100112bootblock-y += halt.c
113romstage-y += halt.c
114ramstage-y += halt.c
115smm-y += halt.c
116
Aaron Durbinad935522012-12-24 14:28:37 -0600117ifeq ($(CONFIG_RELOCATABLE_MODULES),y)
118ramstage-y += rmodule.c
Aaron Durbin8e4a3552013-02-08 17:28:04 -0600119romstage-$(CONFIG_RELOCATABLE_RAMSTAGE) += rmodule.c
Aaron Durbinad935522012-12-24 14:28:37 -0600120
121RMODULE_LDSCRIPT := $(src)/lib/rmodule.ld
Patrick Georgi95948932014-11-22 17:55:46 +0100122RMODULE_LDFLAGS := -nostartfiles --emit-relocs -z defs -Bsymbolic -T$(RMODULE_LDSCRIPT)
Aaron Durbinad935522012-12-24 14:28:37 -0600123
124# rmodule_link_rules is a function that should be called with:
125# (1) the object name to link
126# (2) the dependencies
127# (3) heap size of the relocatable module
Furquan Shaikh133096b2014-07-31 09:28:55 -0700128# (4) arch for which the rmodules are to be linked
Aaron Durbin3eb8eb72014-03-10 16:13:58 -0500129# It will create the necessary Make rules to create a rmodule. The resulting
130# rmdoule is named $(1).rmod
Aaron Durbinad935522012-12-24 14:28:37 -0600131define rmodule_link
Aaron Durbin3eb8eb72014-03-10 16:13:58 -0500132$(strip $(1)): $(strip $(2)) $$(RMODULE_LDSCRIPT) $$(obj)/ldoptions $$(RMODTOOL)
Patrick Georgi95948932014-11-22 17:55:46 +0100133 $$(LD_rmodules_$(4)) $$(RMODULE_LDFLAGS) --defsym=__heap_size=$(strip $(3)) -o $$@ --start-group $(strip $(2)) $$(COMPILER_RT_rmodules_$(4)) --end-group
Furquan Shaikh133096b2014-07-31 09:28:55 -0700134 $$(NM_rmodules_$(4)) -n $$@ > $$(basename $$@).map
Aaron Durbin3eb8eb72014-03-10 16:13:58 -0500135
136$(strip $(1)).rmod: $(strip $(1))
137 $$(RMODTOOL) -i $$^ -o $$@
Aaron Durbinad935522012-12-24 14:28:37 -0600138endef
139
140endif