blob: b583e6dc284a33b7b47da07bbe9fc10ef0f354a6 [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
Aaron Durbinb3847e62015-03-20 15:55:08 -050021bootblock-y += prog_ops.c
Edward O'Callaghancdabc882014-11-11 12:22:04 +110022bootblock-y += cbfs.c cbfs_core.c
Vadim Bendeburyadcb0952014-05-01 12:23:09 -070023bootblock-$(CONFIG_COMMON_CBFS_SPI_WRAPPER) += cbfs_spi.c
David Hendricks6fab3652014-11-06 15:22:10 -080024bootblock-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c
Vadim Bendeburyadcb0952014-05-01 12:23:09 -070025
Aaron Durbine5e36302014-09-25 10:05:15 -050026bootblock-$(CONFIG_GENERIC_UDELAY) += timer.c
27
Patrick Georgi8b174042015-04-27 18:03:50 +020028bootblock-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
Kyösti Mälkki8659e402014-12-21 08:55:47 +020029bootblock-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
Hung-Te Linfe187922013-02-01 01:09:24 +080030bootblock-y += memchr.c
Hung-Te Linfe187922013-02-01 01:09:24 +080031bootblock-y += memcmp.c
Aaron Durbin127525c2015-03-26 12:29:12 -050032bootblock-y += mem_pool.c
Aaron Durbin5d5f4b32015-03-26 14:39:07 -050033bootblock-y += region.c
Hung-Te Linfe187922013-02-01 01:09:24 +080034
Aaron Durbinb3847e62015-03-20 15:55:08 -050035verstage-y += prog_ops.c
Daisuke Nojiribcc1d422014-06-19 19:16:24 -070036verstage-y += delay.c
37verstage-y += cbfs.c
Aaron Durbinae1fcc32015-05-01 16:48:54 -050038verstage-y += cbfs_core.c
Aaron Durbin17200ad2015-05-01 16:48:54 -050039verstage-y += halt.c
Daisuke Nojiribcc1d422014-06-19 19:16:24 -070040verstage-y += memcmp.c
Patrick Georgi8b174042015-04-27 18:03:50 +020041verstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
Aaron Durbin5d5f4b32015-03-26 14:39:07 -050042verstage-y += region.c
Daisuke Nojiribcc1d422014-06-19 19:16:24 -070043verstage-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
Vadim Bendebury3486d1f2014-10-16 11:24:12 -070044verstage-$(CONFIG_COMMON_CBFS_SPI_WRAPPER) += cbfs_spi.c
Yen Lin5bdbd002015-04-08 16:55:17 -070045
46ifeq ($(MOCK_TPM),1)
Patrick Georgi27ef6022015-04-30 14:25:14 +020047libverstage-y += mocked_tlcl.c
Yen Lin5bdbd002015-04-08 16:55:17 -070048else
Patrick Georgi27ef6022015-04-30 14:25:14 +020049libverstage-y += tlcl.c
Yen Lin5bdbd002015-04-08 16:55:17 -070050endif
51
Vadim Bendebury3486d1f2014-10-16 11:24:12 -070052verstage-$(CONFIG_GENERIC_UDELAY) += timer.c
David Hendricks6fab3652014-11-06 15:22:10 -080053verstage-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c
Aaron Durbin127525c2015-03-26 12:29:12 -050054verstage-y += mem_pool.c
Daisuke Nojiribcc1d422014-06-19 19:16:24 -070055
Aaron Durbinb3847e62015-03-20 15:55:08 -050056romstage-y += prog_ops.c
Gabe Black1025f3a2011-09-16 02:18:56 -070057romstage-y += memchr.c
Stefan Reinauer24ef1342011-04-14 22:28:00 +000058romstage-y += memcmp.c
Furquan Shaikh133096b2014-07-31 09:28:55 -070059$(foreach arch,$(ARCH_SUPPORTED),\
Julius Wernerec5e5e02014-08-20 15:29:56 -070060 $(eval rmodules_$(arch)-y += memcmp.c) \
61 $(eval rmodules_$(arch)-y += rmodule.ld))
Furquan Shaikh133096b2014-07-31 09:28:55 -070062
Stefan Reinauer3905e3d2013-08-29 16:01:05 -070063romstage-$(CONFIG_I2C_TPM) += delay.c
Edward O'Callaghancdabc882014-11-11 12:22:04 +110064romstage-y += cbfs.c cbfs_core.c
Vadim Bendeburyadcb0952014-05-01 12:23:09 -070065romstage-$(CONFIG_COMMON_CBFS_SPI_WRAPPER) += cbfs_spi.c
Edward O'Callaghancd31afd2014-11-11 12:27:06 +110066romstage-$(CONFIG_COMPRESS_RAMSTAGE) += lzma.c lzmadecode.c
David Hendricks560c6432014-02-13 13:07:50 -080067romstage-$(CONFIG_PRIMITIVE_MEMTEST) += primitive_memtest.c
68ramstage-$(CONFIG_PRIMITIVE_MEMTEST) += primitive_memtest.c
Stefan Reinauer24ef1342011-04-14 22:28:00 +000069romstage-$(CONFIG_CACHE_AS_RAM) += ramtest.c
David Hendricks6fab3652014-11-06 15:22:10 -080070romstage-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c
Vladimir Serbinenko45988da2013-03-30 02:02:13 +010071
Kyösti Mälkkif8bf5a12013-10-11 22:08:02 +030072ifeq ($(CONFIG_EARLY_CBMEM_INIT),y)
Aaron Durbinc15551a2013-03-23 00:00:54 -050073romstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
Kyösti Mälkkia2f6af32013-09-10 13:50:32 +030074romstage-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
Kyösti Mälkkia2f6af32013-09-10 13:50:32 +030075endif
Denis 'GNUtoo' Carikli8a0a8482013-06-20 16:24:14 +020076
Stefan Reinauerfb89dd02012-03-30 16:28:20 -070077romstage-y += compute_ip_checksum.c
Patrick Georgi6d0cba72014-11-29 11:32:12 +010078ifeq ($(CONFIG_COMPILER_GCC),y)
Furquan Shaikh99ac98f2014-04-23 10:18:48 -070079romstage-$(CONFIG_ARCH_ROMSTAGE_X86_32) += gcc.c
Edward O'Callaghan4ba8ba42014-05-23 01:29:00 +100080ramstage-$(CONFIG_ARCH_RAMSTAGE_X86_32) += gcc.c
81endif
Stefan Reinauer24ef1342011-04-14 22:28:00 +000082
Aaron Durbine5e36302014-09-25 10:05:15 -050083romstage-$(CONFIG_GENERIC_UDELAY) += timer.c
84
Aaron Durbinb3847e62015-03-20 15:55:08 -050085ramstage-y += prog_ops.c
Stefan Reinauer1e753292012-11-30 12:23:45 -080086ramstage-y += hardwaremain.c
87ramstage-y += selfboot.c
Stefan Reinauer3e4e3032013-03-20 14:08:04 -070088ramstage-y += coreboot_table.c
Aaron Durbin49048022014-02-18 21:55:02 -060089ramstage-y += bootmem.c
Gabe Black1025f3a2011-09-16 02:18:56 -070090ramstage-y += memchr.c
Patrick Georgi8463dd92010-09-30 16:55:02 +000091ramstage-y += memcmp.c
Patrick Georgi8463dd92010-09-30 16:55:02 +000092ramstage-y += malloc.c
Duncan Laurief5e9ac42012-06-23 13:33:32 -070093smm-$(CONFIG_SMM_TSEG) += malloc.c
Patrick Georgi8463dd92010-09-30 16:55:02 +000094ramstage-y += delay.c
95ramstage-y += fallback_boot.c
96ramstage-y += compute_ip_checksum.c
Edward O'Callaghancdabc882014-11-11 12:22:04 +110097ramstage-y += cbfs.c cbfs_core.c
Vadim Bendeburyadcb0952014-05-01 12:23:09 -070098ramstage-$(CONFIG_COMMON_CBFS_SPI_WRAPPER) += cbfs_spi.c
Edward O'Callaghancd31afd2014-11-11 12:27:06 +110099ramstage-y += lzma.c lzmadecode.c
Ronald G. Minnich9764d4c2012-06-12 16:29:32 -0700100ramstage-y += stack.c
Stefan Reinauer24ef1342011-04-14 22:28:00 +0000101ramstage-y += clog2.c
Alexandru Gagniucaf4bd592014-01-12 15:42:58 -0600102romstage-y += clog2.c
Vadim Bendebury3e316002011-09-30 12:02:18 -0700103ramstage-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
Stefan Reinauer24ef1342011-04-14 22:28:00 +0000104ramstage-$(CONFIG_BOOTSPLASH) += jpeg.c
Rudolf Marek7f0e9302011-09-02 23:23:41 +0200105ramstage-$(CONFIG_TRACE) += trace.c
Vadim Bendebury6f72d692011-09-21 16:12:39 -0700106ramstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
Stefan Reinauerd37ab452012-12-18 16:23:28 -0800107ramstage-$(CONFIG_COVERAGE) += libgcov.c
Ronald G. Minnichb3b72f32013-03-13 14:35:01 -0700108ramstage-$(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT) += edid.c
Aaron Durbina05a8522013-03-22 20:44:46 -0500109ramstage-y += memrange.c
Aaron Durbin4409a5e2013-05-06 12:20:52 -0500110ramstage-$(CONFIG_COOP_MULTITASKING) += thread.c
Aaron Durbin340ca912013-04-30 09:58:12 -0500111ramstage-$(CONFIG_TIMER_QUEUE) += timer_queue.c
David Hendricks3b11de82014-11-05 14:05:56 -0800112ramstage-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c
Aaron Durbine5e36302014-09-25 10:05:15 -0500113ramstage-$(CONFIG_GENERIC_UDELAY) += timer.c
Vadim Bendebury243c6142015-03-27 16:08:04 -0700114ramstage-y += b64_decode.c
Stefan Reinauer16ce01b2011-01-28 08:05:54 +0000115
Aaron Durbin0dff57d2015-03-05 21:18:33 -0600116romstage-y += cbmem_common.c
117romstage-y += imd_cbmem.c
118
119ramstage-y += cbmem_common.c
120ramstage-y += imd_cbmem.c
Aaron Durbindf3a1092013-03-13 12:41:44 -0500121
Aaron Durbin20686d82015-03-05 14:11:27 -0600122romstage-y += imd.c
123ramstage-y += imd.c
124
Stefan Reinauer2f38b072013-07-18 16:24:08 -0700125ramstage-y += hexdump.c
126romstage-y += hexdump.c
127
Isaac Christensen0b4e8df2014-10-01 11:50:20 -0600128romstage-$(CONFIG_REG_SCRIPT) += reg_script.c
Duncan Laurie72748002013-10-31 08:26:23 -0700129ramstage-$(CONFIG_REG_SCRIPT) += reg_script.c
130
Aaron Durbinbd74a4b2015-03-06 23:17:33 -0600131ifeq ($(CONFIG_CACHE_RELOCATED_RAMSTAGE_OUTSIDE_CBMEM),y)
132ramstage-y += ext_stage_cache.c
133romstage-y += ext_stage_cache.c
134else
135ramstage-$(CONFIG_RELOCATABLE_RAMSTAGE) += cbmem_stage_cache.c
136romstage-$(CONFIG_RELOCATABLE_RAMSTAGE) += cbmem_stage_cache.c
137endif
138
Aaron Durbin127525c2015-03-26 12:29:12 -0500139romstage-y += mem_pool.c
140ramstage-y += mem_pool.c
141
Aaron Durbin5d5f4b32015-03-26 14:39:07 -0500142romstage-y += region.c
143ramstage-y += region.c
Aaron Durbin75e29742013-10-10 20:37:04 -0500144
Edward O'Callaghancdabc882014-11-11 12:22:04 +1100145smm-y += cbfs.c cbfs_core.c memcmp.c
Edward O'Callaghan9b229852014-06-26 18:12:11 +1000146smm-$(CONFIG_COMPILER_GCC) += gcc.c
Stefan Reinauere9f32582010-03-29 13:04:13 +0000147
Kyösti Mälkkic36af7b2014-11-18 12:41:16 +0200148bootblock-y += version.c
149romstage-y += version.c
150ramstage-y += version.c
151smm-y += version.c
Patrick Georgi9bb90cd2015-05-07 12:30:06 +0200152secmon-y += version.c
Aaron Durbinfd6fb262015-05-13 13:37:43 -0500153verstage-y += version.c
Kyösti Mälkkic36af7b2014-11-18 12:41:16 +0200154
155$(obj)/lib/version.bootblock.o : $(obj)/build.h
156$(obj)/lib/version.romstage.o : $(obj)/build.h
Patrick Georgi8463dd92010-09-30 16:55:02 +0000157$(obj)/lib/version.ramstage.o : $(obj)/build.h
Kyösti Mälkkic36af7b2014-11-18 12:41:16 +0200158$(obj)/lib/version.smm.o : $(obj)/build.h
Aaron Durbin2591e932015-05-13 13:38:59 -0500159$(obj)/lib/version.secmon.o : $(obj)/build.h
Aaron Durbinfd6fb262015-05-13 13:37:43 -0500160$(obj)/lib/version.verstage.o : $(obj)/build.h
Stefan Reinauerba9dae22011-07-29 15:34:14 -0700161
Kyösti Mälkki5687fc92013-11-28 18:11:49 +0200162romstage-y += bootmode.c
163ramstage-y += bootmode.c
164
Patrick Georgi1b2f2a02014-11-28 22:00:22 +0100165bootblock-y += halt.c
166romstage-y += halt.c
167ramstage-y += halt.c
168smm-y += halt.c
Furquan Shaikhabde3b52014-08-26 15:39:51 -0700169secmon-y += halt.c
Patrick Georgi1b2f2a02014-11-28 22:00:22 +0100170
Julius Wernerec5e5e02014-08-20 15:29:56 -0700171ifneq ($(CONFIG_ARCH_X86),y)
172# X86 bootblock and romstage use custom ldscripts that are all glued together,
173# so we need to exclude it here or it would pick these up as well
174bootblock-y += bootblock.ld
175romstage-y += romstage.ld
176endif
177ramstage-y += ramstage.ld
178
Aaron Durbinad935522012-12-24 14:28:37 -0600179ifeq ($(CONFIG_RELOCATABLE_MODULES),y)
180ramstage-y += rmodule.c
Aaron Durbin8e4a3552013-02-08 17:28:04 -0600181romstage-$(CONFIG_RELOCATABLE_RAMSTAGE) += rmodule.c
Aaron Durbinad935522012-12-24 14:28:37 -0600182
Aaron Durbin04de9712015-04-07 15:44:52 -0500183RMODULE_LDFLAGS := -nostartfiles --gc-sections --emit-relocs -z defs -Bsymbolic
Aaron Durbinad935522012-12-24 14:28:37 -0600184
185# rmodule_link_rules is a function that should be called with:
186# (1) the object name to link
187# (2) the dependencies
188# (3) heap size of the relocatable module
Furquan Shaikh133096b2014-07-31 09:28:55 -0700189# (4) arch for which the rmodules are to be linked
Aaron Durbin3eb8eb72014-03-10 16:13:58 -0500190# It will create the necessary Make rules to create a rmodule. The resulting
191# rmdoule is named $(1).rmod
Aaron Durbinad935522012-12-24 14:28:37 -0600192define rmodule_link
Julius Wernerec5e5e02014-08-20 15:29:56 -0700193$(strip $(1)): $(strip $(2)) $$(COMPILER_RT_rmodules_$(4)) $(obj)/lib/rmodule.rmodules_$(4).ld | $$(RMODTOOL)
Patrick Georgieec8dfb2015-05-07 22:24:41 +0200194 $$(LD_rmodules_$(4)) $(RMODULE_LDFLAGS) -T $(obj)/lib/rmodule.rmodules_$(4).ld --defsym=__heap_size=$(strip $(3)) -o $$@ --whole-archive --start-group $(filter-out %.ld,$(2)) --end-group
Furquan Shaikh133096b2014-07-31 09:28:55 -0700195 $$(NM_rmodules_$(4)) -n $$@ > $$(basename $$@).map
Aaron Durbin3eb8eb72014-03-10 16:13:58 -0500196
197$(strip $(1)).rmod: $(strip $(1))
198 $$(RMODTOOL) -i $$^ -o $$@
Aaron Durbinad935522012-12-24 14:28:37 -0600199endef
200
201endif