blob: 1350152a40430171c8f6635421ac997709dd809b [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#
Nico Huberbe5492a2015-09-29 16:41:19 +020015subdirs-y += gnat
Stefan Reinauer24ef1342011-04-14 22:28:00 +000016
Ryan Salsamendiab37e9a2017-06-11 21:07:31 -070017ifeq ($(CONFIG_UBSAN),y)
18ramstage-y += ubsan.c
19CFLAGS_ramstage += -fsanitize=undefined
20endif
Julius Werner86fc11d2015-10-09 13:37:58 -070021
Julius Werner99f46832018-05-16 14:14:04 -070022decompressor-y += decompressor.c
23$(call src-to-obj,decompressor,$(dir)/decompressor.c): $(objcbfs)/bootblock.lz4
24$(call src-to-obj,decompressor,$(dir)/decompressor.c): CCACHE_EXTRAFILES=$(objcbfs)/bootblock.lz4
25# Must reset CCACHE_EXTRAFILES or make applies it transitively to dependencies.
26$(objcbfs)/bootblock.lz4: CCACHE_EXTRAFILES=
27
28decompressor-y += delay.c
29decompressor-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c
30decompressor-y += memchr.c
31decompressor-y += memcmp.c
32decompressor-y += prog_ops.c
33decompressor-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
34
Julius Werner86fc11d2015-10-09 13:37:58 -070035ifneq ($(CONFIG_BOOTBLOCK_CUSTOM),y)
36bootblock-y += bootblock.c
37endif
38
Aaron Durbin899d13d2015-05-15 23:39:23 -050039bootblock-y += prog_loaders.c
Aaron Durbinb3847e62015-03-20 15:55:08 -050040bootblock-y += prog_ops.c
Aaron Durbin899d13d2015-05-15 23:39:23 -050041bootblock-y += cbfs.c
David Hendricks6fab3652014-11-06 15:22:10 -080042bootblock-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c
Julius Werner7a8a4ab2015-05-22 16:26:40 -070043bootblock-y += libgcc.c
Aaron Durbine5e36302014-09-25 10:05:15 -050044bootblock-$(CONFIG_GENERIC_UDELAY) += timer.c
45
Patrick Georgi8b174042015-04-27 18:03:50 +020046bootblock-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
Paul Menzel2ea25552015-10-13 17:30:57 +020047
Kyösti Mälkki8659e402014-12-21 08:55:47 +020048bootblock-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
Patrick Georgib0a2d3c22016-01-19 18:10:55 +010049bootblock-y += delay.c
Hung-Te Linfe187922013-02-01 01:09:24 +080050bootblock-y += memchr.c
Hung-Te Linfe187922013-02-01 01:09:24 +080051bootblock-y += memcmp.c
Aaron Durbinc6588c52015-05-15 13:15:34 -050052bootblock-y += boot_device.c
Aaron Durbin0424c952015-03-28 23:56:22 -050053bootblock-y += fmap.c
Hung-Te Linfe187922013-02-01 01:09:24 +080054
Aaron Durbin899d13d2015-05-15 23:39:23 -050055verstage-y += prog_loaders.c
Aaron Durbinb3847e62015-03-20 15:55:08 -050056verstage-y += prog_ops.c
Daisuke Nojiribcc1d422014-06-19 19:16:24 -070057verstage-y += delay.c
58verstage-y += cbfs.c
Aaron Durbin17200ad2015-05-01 16:48:54 -050059verstage-y += halt.c
Aaron Durbin0424c952015-03-28 23:56:22 -050060verstage-y += fmap.c
Julius Werner7a8a4ab2015-05-22 16:26:40 -070061verstage-y += libgcc.c
Daisuke Nojiribcc1d422014-06-19 19:16:24 -070062verstage-y += memcmp.c
Patrick Georgi8b174042015-04-27 18:03:50 +020063verstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
Aaron Durbinc6588c52015-05-15 13:15:34 -050064verstage-y += boot_device.c
Daisuke Nojiribcc1d422014-06-19 19:16:24 -070065verstage-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
Yen Lin5bdbd002015-04-08 16:55:17 -070066
Vadim Bendebury3486d1f2014-10-16 11:24:12 -070067verstage-$(CONFIG_GENERIC_UDELAY) += timer.c
David Hendricks6fab3652014-11-06 15:22:10 -080068verstage-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c
Daisuke Nojiribcc1d422014-06-19 19:16:24 -070069
Aaron Durbin899d13d2015-05-15 23:39:23 -050070romstage-y += prog_loaders.c
Aaron Durbinb3847e62015-03-20 15:55:08 -050071romstage-y += prog_ops.c
Gabe Black1025f3a2011-09-16 02:18:56 -070072romstage-y += memchr.c
Stefan Reinauer24ef1342011-04-14 22:28:00 +000073romstage-y += memcmp.c
Furquan Shaikh133096b2014-07-31 09:28:55 -070074$(foreach arch,$(ARCH_SUPPORTED),\
Julius Wernerec5e5e02014-08-20 15:29:56 -070075 $(eval rmodules_$(arch)-y += memcmp.c) \
76 $(eval rmodules_$(arch)-y += rmodule.ld))
Furquan Shaikh133096b2014-07-31 09:28:55 -070077
Aaron Durbin0424c952015-03-28 23:56:22 -050078romstage-y += fmap.c
Patrick Georgi82d9a312016-01-21 12:46:10 +010079romstage-y += delay.c
Aaron Durbin899d13d2015-05-15 23:39:23 -050080romstage-y += cbfs.c
Edward O'Callaghancd31afd2014-11-11 12:27:06 +110081romstage-$(CONFIG_COMPRESS_RAMSTAGE) += lzma.c lzmadecode.c
Julius Werner7a8a4ab2015-05-22 16:26:40 -070082romstage-y += libgcc.c
Aaron Durbin5fbe12d2016-07-17 22:59:47 -050083romstage-y += memrange.c
David Hendricks560c6432014-02-13 13:07:50 -080084romstage-$(CONFIG_PRIMITIVE_MEMTEST) += primitive_memtest.c
85ramstage-$(CONFIG_PRIMITIVE_MEMTEST) += primitive_memtest.c
Kyösti Mälkki321bce42019-03-20 19:53:44 +020086romstage-y += ramtest.c
David Hendricks6fab3652014-11-06 15:22:10 -080087romstage-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c
Aaron Durbincd0bc982016-11-19 12:36:09 -060088ramstage-y += region_file.c
89romstage-y += region_file.c
Aaron Durbinafe8aee2016-11-29 21:37:42 -060090ramstage-y += romstage_handoff.c
91romstage-y += romstage_handoff.c
Kyösti Mälkkie5c00a52016-06-27 14:50:27 +030092romstage-y += romstage_stack.c
Ronald G. Minnich3d8e53f2018-10-29 09:58:06 -070093romstage-y += selfboot.c
Kyösti Mälkkibce9bbd2016-06-27 16:15:02 +030094ramstage-y += romstage_stack.c
Julius Werner7dcf9d52015-10-16 13:10:02 -070095romstage-y += stack.c
Simon Glass2cf99e12016-06-10 20:58:24 -060096ramstage-y += rtc.c
Vladimir Serbinenko45988da2013-03-30 02:02:13 +010097
Aaron Durbinc15551a2013-03-23 00:00:54 -050098romstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
Kyösti Mälkkia2f6af32013-09-10 13:50:32 +030099romstage-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
Denis 'GNUtoo' Carikli8a0a8482013-06-20 16:24:14 +0200100
Stefan Reinauerfb89dd02012-03-30 16:28:20 -0700101romstage-y += compute_ip_checksum.c
Patrick Georgi6d0cba72014-11-29 11:32:12 +0100102ifeq ($(CONFIG_COMPILER_GCC),y)
Alexandru Gagniuc66bbb312015-10-06 16:35:07 -0700103bootblock-$(CONFIG_ARCH_BOOTBLOCK_X86_32) += gcc.c
Aaron Durbin75c51d92015-09-29 16:31:20 -0500104verstage-$(CONFIG_ARCH_VERSTAGE_X86_32) += gcc.c
Furquan Shaikh99ac98f2014-04-23 10:18:48 -0700105romstage-$(CONFIG_ARCH_ROMSTAGE_X86_32) += gcc.c
Edward O'Callaghan4ba8ba42014-05-23 01:29:00 +1000106ramstage-$(CONFIG_ARCH_RAMSTAGE_X86_32) += gcc.c
Stefan Reinauer1fa52742015-07-31 17:56:03 -0700107smm-$(CONFIG_ARCH_RAMSTAGE_X86_32) += gcc.c
Edward O'Callaghan4ba8ba42014-05-23 01:29:00 +1000108endif
Stefan Reinauer24ef1342011-04-14 22:28:00 +0000109
Aaron Durbine5e36302014-09-25 10:05:15 -0500110romstage-$(CONFIG_GENERIC_UDELAY) += timer.c
111
Aaron Durbin899d13d2015-05-15 23:39:23 -0500112ramstage-y += prog_loaders.c
Aaron Durbinb3847e62015-03-20 15:55:08 -0500113ramstage-y += prog_ops.c
Stefan Reinauer1e753292012-11-30 12:23:45 -0800114ramstage-y += hardwaremain.c
115ramstage-y += selfboot.c
Stefan Reinauer3e4e3032013-03-20 14:08:04 -0700116ramstage-y += coreboot_table.c
Aaron Durbin49048022014-02-18 21:55:02 -0600117ramstage-y += bootmem.c
Aaron Durbin0424c952015-03-28 23:56:22 -0500118ramstage-y += fmap.c
Gabe Black1025f3a2011-09-16 02:18:56 -0700119ramstage-y += memchr.c
Patrick Georgi8463dd92010-09-30 16:55:02 +0000120ramstage-y += memcmp.c
Thomas Heijligen92043552019-01-29 12:48:01 +0100121ramstage-y += string.c
Patrick Georgi8463dd92010-09-30 16:55:02 +0000122ramstage-y += malloc.c
Duncan Laurief5e9ac42012-06-23 13:33:32 -0700123smm-$(CONFIG_SMM_TSEG) += malloc.c
Raul E Rangel21db6cc2018-03-29 10:18:14 -0600124ramstage-y += dimm_info_util.c
Patrick Georgi8463dd92010-09-30 16:55:02 +0000125ramstage-y += delay.c
126ramstage-y += fallback_boot.c
127ramstage-y += compute_ip_checksum.c
Aaron Durbin899d13d2015-05-15 23:39:23 -0500128ramstage-y += cbfs.c
Edward O'Callaghancd31afd2014-11-11 12:27:06 +1100129ramstage-y += lzma.c lzmadecode.c
Ronald G. Minnich9764d4c2012-06-12 16:29:32 -0700130ramstage-y += stack.c
Duncan Laurieb9552842016-05-09 10:58:03 -0700131ramstage-y += hexstrtobin.c
Felix Durairaj7f761652015-11-20 15:51:35 -0800132ramstage-y += wrdd.c
Vadim Bendebury3e316002011-09-30 12:02:18 -0700133ramstage-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
Stefan Reinauer24ef1342011-04-14 22:28:00 +0000134ramstage-$(CONFIG_BOOTSPLASH) += jpeg.c
Rudolf Marek7f0e9302011-09-02 23:23:41 +0200135ramstage-$(CONFIG_TRACE) += trace.c
Arthur Heymans65200f02018-12-20 11:23:56 +0100136postcar-$(CONFIG_TRACE) += trace.c
Vadim Bendebury6f72d692011-09-21 16:12:39 -0700137ramstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
Stefan Reinauerd37ab452012-12-18 16:23:28 -0800138ramstage-$(CONFIG_COVERAGE) += libgcov.c
Arthur Heymansa459a8a2017-04-30 08:26:27 +0200139ramstage-y += edid.c
Nico Huber3db76532017-05-18 18:07:34 +0200140ifneq ($(CONFIG_NO_EDID_FILL_FB),y)
141ramstage-y += edid_fill_fb.c
142endif
Aaron Durbina05a8522013-03-22 20:44:46 -0500143ramstage-y += memrange.c
Aaron Durbin4409a5e2013-05-06 12:20:52 -0500144ramstage-$(CONFIG_COOP_MULTITASKING) += thread.c
Aaron Durbin340ca912013-04-30 09:58:12 -0500145ramstage-$(CONFIG_TIMER_QUEUE) += timer_queue.c
David Hendricks3b11de82014-11-05 14:05:56 -0800146ramstage-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c
Aaron Durbine5e36302014-09-25 10:05:15 -0500147ramstage-$(CONFIG_GENERIC_UDELAY) += timer.c
Vadim Bendebury243c6142015-03-27 16:08:04 -0700148ramstage-y += b64_decode.c
Aaron Durbin9420a522015-11-17 16:31:00 -0600149ramstage-$(CONFIG_ACPI_NHLT) += nhlt.c
Patrick Rudolph666c1722018-04-03 09:57:33 +0200150ramstage-y += list.c
151ramstage-$(CONFIG_FLATTENED_DEVICE_TREE) += device_tree.c
Patrick Rudolpha892cde2018-04-19 14:39:07 +0200152ramstage-$(CONFIG_PAYLOAD_FIT_SUPPORT) += fit.c
153ramstage-$(CONFIG_PAYLOAD_FIT_SUPPORT) += fit_payload.c
Stefan Reinauer16ce01b2011-01-28 08:05:54 +0000154
Aaron Durbin0dff57d2015-03-05 21:18:33 -0600155romstage-y += cbmem_common.c
156romstage-y += imd_cbmem.c
Aaron Durbin7f8afe02016-03-18 12:21:23 -0500157romstage-y += imd.c
Aaron Durbin0dff57d2015-03-05 21:18:33 -0600158
159ramstage-y += cbmem_common.c
160ramstage-y += imd_cbmem.c
Aaron Durbin20686d82015-03-05 14:11:27 -0600161ramstage-y += imd.c
162
Aaron Durbin7f8afe02016-03-18 12:21:23 -0500163postcar-y += cbmem_common.c
Aaron Durbin1e9a9142016-09-16 16:23:21 -0500164postcar-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
Aaron Durbin7f8afe02016-03-18 12:21:23 -0500165postcar-y += imd_cbmem.c
166postcar-y += imd.c
Aaron Durbinafe8aee2016-11-29 21:37:42 -0600167postcar-y += romstage_handoff.c
Aaron Durbin7f8afe02016-03-18 12:21:23 -0500168
Alexandru Gagniuce223e892015-10-14 09:58:36 -0700169bootblock-y += hexdump.c
Stefan Reinauer2f38b072013-07-18 16:24:08 -0700170ramstage-y += hexdump.c
171romstage-y += hexdump.c
Duncan Laurie7fbdad82016-09-07 10:56:25 -0700172verstage-y += hexdump.c
John E. Kabat Jrd45011c2017-09-29 11:23:35 -0600173smm-y += hexdump.c
Stefan Reinauer2f38b072013-07-18 16:24:08 -0700174
Lee Leahy7a29cdc2016-06-05 18:49:55 -0700175bootblock-$(CONFIG_REG_SCRIPT) += reg_script.c
Aaron Durbin75c51d92015-09-29 16:31:20 -0500176verstage-$(CONFIG_REG_SCRIPT) += reg_script.c
Isaac Christensen0b4e8df2014-10-01 11:50:20 -0600177romstage-$(CONFIG_REG_SCRIPT) += reg_script.c
Duncan Laurie72748002013-10-31 08:26:23 -0700178ramstage-$(CONFIG_REG_SCRIPT) += reg_script.c
179
Aaron Durbinbd74a4b2015-03-06 23:17:33 -0600180ifeq ($(CONFIG_CACHE_RELOCATED_RAMSTAGE_OUTSIDE_CBMEM),y)
181ramstage-y += ext_stage_cache.c
182romstage-y += ext_stage_cache.c
Brandon Breitenstein135eae92016-09-30 13:57:12 -0700183postcar-y += ext_stage_cache.c
Aaron Durbinbd74a4b2015-03-06 23:17:33 -0600184else
185ramstage-$(CONFIG_RELOCATABLE_RAMSTAGE) += cbmem_stage_cache.c
186romstage-$(CONFIG_RELOCATABLE_RAMSTAGE) += cbmem_stage_cache.c
Kyösti Mälkki3fd259c2017-09-03 15:23:17 +0300187postcar-$(CONFIG_RELOCATABLE_RAMSTAGE) += cbmem_stage_cache.c
Aaron Durbinbd74a4b2015-03-06 23:17:33 -0600188endif
189
Aaron Durbin127525c2015-03-26 12:29:12 -0500190
Aaron Durbinc6588c52015-05-15 13:15:34 -0500191romstage-y += boot_device.c
192ramstage-y += boot_device.c
Aaron Durbin75e29742013-10-10 20:37:04 -0500193
Aaron Durbinc6588c52015-05-15 13:15:34 -0500194smm-y += boot_device.c
Furquan Shaikh591be2d2018-03-01 15:20:20 -0800195smm-y += delay.c
Aaron Durbin0424c952015-03-28 23:56:22 -0500196smm-y += fmap.c
Aaron Durbin899d13d2015-05-15 23:39:23 -0500197smm-y += cbfs.c memcmp.c
Aaron Durbin0660d1f2018-01-24 17:16:30 -0700198smm-$(CONFIG_GENERIC_UDELAY) += timer.c
Stefan Reinauere9f32582010-03-29 13:04:13 +0000199
Kyösti Mälkkic36af7b2014-11-18 12:41:16 +0200200bootblock-y += version.c
201romstage-y += version.c
202ramstage-y += version.c
203smm-y += version.c
Aaron Durbinfd6fb262015-05-13 13:37:43 -0500204verstage-y += version.c
Aaron Durbin7f8afe02016-03-18 12:21:23 -0500205postcar-y += version.c
Kyösti Mälkkic36af7b2014-11-18 12:41:16 +0200206
Nico Huber81b09f42016-01-23 00:50:00 +0100207$(call src-to-obj,bootblock,$(dir)/version.c) : $(obj)/build.h
208$(call src-to-obj,romstage,$(dir)/version.c) : $(obj)/build.h
209$(call src-to-obj,ramstage,$(dir)/version.c) : $(obj)/build.h
210$(call src-to-obj,smm,$(dir)/version.c) : $(obj)/build.h
211$(call src-to-obj,verstage,$(dir)/version.c) : $(obj)/build.h
Aaron Durbin7f8afe02016-03-18 12:21:23 -0500212$(call src-to-obj,postcar,$(dir)/version.c) : $(obj)/build.h
Stefan Reinauerba9dae22011-07-29 15:34:14 -0700213
Patrick Georgi58a150a2016-05-02 17:22:29 +0800214$(call src-to-obj,bootblock,$(dir)/cbfs.c) : $(obj)/fmap_config.h
215$(call src-to-obj,romstage,$(dir)/cbfs.c) : $(obj)/fmap_config.h
216$(call src-to-obj,ramstage,$(dir)/cbfs.c) : $(obj)/fmap_config.h
217$(call src-to-obj,smm,$(dir)/cbfs.c) : $(obj)/fmap_config.h
218$(call src-to-obj,verstage,$(dir)/cbfs.c) : $(obj)/fmap_config.h
219$(call src-to-obj,postcar,$(dir)/cbfs.c) : $(obj)/fmap_config.h
220
Aaron Durbinbf1e4812016-05-10 15:12:08 -0500221$(call src-to-obj,bootblock,$(dir)/fmap.c) : $(obj)/fmap_config.h
222$(call src-to-obj,romstage,$(dir)/fmap.c) : $(obj)/fmap_config.h
223$(call src-to-obj,ramstage,$(dir)/fmap.c) : $(obj)/fmap_config.h
224$(call src-to-obj,smm,$(dir)/fmap.c) : $(obj)/fmap_config.h
225$(call src-to-obj,verstage,$(dir)/fmap.c) : $(obj)/fmap_config.h
226$(call src-to-obj,postcar,$(dir)/fmap.c) : $(obj)/fmap_config.h
227
Subrata Banik50b92582016-07-21 23:47:38 +0530228bootblock-y += bootmode.c
Kyösti Mälkki5687fc92013-11-28 18:11:49 +0200229romstage-y += bootmode.c
230ramstage-y += bootmode.c
Aaron Durbin7bc39a02016-01-25 16:58:43 -0600231verstage-y += bootmode.c
Kyösti Mälkki5687fc92013-11-28 18:11:49 +0200232
Julius Werner99f46832018-05-16 14:14:04 -0700233decompressor-y += halt.c
Patrick Georgi1b2f2a02014-11-28 22:00:22 +0100234bootblock-y += halt.c
235romstage-y += halt.c
236ramstage-y += halt.c
237smm-y += halt.c
238
Julius Werner99f46832018-05-16 14:14:04 -0700239decompressor-y += reset.c
Julius Werner01f9aa52017-05-18 16:03:26 -0700240bootblock-y += reset.c
241verstage-y += reset.c
242romstage-y += reset.c
243postcar-y += reset.c
244ramstage-y += reset.c
245smm-y += reset.c
246
Aaron Durbin7f8afe02016-03-18 12:21:23 -0500247postcar-y += bootmode.c
248postcar-y += boot_device.c
249postcar-y += cbfs.c
Aaron Durbin7f8afe02016-03-18 12:21:23 -0500250postcar-y += delay.c
251postcar-y += fmap.c
252postcar-y += gcc.c
253postcar-y += halt.c
254postcar-y += libgcc.c
255postcar-$(CONFIG_COMPRESS_RAMSTAGE) += lzma.c lzmadecode.c
256postcar-y += memchr.c
257postcar-y += memcmp.c
258postcar-y += prog_loaders.c
259postcar-y += prog_ops.c
260postcar-y += rmodule.c
261postcar-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
Aaron Durbin0660d1f2018-01-24 17:16:30 -0700262postcar-$(CONFIG_GENERIC_UDELAY) += timer.c
Aaron Durbin7f8afe02016-03-18 12:21:23 -0500263
Aaron Durbineb907b32016-01-21 00:08:17 -0600264# Use program.ld for all the platforms which use C fo the bootblock.
265bootblock-$(CONFIG_C_ENVIRONMENT_BOOTBLOCK) += program.ld
Aaron Durbin4de29d42015-09-03 22:49:36 -0500266
Julius Werner99f46832018-05-16 14:14:04 -0700267decompressor-y += program.ld
Aaron Durbin7f8afe02016-03-18 12:21:23 -0500268postcar-y += program.ld
Aaron Durbin14714e12015-09-04 12:06:05 -0500269romstage-y += program.ld
Aaron Durbin4de29d42015-09-03 22:49:36 -0500270ramstage-y += program.ld
Aaron Durbine5bad5c2015-09-05 10:27:12 -0500271verstage-y += program.ld
Julius Wernerec5e5e02014-08-20 15:29:56 -0700272
Aaron Durbinad935522012-12-24 14:28:37 -0600273ifeq ($(CONFIG_RELOCATABLE_MODULES),y)
274ramstage-y += rmodule.c
Aaron Durbin8e4a3552013-02-08 17:28:04 -0600275romstage-$(CONFIG_RELOCATABLE_RAMSTAGE) += rmodule.c
Aaron Durbinad935522012-12-24 14:28:37 -0600276
Aaron Durbind4dd44c2015-09-06 10:15:17 -0500277RMODULE_LDFLAGS := -z defs -Bsymbolic
Aaron Durbinad935522012-12-24 14:28:37 -0600278
279# rmodule_link_rules is a function that should be called with:
280# (1) the object name to link
281# (2) the dependencies
282# (3) heap size of the relocatable module
Furquan Shaikh133096b2014-07-31 09:28:55 -0700283# (4) arch for which the rmodules are to be linked
Aaron Durbin3eb8eb72014-03-10 16:13:58 -0500284# It will create the necessary Make rules to create a rmodule. The resulting
285# rmdoule is named $(1).rmod
Aaron Durbinad935522012-12-24 14:28:37 -0600286define rmodule_link
Nico Huber81b09f42016-01-23 00:50:00 +0100287$(strip $(1)): $(strip $(2)) $$(COMPILER_RT_rmodules_$(4)) $(call src-to-obj,rmodules_$(4),src/lib/rmodule.ld) | $$(RMODTOOL)
288 $$(LD_rmodules_$(4)) $$(LDFLAGS_rmodules_$(4)) $(RMODULE_LDFLAGS) -T $(call src-to-obj,rmodules_$(4),src/lib/rmodule.ld) --defsym=__heap_size=$(strip $(3)) -o $$@ --whole-archive --start-group $(filter-out %.ld,$(2)) --end-group
Furquan Shaikh133096b2014-07-31 09:28:55 -0700289 $$(NM_rmodules_$(4)) -n $$@ > $$(basename $$@).map
Aaron Durbinad935522012-12-24 14:28:37 -0600290endef
291
292endif
Aaron Durbin83bc0db2015-09-06 10:45:18 -0500293
294$(objcbfs)/%.debug.rmod: $(objcbfs)/%.debug | $(RMODTOOL)
295 $(RMODTOOL) -i $< -o $@
296
297$(obj)/%.elf.rmod: $(obj)/%.elf | $(RMODTOOL)
298 $(RMODTOOL) -i $< -o $@
Nico Huberc83239e2016-10-05 17:46:49 +0200299
Nico Huberb5679772019-01-01 22:06:01 +0100300ramstage-$(CONFIG_RAMSTAGE_ADA) += cb.ads
301
Nico Huberc83239e2016-10-05 17:46:49 +0200302ifeq ($(CONFIG_RAMSTAGE_LIBHWBASE),y)
303
Nico Huber625160f2017-07-17 23:42:33 +0200304to-ada-hex = $(eval $(1) := 16\\\#$(patsubst 0x%,%,$($(1)))\\\#)
305
306$(call to-ada-hex,CONFIG_HWBASE_DEFAULT_MMCONF)
307
Nico Huberc83239e2016-10-05 17:46:49 +0200308$(call add-special-class,hw)
309hw-handler = $(eval ramstage-srcs += $$(addprefix $(1),$(2)))
Nico Huber625160f2017-07-17 23:42:33 +0200310
311$(call add-special-class,hw-gen)
312hw-gen-handler = \
313 $(eval additional-dirs += $(dir $(2))) \
314 $(eval ramstage-srcs += $(2)) \
315 $(eval ramstage-ads-deps += $(2)) \
316 $(eval ramstage-adb-deps += $(2)) \
317 $(eval $(2): $(obj)/config.h)
318
Nico Huberc83239e2016-10-05 17:46:49 +0200319subdirs-y += ../../3rdparty/libhwbase
320
321ramstage-$(CONFIG_HAVE_MONOTONIC_TIMER) += hw-time-timer.adb
322
323endif # CONFIG_RAMSTAGE_LIBHWBASE
Naresh G Solanki335781a2016-10-26 19:43:14 +0530324
Patrick Georgi0e3c59e2017-01-28 15:59:25 +0100325romstage-y += spd_bin.c
Naresh G Solanki335781a2016-10-26 19:43:14 +0530326
Patrick Georgi0e3c59e2017-01-28 15:59:25 +0100327ifeq ($(CONFIG_GENERIC_SPD_BIN),y)
Naresh G Solanki335781a2016-10-26 19:43:14 +0530328LIB_SPD_BIN = $(obj)/spd.bin
329
330LIB_SPD_DEPS = $(foreach f, $(SPD_SOURCES), src/mainboard/$(MAINBOARDDIR)/spd/$(f).spd.hex)
331
332# Include spd ROM data
333$(LIB_SPD_BIN): $(LIB_SPD_DEPS)
334 for f in $(LIB_SPD_DEPS); \
335 do for c in $$(cat $$f | grep -v ^#); \
336 do printf $$(printf '\%o' 0x$$c); \
337 done; \
338 done > $@
339
340cbfs-files-$(CONFIG_GENERIC_SPD_BIN) += spd.bin
341spd.bin-file := $(LIB_SPD_BIN)
342spd.bin-type := spd
Martin Roth8e4bb312017-01-29 18:11:36 -0700343endif