blob: f8cf3b1d842aa75fd2d0862f408dff6330347bf6 [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
Hung-Te Linfe187922013-02-01 01:09:24 +080021bootblock-y += cbfs.c
22ifneq ($(CONFIG_HAVE_ARCH_MEMSET),y)
23bootblock-y += memset.c
24endif
25bootblock-y += memchr.c
26ifneq ($(CONFIG_HAVE_ARCH_MEMCPY),y)
27bootblock-y += memcpy.c
28endif
29bootblock-y += memcmp.c
Gabe Black545c0ca2013-07-07 14:04:26 -070030ifneq ($(CONFIG_HAVE_ARCH_MEMMOVE),y)
31bootblock-y += memmove.c
32endif
Hung-Te Linfe187922013-02-01 01:09:24 +080033
Stefan Reinauer1afe51a2011-10-26 22:11:52 +000034ifneq ($(CONFIG_HAVE_ARCH_MEMSET),y)
Stefan Reinauer24ef1342011-04-14 22:28:00 +000035romstage-y += memset.c
Aaron Durbin2b7c88f2013-03-01 16:56:34 -060036rmodules-y += memset.c
Stefan Reinauer1afe51a2011-10-26 22:11:52 +000037endif
Gabe Black1025f3a2011-09-16 02:18:56 -070038romstage-y += memchr.c
Stefan Reinauer0054afa2011-10-25 23:43:34 +000039ifneq ($(CONFIG_HAVE_ARCH_MEMCPY),y)
Stefan Reinauer24ef1342011-04-14 22:28:00 +000040romstage-y += memcpy.c
Aaron Durbin2b7c88f2013-03-01 16:56:34 -060041rmodules-y += memcpy.c
Stefan Reinauer0054afa2011-10-25 23:43:34 +000042endif
Stefan Reinauer24ef1342011-04-14 22:28:00 +000043romstage-y += memcmp.c
Aaron Durbin2b7c88f2013-03-01 16:56:34 -060044rmodules-y += memcmp.c
Stefan Reinauer24ef1342011-04-14 22:28:00 +000045romstage-y += cbfs.c
Andrew Wueabfd3a2013-08-19 11:43:36 +080046romstage-$(CONFIG_COMPRESS_RAMSTAGE) += lzma.c
Stefan Reinauer24ef1342011-04-14 22:28:00 +000047#romstage-y += lzmadecode.c
48romstage-$(CONFIG_CACHE_AS_RAM) += ramtest.c
Vladimir Serbinenko45988da2013-03-30 02:02:13 +010049
Kyösti Mälkkif8bf5a12013-10-11 22:08:02 +030050ifeq ($(CONFIG_EARLY_CBMEM_INIT),y)
Aaron Durbinc15551a2013-03-23 00:00:54 -050051romstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
Kyösti Mälkkia2f6af32013-09-10 13:50:32 +030052romstage-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
Kyösti Mälkkia2f6af32013-09-10 13:50:32 +030053endif
Denis 'GNUtoo' Carikli8a0a8482013-06-20 16:24:14 +020054
Stefan Reinauerfb89dd02012-03-30 16:28:20 -070055romstage-y += compute_ip_checksum.c
Gabe Black545c0ca2013-07-07 14:04:26 -070056ifneq ($(CONFIG_HAVE_ARCH_MEMMOVE),y)
Stefan Reinauerfb89dd02012-03-30 16:28:20 -070057romstage-y += memmove.c
Gabe Black545c0ca2013-07-07 14:04:26 -070058endif
David Hendricksae0e8d32013-03-06 20:43:55 -080059romstage-$(CONFIG_ARCH_X86) += gcc.c
Stefan Reinauer24ef1342011-04-14 22:28:00 +000060
Stefan Reinauer1e753292012-11-30 12:23:45 -080061ramstage-y += hardwaremain.c
62ramstage-y += selfboot.c
Stefan Reinauer3e4e3032013-03-20 14:08:04 -070063ramstage-y += coreboot_table.c
Aaron Durbin49048022014-02-18 21:55:02 -060064ramstage-y += bootmem.c
Stefan Reinauer1afe51a2011-10-26 22:11:52 +000065ifneq ($(CONFIG_HAVE_ARCH_MEMSET),y)
Patrick Georgi8463dd92010-09-30 16:55:02 +000066ramstage-y += memset.c
Stefan Reinauer1afe51a2011-10-26 22:11:52 +000067endif
Gabe Black1025f3a2011-09-16 02:18:56 -070068ramstage-y += memchr.c
Stefan Reinauer0054afa2011-10-25 23:43:34 +000069ifneq ($(CONFIG_HAVE_ARCH_MEMCPY),y)
Patrick Georgi8463dd92010-09-30 16:55:02 +000070ramstage-y += memcpy.c
Stefan Reinauer0054afa2011-10-25 23:43:34 +000071endif
Patrick Georgi8463dd92010-09-30 16:55:02 +000072ramstage-y += memcmp.c
Gabe Black545c0ca2013-07-07 14:04:26 -070073ifneq ($(CONFIG_HAVE_ARCH_MEMMOVE),y)
Patrick Georgi8463dd92010-09-30 16:55:02 +000074ramstage-y += memmove.c
Gabe Black545c0ca2013-07-07 14:04:26 -070075endif
Patrick Georgi8463dd92010-09-30 16:55:02 +000076ramstage-y += malloc.c
Duncan Laurief5e9ac42012-06-23 13:33:32 -070077smm-$(CONFIG_SMM_TSEG) += malloc.c
Patrick Georgi8463dd92010-09-30 16:55:02 +000078ramstage-y += delay.c
79ramstage-y += fallback_boot.c
80ramstage-y += compute_ip_checksum.c
81ramstage-y += version.c
82ramstage-y += cbfs.c
83ramstage-y += lzma.c
84#ramstage-y += lzmadecode.c
Ronald G. Minnich9764d4c2012-06-12 16:29:32 -070085ramstage-y += stack.c
Stefan Reinauer4c4dd932012-12-07 17:28:02 -080086ramstage-$(CONFIG_ARCH_X86) += gcc.c
Stefan Reinauer24ef1342011-04-14 22:28:00 +000087ramstage-y += clog2.c
Alexandru Gagniucaf4bd592014-01-12 15:42:58 -060088romstage-y += clog2.c
Vadim Bendebury3e316002011-09-30 12:02:18 -070089ramstage-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
Stefan Reinauer24ef1342011-04-14 22:28:00 +000090ramstage-$(CONFIG_BOOTSPLASH) += jpeg.c
Rudolf Marek7f0e9302011-09-02 23:23:41 +020091ramstage-$(CONFIG_TRACE) += trace.c
Vadim Bendebury6f72d692011-09-21 16:12:39 -070092ramstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
Stefan Reinauerd37ab452012-12-18 16:23:28 -080093ramstage-$(CONFIG_COVERAGE) += libgcov.c
Ronald G. Minnichb3b72f32013-03-13 14:35:01 -070094ramstage-$(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT) += edid.c
Aaron Durbina05a8522013-03-22 20:44:46 -050095ramstage-y += memrange.c
Aaron Durbin4409a5e2013-05-06 12:20:52 -050096ramstage-$(CONFIG_COOP_MULTITASKING) += thread.c
Aaron Durbin340ca912013-04-30 09:58:12 -050097ramstage-$(CONFIG_TIMER_QUEUE) += timer_queue.c
Stefan Reinauer16ce01b2011-01-28 08:05:54 +000098
Aaron Durbindf3a1092013-03-13 12:41:44 -050099# The CBMEM implementations are chosen based on CONFIG_DYNAMIC_CBMEM.
100ifeq ($(CONFIG_DYNAMIC_CBMEM),y)
101ramstage-y += dynamic_cbmem.c
102romstage-y += dynamic_cbmem.c
103else
104ramstage-y += cbmem.c
Kyösti Mälkkif8bf5a12013-10-11 22:08:02 +0300105romstage-$(CONFIG_EARLY_CBMEM_INIT) += cbmem.c
Kyösti Mälkkideb2cb22014-03-28 23:46:45 +0200106romstage-$(CONFIG_BROKEN_CAR_MIGRATE) += cbmem.c
Aaron Durbindf3a1092013-03-13 12:41:44 -0500107endif # CONFIG_DYNAMIC_CBMEM
108ramstage-y += cbmem_info.c
109
Stefan Reinauer2f38b072013-07-18 16:24:08 -0700110ramstage-y += hexdump.c
111romstage-y += hexdump.c
112
Duncan Laurie72748002013-10-31 08:26:23 -0700113ramstage-$(CONFIG_REG_SCRIPT) += reg_script.c
114
Aaron Durbin75e29742013-10-10 20:37:04 -0500115romstage-$(CONFIG_CACHE_RELOCATED_RAMSTAGE_OUTSIDE_CBMEM) += ramstage_cache.c
116
Stefan Reinauerfb89dd02012-03-30 16:28:20 -0700117ifneq ($(CONFIG_HAVE_ARCH_MEMSET),y)
118smm-y += memset.c
119endif
Stefan Reinauer0054afa2011-10-25 23:43:34 +0000120ifneq ($(CONFIG_HAVE_ARCH_MEMCPY),y)
121smm-y += memcpy.c
122endif
Gabe Blackc6b44162013-07-01 04:28:23 -0700123ifneq ($(CONFIG_HAVE_ARCH_MEMMOVE),y)
124smm-y += memmove.c
125endif
Stefan Reinauerfb89dd02012-03-30 16:28:20 -0700126smm-y += cbfs.c memcmp.c
David Hendricksae0e8d32013-03-06 20:43:55 -0800127smm-y += gcc.c
Stefan Reinauere9f32582010-03-29 13:04:13 +0000128
Patrick Georgi8463dd92010-09-30 16:55:02 +0000129$(obj)/lib/version.ramstage.o : $(obj)/build.h
Stefan Reinauerba9dae22011-07-29 15:34:14 -0700130
Aaron Durbinad935522012-12-24 14:28:37 -0600131ifeq ($(CONFIG_RELOCATABLE_MODULES),y)
132ramstage-y += rmodule.c
Aaron Durbin8e4a3552013-02-08 17:28:04 -0600133romstage-$(CONFIG_RELOCATABLE_RAMSTAGE) += rmodule.c
Aaron Durbinad935522012-12-24 14:28:37 -0600134
135RMODULE_LDSCRIPT := $(src)/lib/rmodule.ld
Aaron Durbin3eb8eb72014-03-10 16:13:58 -0500136RMODULE_LDFLAGS := -nostartfiles -Wl,--emit-relocs -Wl,-z,defs -Wl,-Bsymbolic -Wl,-T,$(RMODULE_LDSCRIPT)
Aaron Durbinad935522012-12-24 14:28:37 -0600137
138# rmodule_link_rules is a function that should be called with:
139# (1) the object name to link
140# (2) the dependencies
141# (3) heap size of the relocatable module
Aaron Durbin3eb8eb72014-03-10 16:13:58 -0500142# It will create the necessary Make rules to create a rmodule. The resulting
143# rmdoule is named $(1).rmod
Aaron Durbinad935522012-12-24 14:28:37 -0600144define rmodule_link
Aaron Durbin3eb8eb72014-03-10 16:13:58 -0500145$(strip $(1)): $(strip $(2)) $$(RMODULE_LDSCRIPT) $$(obj)/ldoptions $$(RMODTOOL)
146 $$(CC) $$(CFLAGS) $$(RMODULE_LDFLAGS) -Wl,--defsym=__heap_size=$(strip $(3)) -o $$@ -Wl,--start-group $(strip $(2)) $$(LIBGCC_FILE_NAME) -Wl,--end-group
Aaron Durbinad935522012-12-24 14:28:37 -0600147 $$(NM) -n $$@ > $$(basename $$@).map
Aaron Durbin3eb8eb72014-03-10 16:13:58 -0500148
149$(strip $(1)).rmod: $(strip $(1))
150 $$(RMODTOOL) -i $$^ -o $$@
Aaron Durbinad935522012-12-24 14:28:37 -0600151endef
152
153endif
Aaron Durbin2b7c88f2013-03-01 16:56:34 -0600154