blob: a4bcbcb60e14ceb0d3277f5f10e8ff6eb158f08d [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#
Aaron Durbin0f333072014-01-30 17:19:46 -060015subdirs-y += loaders
Stefan Reinauer24ef1342011-04-14 22:28:00 +000016
Julius Werner86fc11d2015-10-09 13:37:58 -070017
18ifneq ($(CONFIG_BOOTBLOCK_CUSTOM),y)
19bootblock-y += bootblock.c
20endif
21
Aaron Durbin899d13d2015-05-15 23:39:23 -050022bootblock-y += prog_loaders.c
Aaron Durbinb3847e62015-03-20 15:55:08 -050023bootblock-y += prog_ops.c
Aaron Durbin899d13d2015-05-15 23:39:23 -050024bootblock-y += cbfs.c
Vadim Bendeburyadcb0952014-05-01 12:23:09 -070025bootblock-$(CONFIG_COMMON_CBFS_SPI_WRAPPER) += cbfs_spi.c
David Hendricks6fab3652014-11-06 15:22:10 -080026bootblock-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c
Julius Werner7a8a4ab2015-05-22 16:26:40 -070027bootblock-y += libgcc.c
Aaron Durbine5e36302014-09-25 10:05:15 -050028bootblock-$(CONFIG_GENERIC_UDELAY) += timer.c
29
Paul Menzel2ea25552015-10-13 17:30:57 +020030ifeq ($(CONFIG_EARLY_CBMEM_INIT),y)
Patrick Georgi8b174042015-04-27 18:03:50 +020031bootblock-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
Paul Menzel2ea25552015-10-13 17:30:57 +020032endif
33
Kyösti Mälkki8659e402014-12-21 08:55:47 +020034bootblock-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
Patrick Georgib0a2d3c22016-01-19 18:10:55 +010035bootblock-y += delay.c
Hung-Te Linfe187922013-02-01 01:09:24 +080036bootblock-y += memchr.c
Hung-Te Linfe187922013-02-01 01:09:24 +080037bootblock-y += memcmp.c
Aaron Durbinc6588c52015-05-15 13:15:34 -050038bootblock-y += boot_device.c
Aaron Durbin0424c952015-03-28 23:56:22 -050039bootblock-y += fmap.c
Hung-Te Linfe187922013-02-01 01:09:24 +080040
Aaron Durbin899d13d2015-05-15 23:39:23 -050041verstage-y += prog_loaders.c
Aaron Durbinb3847e62015-03-20 15:55:08 -050042verstage-y += prog_ops.c
Daisuke Nojiribcc1d422014-06-19 19:16:24 -070043verstage-y += delay.c
44verstage-y += cbfs.c
Aaron Durbin17200ad2015-05-01 16:48:54 -050045verstage-y += halt.c
Aaron Durbin0424c952015-03-28 23:56:22 -050046verstage-y += fmap.c
Julius Werner7a8a4ab2015-05-22 16:26:40 -070047verstage-y += libgcc.c
Daisuke Nojiribcc1d422014-06-19 19:16:24 -070048verstage-y += memcmp.c
Patrick Georgi8b174042015-04-27 18:03:50 +020049verstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
Aaron Durbinc6588c52015-05-15 13:15:34 -050050verstage-y += boot_device.c
Daisuke Nojiribcc1d422014-06-19 19:16:24 -070051verstage-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
Vadim Bendebury3486d1f2014-10-16 11:24:12 -070052verstage-$(CONFIG_COMMON_CBFS_SPI_WRAPPER) += cbfs_spi.c
Yen Lin5bdbd002015-04-08 16:55:17 -070053
54ifeq ($(MOCK_TPM),1)
Patrick Georgi27ef6022015-04-30 14:25:14 +020055libverstage-y += mocked_tlcl.c
Yen Lin5bdbd002015-04-08 16:55:17 -070056else
Patrick Georgi27ef6022015-04-30 14:25:14 +020057libverstage-y += tlcl.c
Yen Lin5bdbd002015-04-08 16:55:17 -070058endif
59
Vadim Bendebury3486d1f2014-10-16 11:24:12 -070060verstage-$(CONFIG_GENERIC_UDELAY) += timer.c
David Hendricks6fab3652014-11-06 15:22:10 -080061verstage-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c
Daisuke Nojiribcc1d422014-06-19 19:16:24 -070062
Aaron Durbin899d13d2015-05-15 23:39:23 -050063romstage-y += prog_loaders.c
Aaron Durbinb3847e62015-03-20 15:55:08 -050064romstage-y += prog_ops.c
Gabe Black1025f3a2011-09-16 02:18:56 -070065romstage-y += memchr.c
Stefan Reinauer24ef1342011-04-14 22:28:00 +000066romstage-y += memcmp.c
Furquan Shaikh133096b2014-07-31 09:28:55 -070067$(foreach arch,$(ARCH_SUPPORTED),\
Julius Wernerec5e5e02014-08-20 15:29:56 -070068 $(eval rmodules_$(arch)-y += memcmp.c) \
69 $(eval rmodules_$(arch)-y += rmodule.ld))
Furquan Shaikh133096b2014-07-31 09:28:55 -070070
Aaron Durbin0424c952015-03-28 23:56:22 -050071romstage-y += fmap.c
Stefan Reinauer3905e3d2013-08-29 16:01:05 -070072romstage-$(CONFIG_I2C_TPM) += delay.c
Aaron Durbin899d13d2015-05-15 23:39:23 -050073romstage-y += cbfs.c
Vadim Bendeburyadcb0952014-05-01 12:23:09 -070074romstage-$(CONFIG_COMMON_CBFS_SPI_WRAPPER) += cbfs_spi.c
Edward O'Callaghancd31afd2014-11-11 12:27:06 +110075romstage-$(CONFIG_COMPRESS_RAMSTAGE) += lzma.c lzmadecode.c
Julius Werner7a8a4ab2015-05-22 16:26:40 -070076romstage-y += libgcc.c
David Hendricks560c6432014-02-13 13:07:50 -080077romstage-$(CONFIG_PRIMITIVE_MEMTEST) += primitive_memtest.c
78ramstage-$(CONFIG_PRIMITIVE_MEMTEST) += primitive_memtest.c
Stefan Reinauer24ef1342011-04-14 22:28:00 +000079romstage-$(CONFIG_CACHE_AS_RAM) += ramtest.c
David Hendricks6fab3652014-11-06 15:22:10 -080080romstage-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c
Julius Werner7dcf9d52015-10-16 13:10:02 -070081romstage-y += stack.c
Vladimir Serbinenko45988da2013-03-30 02:02:13 +010082
Kyösti Mälkkif8bf5a12013-10-11 22:08:02 +030083ifeq ($(CONFIG_EARLY_CBMEM_INIT),y)
Aaron Durbinc15551a2013-03-23 00:00:54 -050084romstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
Kyösti Mälkkia2f6af32013-09-10 13:50:32 +030085romstage-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
Kyösti Mälkkia2f6af32013-09-10 13:50:32 +030086endif
Denis 'GNUtoo' Carikli8a0a8482013-06-20 16:24:14 +020087
Stefan Reinauerfb89dd02012-03-30 16:28:20 -070088romstage-y += compute_ip_checksum.c
Patrick Georgi6d0cba72014-11-29 11:32:12 +010089ifeq ($(CONFIG_COMPILER_GCC),y)
Alexandru Gagniuc66bbb312015-10-06 16:35:07 -070090bootblock-$(CONFIG_ARCH_BOOTBLOCK_X86_32) += gcc.c
Aaron Durbin75c51d92015-09-29 16:31:20 -050091verstage-$(CONFIG_ARCH_VERSTAGE_X86_32) += gcc.c
Furquan Shaikh99ac98f2014-04-23 10:18:48 -070092romstage-$(CONFIG_ARCH_ROMSTAGE_X86_32) += gcc.c
Edward O'Callaghan4ba8ba42014-05-23 01:29:00 +100093ramstage-$(CONFIG_ARCH_RAMSTAGE_X86_32) += gcc.c
Stefan Reinauer1fa52742015-07-31 17:56:03 -070094smm-$(CONFIG_ARCH_RAMSTAGE_X86_32) += gcc.c
Edward O'Callaghan4ba8ba42014-05-23 01:29:00 +100095endif
Stefan Reinauer24ef1342011-04-14 22:28:00 +000096
Aaron Durbine5e36302014-09-25 10:05:15 -050097romstage-$(CONFIG_GENERIC_UDELAY) += timer.c
98
Aaron Durbin899d13d2015-05-15 23:39:23 -050099ramstage-y += prog_loaders.c
Aaron Durbinb3847e62015-03-20 15:55:08 -0500100ramstage-y += prog_ops.c
Stefan Reinauer1e753292012-11-30 12:23:45 -0800101ramstage-y += hardwaremain.c
102ramstage-y += selfboot.c
Stefan Reinauer3e4e3032013-03-20 14:08:04 -0700103ramstage-y += coreboot_table.c
Aaron Durbin49048022014-02-18 21:55:02 -0600104ramstage-y += bootmem.c
Aaron Durbin0424c952015-03-28 23:56:22 -0500105ramstage-y += fmap.c
Gabe Black1025f3a2011-09-16 02:18:56 -0700106ramstage-y += memchr.c
Patrick Georgi8463dd92010-09-30 16:55:02 +0000107ramstage-y += memcmp.c
Patrick Georgi8463dd92010-09-30 16:55:02 +0000108ramstage-y += malloc.c
Duncan Laurief5e9ac42012-06-23 13:33:32 -0700109smm-$(CONFIG_SMM_TSEG) += malloc.c
Patrick Georgi8463dd92010-09-30 16:55:02 +0000110ramstage-y += delay.c
111ramstage-y += fallback_boot.c
112ramstage-y += compute_ip_checksum.c
Aaron Durbin899d13d2015-05-15 23:39:23 -0500113ramstage-y += cbfs.c
Vadim Bendeburyadcb0952014-05-01 12:23:09 -0700114ramstage-$(CONFIG_COMMON_CBFS_SPI_WRAPPER) += cbfs_spi.c
Edward O'Callaghancd31afd2014-11-11 12:27:06 +1100115ramstage-y += lzma.c lzmadecode.c
Ronald G. Minnich9764d4c2012-06-12 16:29:32 -0700116ramstage-y += stack.c
Vadim Bendebury3e316002011-09-30 12:02:18 -0700117ramstage-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
Stefan Reinauer24ef1342011-04-14 22:28:00 +0000118ramstage-$(CONFIG_BOOTSPLASH) += jpeg.c
Rudolf Marek7f0e9302011-09-02 23:23:41 +0200119ramstage-$(CONFIG_TRACE) += trace.c
Vadim Bendebury6f72d692011-09-21 16:12:39 -0700120ramstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
Stefan Reinauerd37ab452012-12-18 16:23:28 -0800121ramstage-$(CONFIG_COVERAGE) += libgcov.c
Ronald G. Minnichb3b72f32013-03-13 14:35:01 -0700122ramstage-$(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT) += edid.c
Aaron Durbina05a8522013-03-22 20:44:46 -0500123ramstage-y += memrange.c
Aaron Durbin4409a5e2013-05-06 12:20:52 -0500124ramstage-$(CONFIG_COOP_MULTITASKING) += thread.c
Aaron Durbin340ca912013-04-30 09:58:12 -0500125ramstage-$(CONFIG_TIMER_QUEUE) += timer_queue.c
David Hendricks3b11de82014-11-05 14:05:56 -0800126ramstage-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c
Aaron Durbine5e36302014-09-25 10:05:15 -0500127ramstage-$(CONFIG_GENERIC_UDELAY) += timer.c
Vadim Bendebury243c6142015-03-27 16:08:04 -0700128ramstage-y += b64_decode.c
Aaron Durbin9420a522015-11-17 16:31:00 -0600129ramstage-$(CONFIG_ACPI_NHLT) += nhlt.c
Stefan Reinauer16ce01b2011-01-28 08:05:54 +0000130
Aaron Durbin0dff57d2015-03-05 21:18:33 -0600131romstage-y += cbmem_common.c
132romstage-y += imd_cbmem.c
133
134ramstage-y += cbmem_common.c
135ramstage-y += imd_cbmem.c
Aaron Durbindf3a1092013-03-13 12:41:44 -0500136
Aaron Durbin20686d82015-03-05 14:11:27 -0600137romstage-y += imd.c
138ramstage-y += imd.c
139
Alexandru Gagniuce223e892015-10-14 09:58:36 -0700140bootblock-y += hexdump.c
Stefan Reinauer2f38b072013-07-18 16:24:08 -0700141ramstage-y += hexdump.c
142romstage-y += hexdump.c
143
Aaron Durbin75c51d92015-09-29 16:31:20 -0500144verstage-$(CONFIG_REG_SCRIPT) += reg_script.c
Isaac Christensen0b4e8df2014-10-01 11:50:20 -0600145romstage-$(CONFIG_REG_SCRIPT) += reg_script.c
Duncan Laurie72748002013-10-31 08:26:23 -0700146ramstage-$(CONFIG_REG_SCRIPT) += reg_script.c
147
Aaron Durbinbd74a4b2015-03-06 23:17:33 -0600148ifeq ($(CONFIG_CACHE_RELOCATED_RAMSTAGE_OUTSIDE_CBMEM),y)
149ramstage-y += ext_stage_cache.c
150romstage-y += ext_stage_cache.c
151else
152ramstage-$(CONFIG_RELOCATABLE_RAMSTAGE) += cbmem_stage_cache.c
153romstage-$(CONFIG_RELOCATABLE_RAMSTAGE) += cbmem_stage_cache.c
154endif
155
Aaron Durbin127525c2015-03-26 12:29:12 -0500156
Aaron Durbinc6588c52015-05-15 13:15:34 -0500157romstage-y += boot_device.c
158ramstage-y += boot_device.c
Aaron Durbin75e29742013-10-10 20:37:04 -0500159
Aaron Durbinc6588c52015-05-15 13:15:34 -0500160smm-y += boot_device.c
Aaron Durbin0424c952015-03-28 23:56:22 -0500161smm-y += fmap.c
Aaron Durbin899d13d2015-05-15 23:39:23 -0500162smm-y += cbfs.c memcmp.c
Stefan Reinauere9f32582010-03-29 13:04:13 +0000163
Kyösti Mälkkic36af7b2014-11-18 12:41:16 +0200164bootblock-y += version.c
165romstage-y += version.c
166ramstage-y += version.c
167smm-y += version.c
Aaron Durbinfd6fb262015-05-13 13:37:43 -0500168verstage-y += version.c
Kyösti Mälkkic36af7b2014-11-18 12:41:16 +0200169
170$(obj)/lib/version.bootblock.o : $(obj)/build.h
171$(obj)/lib/version.romstage.o : $(obj)/build.h
Patrick Georgi8463dd92010-09-30 16:55:02 +0000172$(obj)/lib/version.ramstage.o : $(obj)/build.h
Kyösti Mälkkic36af7b2014-11-18 12:41:16 +0200173$(obj)/lib/version.smm.o : $(obj)/build.h
Aaron Durbinfd6fb262015-05-13 13:37:43 -0500174$(obj)/lib/version.verstage.o : $(obj)/build.h
Stefan Reinauerba9dae22011-07-29 15:34:14 -0700175
Kyösti Mälkki5687fc92013-11-28 18:11:49 +0200176romstage-y += bootmode.c
177ramstage-y += bootmode.c
178
Patrick Georgi1b2f2a02014-11-28 22:00:22 +0100179bootblock-y += halt.c
180romstage-y += halt.c
181ramstage-y += halt.c
182smm-y += halt.c
183
Julius Wernerec5e5e02014-08-20 15:29:56 -0700184ifneq ($(CONFIG_ARCH_X86),y)
Aaron Durbin14714e12015-09-04 12:06:05 -0500185# X86 bootblock uses custom ldscripts that are all glued together,
Julius Wernerec5e5e02014-08-20 15:29:56 -0700186# so we need to exclude it here or it would pick these up as well
Aaron Durbinb2a62622015-09-04 12:09:49 -0500187bootblock-y += program.ld
Julius Wernerec5e5e02014-08-20 15:29:56 -0700188endif
Aaron Durbin4de29d42015-09-03 22:49:36 -0500189
Aaron Durbin14714e12015-09-04 12:06:05 -0500190romstage-y += program.ld
Aaron Durbin4de29d42015-09-03 22:49:36 -0500191ramstage-y += program.ld
Aaron Durbine5bad5c2015-09-05 10:27:12 -0500192verstage-y += program.ld
Julius Wernerec5e5e02014-08-20 15:29:56 -0700193
Aaron Durbinad935522012-12-24 14:28:37 -0600194ifeq ($(CONFIG_RELOCATABLE_MODULES),y)
195ramstage-y += rmodule.c
Aaron Durbin8e4a3552013-02-08 17:28:04 -0600196romstage-$(CONFIG_RELOCATABLE_RAMSTAGE) += rmodule.c
Aaron Durbinad935522012-12-24 14:28:37 -0600197
Aaron Durbind4dd44c2015-09-06 10:15:17 -0500198RMODULE_LDFLAGS := -z defs -Bsymbolic
Aaron Durbinad935522012-12-24 14:28:37 -0600199
200# rmodule_link_rules is a function that should be called with:
201# (1) the object name to link
202# (2) the dependencies
203# (3) heap size of the relocatable module
Furquan Shaikh133096b2014-07-31 09:28:55 -0700204# (4) arch for which the rmodules are to be linked
Aaron Durbin3eb8eb72014-03-10 16:13:58 -0500205# It will create the necessary Make rules to create a rmodule. The resulting
206# rmdoule is named $(1).rmod
Aaron Durbinad935522012-12-24 14:28:37 -0600207define rmodule_link
Julius Wernerec5e5e02014-08-20 15:29:56 -0700208$(strip $(1)): $(strip $(2)) $$(COMPILER_RT_rmodules_$(4)) $(obj)/lib/rmodule.rmodules_$(4).ld | $$(RMODTOOL)
Aaron Durbind4dd44c2015-09-06 10:15:17 -0500209 $$(LD_rmodules_$(4)) $$(LDFLAGS_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 -0700210 $$(NM_rmodules_$(4)) -n $$@ > $$(basename $$@).map
Aaron Durbinad935522012-12-24 14:28:37 -0600211endef
212
213endif
Aaron Durbin83bc0db2015-09-06 10:45:18 -0500214
215$(objcbfs)/%.debug.rmod: $(objcbfs)/%.debug | $(RMODTOOL)
216 $(RMODTOOL) -i $< -o $@
217
218$(obj)/%.elf.rmod: $(obj)/%.elf | $(RMODTOOL)
219 $(RMODTOOL) -i $< -o $@