blob: 56d8b1afd57de8c7dd1a2f870c09389d52827f31 [file] [log] [blame]
Patrick Georgic49d7a32020-05-08 22:50:46 +02001# SPDX-License-Identifier: GPL-2.0-only
2
Nico Huberbe5492a2015-09-29 16:41:19 +02003subdirs-y += gnat
Stefan Reinauer24ef1342011-04-14 22:28:00 +00004
Ryan Salsamendiab37e9a2017-06-11 21:07:31 -07005ifeq ($(CONFIG_UBSAN),y)
6ramstage-y += ubsan.c
7CFLAGS_ramstage += -fsanitize=undefined
8endif
Julius Werner86fc11d2015-10-09 13:37:58 -07009
Harshit Sharma3b9cc852020-07-06 23:38:31 -070010# Ensure that asan_shadow_offset_callback patch is applied to GCC before ASan is used.
11CFLAGS_asan += -fsanitize=kernel-address --param asan-use-shadow-offset-callback=1 \
Harshit Sharmaa6ebe082020-07-20 00:21:05 -070012 --param asan-stack=1 -fsanitize-address-use-after-scope \
Harshit Sharma2bcaba02020-06-09 20:25:16 -070013 --param asan-instrumentation-with-call-threshold=0 \
Harshit Sharma2bcaba02020-06-09 20:25:16 -070014 --param use-after-scope-direct-emission-threshold=0
Harshit Sharmaa6ebe082020-07-20 00:21:05 -070015
16ifeq ($(CONFIG_ASAN_IN_ROMSTAGE),y)
17romstage-y += asan.c
18CFLAGS_asan += --param asan-globals=0
19CFLAGS_romstage += $(CFLAGS_asan)
Harshit Sharma2bcaba02020-06-09 20:25:16 -070020# Allow memory access without __asan_load and __asan_store checks.
Harshit Sharmaa6ebe082020-07-20 00:21:05 -070021$(obj)/romstage/lib/asan.o: CFLAGS_asan =
22endif
23
24ifeq ($(CONFIG_ASAN_IN_RAMSTAGE),y)
25ramstage-y += asan.c
26CFLAGS_asan += --param asan-globals=1
27CFLAGS_ramstage += $(CFLAGS_asan)
Harshit Sharma2bcaba02020-06-09 20:25:16 -070028$(obj)/ramstage/lib/asan.o: CFLAGS_asan =
29endif
30
Julius Werner99f46832018-05-16 14:14:04 -070031decompressor-y += decompressor.c
32$(call src-to-obj,decompressor,$(dir)/decompressor.c): $(objcbfs)/bootblock.lz4
33$(call src-to-obj,decompressor,$(dir)/decompressor.c): CCACHE_EXTRAFILES=$(objcbfs)/bootblock.lz4
34# Must reset CCACHE_EXTRAFILES or make applies it transitively to dependencies.
35$(objcbfs)/bootblock.lz4: CCACHE_EXTRAFILES=
36
37decompressor-y += delay.c
38decompressor-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c
39decompressor-y += memchr.c
40decompressor-y += memcmp.c
Julius Werner6296ca82021-04-02 16:31:21 -070041decompressor-$(CONFIG_CBFS_VERIFICATION) += metadata_hash.c
Julius Werner99f46832018-05-16 14:14:04 -070042decompressor-y += prog_ops.c
43decompressor-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
44
Julius Werner86fc11d2015-10-09 13:37:58 -070045bootblock-y += bootblock.c
Aaron Durbin899d13d2015-05-15 23:39:23 -050046bootblock-y += prog_loaders.c
Aaron Durbinb3847e62015-03-20 15:55:08 -050047bootblock-y += prog_ops.c
Aaron Durbin899d13d2015-05-15 23:39:23 -050048bootblock-y += cbfs.c
David Hendricks6fab3652014-11-06 15:22:10 -080049bootblock-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c
Julius Werner7a8a4ab2015-05-22 16:26:40 -070050bootblock-y += libgcc.c
Karthikeyan Ramasubramanianf19e4612022-09-20 18:59:43 -060051ifneq ($(CONFIG_VBOOT_STARTS_BEFORE_BOOTBLOCK),y)
Julius Wernerfdabf3f2020-05-06 17:06:35 -070052bootblock-$(CONFIG_CBFS_VERIFICATION) += metadata_hash.c
Karthikeyan Ramasubramanianf19e4612022-09-20 18:59:43 -060053else # ($(CONFIG_VBOOT_STARTS_BEFORE_BOOTBLOCK),y)
54verstage-$(CONFIG_CBFS_VERIFICATION) += metadata_hash.c
55endif # ($(CONFIG_VBOOT_STARTS_BEFORE_BOOTBLOCK),y)
Aaron Durbine5e36302014-09-25 10:05:15 -050056bootblock-$(CONFIG_GENERIC_UDELAY) += timer.c
57
Patrick Georgi8b174042015-04-27 18:03:50 +020058bootblock-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
Paul Menzel2ea25552015-10-13 17:30:57 +020059
Kyösti Mälkki8659e402014-12-21 08:55:47 +020060bootblock-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
Patrick Georgib0a2d3c22016-01-19 18:10:55 +010061bootblock-y += delay.c
Hung-Te Linfe187922013-02-01 01:09:24 +080062bootblock-y += memchr.c
Hung-Te Linfe187922013-02-01 01:09:24 +080063bootblock-y += memcmp.c
Aaron Durbinc6588c52015-05-15 13:15:34 -050064bootblock-y += boot_device.c
Aaron Durbin0424c952015-03-28 23:56:22 -050065bootblock-y += fmap.c
Hung-Te Linfe187922013-02-01 01:09:24 +080066
Aaron Durbin899d13d2015-05-15 23:39:23 -050067verstage-y += prog_loaders.c
Aaron Durbinb3847e62015-03-20 15:55:08 -050068verstage-y += prog_ops.c
Daisuke Nojiribcc1d422014-06-19 19:16:24 -070069verstage-y += delay.c
70verstage-y += cbfs.c
Aaron Durbin17200ad2015-05-01 16:48:54 -050071verstage-y += halt.c
Aaron Durbin0424c952015-03-28 23:56:22 -050072verstage-y += fmap.c
Julius Werner7a8a4ab2015-05-22 16:26:40 -070073verstage-y += libgcc.c
Daisuke Nojiribcc1d422014-06-19 19:16:24 -070074verstage-y += memcmp.c
Patrick Georgi19d04382019-06-18 23:28:57 +020075verstage-y += string.c
Martin Rothd09b9742020-06-10 14:57:35 -060076
Patrick Georgi8b174042015-04-27 18:03:50 +020077verstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
Aaron Durbinc6588c52015-05-15 13:15:34 -050078verstage-y += boot_device.c
Daisuke Nojiribcc1d422014-06-19 19:16:24 -070079verstage-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
Yen Lin5bdbd002015-04-08 16:55:17 -070080
Vadim Bendebury3486d1f2014-10-16 11:24:12 -070081verstage-$(CONFIG_GENERIC_UDELAY) += timer.c
David Hendricks6fab3652014-11-06 15:22:10 -080082verstage-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c
Daisuke Nojiribcc1d422014-06-19 19:16:24 -070083
Naresh Solanki933d2b02023-12-08 16:58:52 +053084romstage-$(CONFIG_PROBE_RAM) += ramdetect.c
Aaron Durbin899d13d2015-05-15 23:39:23 -050085romstage-y += prog_loaders.c
Aaron Durbinb3847e62015-03-20 15:55:08 -050086romstage-y += prog_ops.c
Gabe Black1025f3a2011-09-16 02:18:56 -070087romstage-y += memchr.c
Stefan Reinauer24ef1342011-04-14 22:28:00 +000088romstage-y += memcmp.c
Furquan Shaikh133096b2014-07-31 09:28:55 -070089$(foreach arch,$(ARCH_SUPPORTED),\
Julius Wernerec5e5e02014-08-20 15:29:56 -070090 $(eval rmodules_$(arch)-y += memcmp.c) \
91 $(eval rmodules_$(arch)-y += rmodule.ld))
Furquan Shaikh133096b2014-07-31 09:28:55 -070092
Aaron Durbin0424c952015-03-28 23:56:22 -050093romstage-y += fmap.c
Patrick Georgi82d9a312016-01-21 12:46:10 +010094romstage-y += delay.c
Aaron Durbin899d13d2015-05-15 23:39:23 -050095romstage-y += cbfs.c
Martin Roth03511b42023-01-04 18:47:32 -070096ifneq ($(CONFIG_COMPRESS_RAMSTAGE_LZMA)$(CONFIG_FSP_COMPRESS_FSP_M_LZMA),)
97romstage-y += lzma.c lzmadecode.c
98endif
Julius Werner7a8a4ab2015-05-22 16:26:40 -070099romstage-y += libgcc.c
Aaron Durbin5fbe12d2016-07-17 22:59:47 -0500100romstage-y += memrange.c
David Hendricks560c6432014-02-13 13:07:50 -0800101romstage-$(CONFIG_PRIMITIVE_MEMTEST) += primitive_memtest.c
102ramstage-$(CONFIG_PRIMITIVE_MEMTEST) += primitive_memtest.c
Kyösti Mälkki321bce42019-03-20 19:53:44 +0200103romstage-y += ramtest.c
David Hendricks6fab3652014-11-06 15:22:10 -0800104romstage-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c
Aaron Durbincd0bc982016-11-19 12:36:09 -0600105ramstage-y += region_file.c
106romstage-y += region_file.c
Aaron Durbinafe8aee2016-11-29 21:37:42 -0600107ramstage-y += romstage_handoff.c
108romstage-y += romstage_handoff.c
Ronald G. Minnich3d8e53f2018-10-29 09:58:06 -0700109romstage-y += selfboot.c
Julius Werner7dcf9d52015-10-16 13:10:02 -0700110romstage-y += stack.c
Shelley Chenafaa3d02020-10-06 15:50:21 -0700111romstage-y += rtc.c
Simon Glass2cf99e12016-06-10 20:58:24 -0600112ramstage-y += rtc.c
Vladimir Serbinenko45988da2013-03-30 02:02:13 +0100113
Aaron Durbinc15551a2013-03-23 00:00:54 -0500114romstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
Kyösti Mälkkia2f6af32013-09-10 13:50:32 +0300115romstage-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
Denis 'GNUtoo' Carikli8a0a8482013-06-20 16:24:14 +0200116
Subrata Banik3afa4672021-10-27 20:53:49 +0530117romstage-y += dimm_info_util.c
Patrick Georgi6d0cba72014-11-29 11:32:12 +0100118ifeq ($(CONFIG_COMPILER_GCC),y)
Alexandru Gagniuc66bbb312015-10-06 16:35:07 -0700119bootblock-$(CONFIG_ARCH_BOOTBLOCK_X86_32) += gcc.c
Aaron Durbin75c51d92015-09-29 16:31:20 -0500120verstage-$(CONFIG_ARCH_VERSTAGE_X86_32) += gcc.c
Furquan Shaikh99ac98f2014-04-23 10:18:48 -0700121romstage-$(CONFIG_ARCH_ROMSTAGE_X86_32) += gcc.c
Edward O'Callaghan4ba8ba42014-05-23 01:29:00 +1000122ramstage-$(CONFIG_ARCH_RAMSTAGE_X86_32) += gcc.c
Subrata Banik27618472019-05-30 18:28:59 +0530123smm-y += gcc.c
Edward O'Callaghan4ba8ba42014-05-23 01:29:00 +1000124endif
Stefan Reinauer24ef1342011-04-14 22:28:00 +0000125
Aaron Durbine5e36302014-09-25 10:05:15 -0500126romstage-$(CONFIG_GENERIC_UDELAY) += timer.c
127
Naresh Solanki933d2b02023-12-08 16:58:52 +0530128ramstage-$(CONFIG_PROBE_RAM) += ramdetect.c
Aaron Durbin899d13d2015-05-15 23:39:23 -0500129ramstage-y += prog_loaders.c
Aaron Durbinb3847e62015-03-20 15:55:08 -0500130ramstage-y += prog_ops.c
Stefan Reinauer1e753292012-11-30 12:23:45 -0800131ramstage-y += hardwaremain.c
132ramstage-y += selfboot.c
Stefan Reinauer3e4e3032013-03-20 14:08:04 -0700133ramstage-y += coreboot_table.c
Benjamin Doronea13dc32023-06-20 12:21:27 -0400134ramstage-$(CONFIG_GENERATE_SMBIOS_TABLES) += smbios.c
135ramstage-$(CONFIG_GENERATE_SMBIOS_TABLES) += smbios_defaults.c
Aaron Durbin49048022014-02-18 21:55:02 -0600136ramstage-y += bootmem.c
Aaron Durbin0424c952015-03-28 23:56:22 -0500137ramstage-y += fmap.c
Gabe Black1025f3a2011-09-16 02:18:56 -0700138ramstage-y += memchr.c
Patrick Georgi8463dd92010-09-30 16:55:02 +0000139ramstage-y += memcmp.c
Patrick Georgi8463dd92010-09-30 16:55:02 +0000140ramstage-y += malloc.c
Raul E Rangel21db6cc2018-03-29 10:18:14 -0600141ramstage-y += dimm_info_util.c
Patrick Georgi8463dd92010-09-30 16:55:02 +0000142ramstage-y += delay.c
143ramstage-y += fallback_boot.c
Aaron Durbin899d13d2015-05-15 23:39:23 -0500144ramstage-y += cbfs.c
Edward O'Callaghancd31afd2014-11-11 12:27:06 +1100145ramstage-y += lzma.c lzmadecode.c
Ronald G. Minnich9764d4c2012-06-12 16:29:32 -0700146ramstage-y += stack.c
Duncan Laurieb9552842016-05-09 10:58:03 -0700147ramstage-y += hexstrtobin.c
Felix Durairaj7f761652015-11-20 15:51:35 -0800148ramstage-y += wrdd.c
Vadim Bendebury3e316002011-09-30 12:02:18 -0700149ramstage-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
Kyösti Mälkki4949a3d2021-01-09 20:38:43 +0200150ramstage-$(CONFIG_BMP_LOGO) += bmp_logo.c
Johanna Schanderdb7a3ae2019-07-24 10:14:26 +0200151ramstage-$(CONFIG_BOOTSPLASH) += bootsplash.c
Stefan Reinauer24ef1342011-04-14 22:28:00 +0000152ramstage-$(CONFIG_BOOTSPLASH) += jpeg.c
Vadim Bendebury6f72d692011-09-21 16:12:39 -0700153ramstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
Stefan Reinauerd37ab452012-12-18 16:23:28 -0800154ramstage-$(CONFIG_COVERAGE) += libgcov.c
xuxinxiongcb3745c2021-10-26 20:16:21 +0800155ramstage-y += dp_aux.c
Arthur Heymansa459a8a2017-04-30 08:26:27 +0200156ramstage-y += edid.c
Nico Huber3db76532017-05-18 18:07:34 +0200157ramstage-y += edid_fill_fb.c
Aaron Durbina05a8522013-03-22 20:44:46 -0500158ramstage-y += memrange.c
David Hendricks3b11de82014-11-05 14:05:56 -0800159ramstage-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c
Aaron Durbine5e36302014-09-25 10:05:15 -0500160ramstage-$(CONFIG_GENERIC_UDELAY) += timer.c
Vadim Bendebury243c6142015-03-27 16:08:04 -0700161ramstage-y += b64_decode.c
Aaron Durbin9420a522015-11-17 16:31:00 -0600162ramstage-$(CONFIG_ACPI_NHLT) += nhlt.c
Patrick Rudolpha892cde2018-04-19 14:39:07 +0200163ramstage-$(CONFIG_PAYLOAD_FIT_SUPPORT) += fit.c
164ramstage-$(CONFIG_PAYLOAD_FIT_SUPPORT) += fit_payload.c
Stefan Reinauer16ce01b2011-01-28 08:05:54 +0000165
Raul E Rangelca0606e2021-07-21 14:34:00 -0600166romstage-$(CONFIG_TIMER_QUEUE) += timer_queue.c
167ramstage-$(CONFIG_TIMER_QUEUE) += timer_queue.c
168
169romstage-$(CONFIG_COOP_MULTITASKING) += thread.c
170ramstage-$(CONFIG_COOP_MULTITASKING) += thread.c
171
Aaron Durbin0dff57d2015-03-05 21:18:33 -0600172romstage-y += cbmem_common.c
173romstage-y += imd_cbmem.c
Aaron Durbin7f8afe02016-03-18 12:21:23 -0500174romstage-y += imd.c
Aaron Durbin0dff57d2015-03-05 21:18:33 -0600175
176ramstage-y += cbmem_common.c
177ramstage-y += imd_cbmem.c
Aaron Durbin20686d82015-03-05 14:11:27 -0600178ramstage-y += imd.c
179
Naresh Solanki933d2b02023-12-08 16:58:52 +0530180postcar-$(CONFIG_PROBE_RAM) += ramdetect.c
Aaron Durbin7f8afe02016-03-18 12:21:23 -0500181postcar-y += cbmem_common.c
Aaron Durbin1e9a9142016-09-16 16:23:21 -0500182postcar-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
Aaron Durbin7f8afe02016-03-18 12:21:23 -0500183postcar-y += imd_cbmem.c
184postcar-y += imd.c
Aaron Durbinafe8aee2016-11-29 21:37:42 -0600185postcar-y += romstage_handoff.c
Aaron Durbin7f8afe02016-03-18 12:21:23 -0500186
Alexandru Gagniuce223e892015-10-14 09:58:36 -0700187bootblock-y += hexdump.c
Frans Hendriksd6225072019-05-21 11:04:50 +0200188postcar-y += hexdump.c
Stefan Reinauer2f38b072013-07-18 16:24:08 -0700189ramstage-y += hexdump.c
190romstage-y += hexdump.c
Duncan Laurie7fbdad82016-09-07 10:56:25 -0700191verstage-y += hexdump.c
John E. Kabat Jrd45011c2017-09-29 11:23:35 -0600192smm-y += hexdump.c
Stefan Reinauer2f38b072013-07-18 16:24:08 -0700193
Duncan Laurie36e6c6f2020-05-09 19:20:10 -0700194bootblock-$(CONFIG_FW_CONFIG) += fw_config.c
195verstage-$(CONFIG_FW_CONFIG) += fw_config.c
196romstage-$(CONFIG_FW_CONFIG) += fw_config.c
197ramstage-$(CONFIG_FW_CONFIG) += fw_config.c
198
Furquan Shaikh5cc41f22020-05-11 12:11:27 -0700199bootblock-$(CONFIG_ESPI_DEBUG) += espi_debug.c
200verstage-$(CONFIG_ESPI_DEBUG) += espi_debug.c
201romstage-$(CONFIG_ESPI_DEBUG) += espi_debug.c
202ramstage-$(CONFIG_ESPI_DEBUG) += espi_debug.c
203
Lee Leahy7a29cdc2016-06-05 18:49:55 -0700204bootblock-$(CONFIG_REG_SCRIPT) += reg_script.c
Aaron Durbin75c51d92015-09-29 16:31:20 -0500205verstage-$(CONFIG_REG_SCRIPT) += reg_script.c
Isaac Christensen0b4e8df2014-10-01 11:50:20 -0600206romstage-$(CONFIG_REG_SCRIPT) += reg_script.c
Duncan Laurie72748002013-10-31 08:26:23 -0700207ramstage-$(CONFIG_REG_SCRIPT) += reg_script.c
208
Kyösti Mälkki0a4457f2019-08-01 20:29:14 +0300209ramstage-$(CONFIG_TSEG_STAGE_CACHE) += ext_stage_cache.c
210romstage-$(CONFIG_TSEG_STAGE_CACHE) += ext_stage_cache.c
211postcar-$(CONFIG_TSEG_STAGE_CACHE) += ext_stage_cache.c
Aaron Durbinbd74a4b2015-03-06 23:17:33 -0600212
Kyösti Mälkki0a4457f2019-08-01 20:29:14 +0300213ramstage-$(CONFIG_CBMEM_STAGE_CACHE) += cbmem_stage_cache.c
214romstage-$(CONFIG_CBMEM_STAGE_CACHE) += cbmem_stage_cache.c
215postcar-$(CONFIG_CBMEM_STAGE_CACHE) += cbmem_stage_cache.c
Aaron Durbin127525c2015-03-26 12:29:12 -0500216
Aaron Durbinc6588c52015-05-15 13:15:34 -0500217romstage-y += boot_device.c
218ramstage-y += boot_device.c
Aaron Durbin75e29742013-10-10 20:37:04 -0500219
Aaron Durbinc6588c52015-05-15 13:15:34 -0500220smm-y += boot_device.c
Furquan Shaikh591be2d2018-03-01 15:20:20 -0800221smm-y += delay.c
Aaron Durbin0424c952015-03-28 23:56:22 -0500222smm-y += fmap.c
Aaron Durbin899d13d2015-05-15 23:39:23 -0500223smm-y += cbfs.c memcmp.c
Aaron Durbin0660d1f2018-01-24 17:16:30 -0700224smm-$(CONFIG_GENERIC_UDELAY) += timer.c
Raul E Rangelc5160982022-02-24 16:02:49 -0700225ifeq ($(CONFIG_DEBUG_SMI),y)
226smm-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
227endif
Stefan Reinauere9f32582010-03-29 13:04:13 +0000228
Kyösti Mälkkia9dd3c32022-12-15 22:12:10 +0200229all-y += identity.c version.c
230smm-y += identity.c version.c
Kyösti Mälkkic36af7b2014-11-18 12:41:16 +0200231
Nico Huber81b09f42016-01-23 00:50:00 +0100232$(call src-to-obj,bootblock,$(dir)/version.c) : $(obj)/build.h
233$(call src-to-obj,romstage,$(dir)/version.c) : $(obj)/build.h
234$(call src-to-obj,ramstage,$(dir)/version.c) : $(obj)/build.h
235$(call src-to-obj,smm,$(dir)/version.c) : $(obj)/build.h
236$(call src-to-obj,verstage,$(dir)/version.c) : $(obj)/build.h
Aaron Durbin7f8afe02016-03-18 12:21:23 -0500237$(call src-to-obj,postcar,$(dir)/version.c) : $(obj)/build.h
Stefan Reinauerba9dae22011-07-29 15:34:14 -0700238
Subrata Banik50b92582016-07-21 23:47:38 +0530239bootblock-y += bootmode.c
Kyösti Mälkki5687fc92013-11-28 18:11:49 +0200240romstage-y += bootmode.c
241ramstage-y += bootmode.c
Aaron Durbin7bc39a02016-01-25 16:58:43 -0600242verstage-y += bootmode.c
Kyösti Mälkki5687fc92013-11-28 18:11:49 +0200243
Julius Werner99f46832018-05-16 14:14:04 -0700244decompressor-y += halt.c
Patrick Georgi1b2f2a02014-11-28 22:00:22 +0100245bootblock-y += halt.c
246romstage-y += halt.c
247ramstage-y += halt.c
248smm-y += halt.c
249
Julius Werner99f46832018-05-16 14:14:04 -0700250decompressor-y += reset.c
Julius Werner01f9aa52017-05-18 16:03:26 -0700251bootblock-y += reset.c
252verstage-y += reset.c
253romstage-y += reset.c
254postcar-y += reset.c
255ramstage-y += reset.c
256smm-y += reset.c
257
Julius Wernera66c9b82019-05-20 14:53:47 -0700258decompressor-y += string.c
259bootblock-y += string.c
260verstage-y += string.c
261romstage-y += string.c
262postcar-y += string.c
263ramstage-y += string.c
264smm-y += string.c
265
Xiang Wang4e39c822019-11-05 12:00:39 +0800266decompressor-y += crc_byte.c
267bootblock-y += crc_byte.c
268verstage-y += crc_byte.c
269romstage-y += crc_byte.c
270postcar-y += crc_byte.c
271ramstage-y += crc_byte.c
272smm-y += crc_byte.c
273
Fred Reitberger2a099f12022-09-01 14:58:44 -0400274romstage-y += xxhash.c
275ramstage-y += xxhash.c
276
Aaron Durbin7f8afe02016-03-18 12:21:23 -0500277postcar-y += bootmode.c
278postcar-y += boot_device.c
279postcar-y += cbfs.c
Aaron Durbin7f8afe02016-03-18 12:21:23 -0500280postcar-y += delay.c
281postcar-y += fmap.c
282postcar-y += gcc.c
283postcar-y += halt.c
284postcar-y += libgcc.c
Martin Roth40729a52023-01-04 17:26:21 -0700285postcar-$(CONFIG_COMPRESS_RAMSTAGE_LZMA) += lzma.c lzmadecode.c
Aaron Durbin7f8afe02016-03-18 12:21:23 -0500286postcar-y += memchr.c
287postcar-y += memcmp.c
288postcar-y += prog_loaders.c
289postcar-y += prog_ops.c
290postcar-y += rmodule.c
291postcar-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
Aaron Durbin0660d1f2018-01-24 17:16:30 -0700292postcar-$(CONFIG_GENERIC_UDELAY) += timer.c
Aaron Durbin7f8afe02016-03-18 12:21:23 -0500293
Aaron Durbineb907b32016-01-21 00:08:17 -0600294# Use program.ld for all the platforms which use C fo the bootblock.
Arthur Heymansc05b1a62019-11-22 21:01:30 +0100295bootblock-y += program.ld
Aaron Durbin4de29d42015-09-03 22:49:36 -0500296
Julius Werner99f46832018-05-16 14:14:04 -0700297decompressor-y += program.ld
Aaron Durbin7f8afe02016-03-18 12:21:23 -0500298postcar-y += program.ld
Aaron Durbin14714e12015-09-04 12:06:05 -0500299romstage-y += program.ld
Aaron Durbin4de29d42015-09-03 22:49:36 -0500300ramstage-y += program.ld
Aaron Durbine5bad5c2015-09-05 10:27:12 -0500301verstage-y += program.ld
Julius Wernerec5e5e02014-08-20 15:29:56 -0700302
Aaron Durbinad935522012-12-24 14:28:37 -0600303ifeq ($(CONFIG_RELOCATABLE_MODULES),y)
304ramstage-y += rmodule.c
Subrata Banik27618472019-05-30 18:28:59 +0530305romstage-y += rmodule.c
Aaron Durbinad935522012-12-24 14:28:37 -0600306
Aaron Durbind4dd44c2015-09-06 10:15:17 -0500307RMODULE_LDFLAGS := -z defs -Bsymbolic
Aaron Durbinad935522012-12-24 14:28:37 -0600308
309# rmodule_link_rules is a function that should be called with:
310# (1) the object name to link
311# (2) the dependencies
Arthur Heymans7fbef1b2024-02-22 15:01:04 +0100312# (3) arch for which the rmodules are to be linked
Aaron Durbin3eb8eb72014-03-10 16:13:58 -0500313# It will create the necessary Make rules to create a rmodule. The resulting
314# rmdoule is named $(1).rmod
Aaron Durbinad935522012-12-24 14:28:37 -0600315define rmodule_link
Arthur Heymans7fbef1b2024-02-22 15:01:04 +0100316$(strip $(1)): $(strip $(2)) $$(COMPILER_RT_rmodules_$(3)) $(call src-to-obj,rmodules_$(3),src/lib/rmodule.ld) | $$(RMODTOOL)
317 $$(LD_rmodules_$(3)) $$(LDFLAGS_rmodules_$(3)) $(RMODULE_LDFLAGS) $($(1)-ldflags) -T $(call src-to-obj,rmodules_$(3),src/lib/rmodule.ld) -o $$@ --whole-archive --start-group $(filter-out %.ld,$(2)) --end-group
318 $$(NM_rmodules_$(3)) -n $$@ > $$(basename $$@).map
Aaron Durbinad935522012-12-24 14:28:37 -0600319endef
320
321endif
Aaron Durbin83bc0db2015-09-06 10:45:18 -0500322
323$(objcbfs)/%.debug.rmod: $(objcbfs)/%.debug | $(RMODTOOL)
324 $(RMODTOOL) -i $< -o $@
325
326$(obj)/%.elf.rmod: $(obj)/%.elf | $(RMODTOOL)
327 $(RMODTOOL) -i $< -o $@
Nico Huberc83239e2016-10-05 17:46:49 +0200328
Jeremy Compostellafa838872022-11-30 19:26:01 -0700329romstage-$(CONFIG_ROMSTAGE_ADA) += cb.ads
Nico Huberb5679772019-01-01 22:06:01 +0100330ramstage-$(CONFIG_RAMSTAGE_ADA) += cb.ads
331
Jeremy Compostella50139d02022-12-01 15:07:51 -0700332ifneq (,$(filter y, $(CONFIG_RAMSTAGE_LIBHWBASE) $(CONFIG_ROMSTAGE_LIBHWBASE)))
Nico Huberc83239e2016-10-05 17:46:49 +0200333
Nico Huber625160f2017-07-17 23:42:33 +0200334to-ada-hex = $(eval $(1) := 16\\\#$(patsubst 0x%,%,$($(1)))\\\#)
335
336$(call to-ada-hex,CONFIG_HWBASE_DEFAULT_MMCONF)
337
Jeremy Compostella50139d02022-12-01 15:07:51 -0700338libhwbase-stages = $(foreach stage, romstage ramstage, \
339 $(if $(filter y,$(CONFIG_$(call toupper,$(stage))_LIBHWBASE)),$(stage)))
340
Nico Huberc83239e2016-10-05 17:46:49 +0200341$(call add-special-class,hw)
Jeremy Compostella50139d02022-12-01 15:07:51 -0700342hw-handler +=$(foreach stage, $(libhwbase-stages), \
343 $(eval $(stage)-srcs += $$(addprefix $(1),$(2))))
Nico Huber625160f2017-07-17 23:42:33 +0200344
345$(call add-special-class,hw-gen)
346hw-gen-handler = \
347 $(eval additional-dirs += $(dir $(2))) \
Jeremy Compostella50139d02022-12-01 15:07:51 -0700348 $(foreach stage, $(libhwbase-stages), \
349 $(eval $(stage)-srcs += $(2)) \
350 $(eval $(stage)-ads-deps += $(2)) \
351 $(eval $(stage)-adb-deps += $(2))) \
Nico Huber625160f2017-07-17 23:42:33 +0200352 $(eval $(2): $(obj)/config.h)
353
Nico Huberc83239e2016-10-05 17:46:49 +0200354subdirs-y += ../../3rdparty/libhwbase
355
Jeremy Compostella50139d02022-12-01 15:07:51 -0700356$(foreach stage,$(libhwbase-stages), \
357 $(eval $(stage)-$(CONFIG_HAVE_MONOTONIC_TIMER) += hw-time-timer.adb))
Nico Huberc83239e2016-10-05 17:46:49 +0200358
Jeremy Compostella50139d02022-12-01 15:07:51 -0700359endif # CONFIG_ROMSTAGE_LIBHWBASE || CONFIG_RAMSTAGE_LIBHWBASE
Naresh G Solanki335781a2016-10-26 19:43:14 +0530360
Patrick Georgi0e3c59e2017-01-28 15:59:25 +0100361romstage-y += spd_bin.c
Naresh G Solanki335781a2016-10-26 19:43:14 +0530362
Michael Niewöhner87cc8892020-09-07 14:26:09 +0200363ifeq ($(CONFIG_HAVE_SPD_IN_CBFS),y)
Naresh G Solanki335781a2016-10-26 19:43:14 +0530364LIB_SPD_BIN = $(obj)/spd.bin
365
366LIB_SPD_DEPS = $(foreach f, $(SPD_SOURCES), src/mainboard/$(MAINBOARDDIR)/spd/$(f).spd.hex)
367
368# Include spd ROM data
369$(LIB_SPD_BIN): $(LIB_SPD_DEPS)
Michael Niewöhnereb662332020-09-06 17:06:40 +0200370 test -n "$(SPD_SOURCES)" || \
Paul Fagerburg96fd5292020-09-25 08:39:15 -0600371 (echo "HAVE_SPD_IN_CBFS is set but SPD_SOURCES is empty" && exit 1)
Michael Niewöhnereb662332020-09-06 17:06:40 +0200372 test -n "$(LIB_SPD_DEPS)" || \
373 (echo "SPD_SOURCES is set but no SPD file was found" && exit 1)
Reka Normanbdc49b22021-09-21 14:29:24 +1000374 if [ "$(SPD_SOURCES)" = "placeholder" ]; then \
375 printf '\0'; \
376 else \
377 for f in $(LIB_SPD_DEPS); do \
378 if [ ! -f $$f ]; then \
379 echo "File not found: $$f" >&2; \
380 exit 1; \
381 fi; \
382 for c in $$(cat $$f | grep --binary-files=text -v ^#); \
383 do printf $$(printf '\\%o' 0x$$c); \
384 done; \
Reka Norman16612c42021-09-16 14:11:34 +1000385 done; \
Reka Normanbdc49b22021-09-21 14:29:24 +1000386 fi > $@
Naresh G Solanki335781a2016-10-26 19:43:14 +0530387
Michael Niewöhnerc521d152020-09-07 21:39:43 +0200388cbfs-files-y += spd.bin
Naresh G Solanki335781a2016-10-26 19:43:14 +0530389spd.bin-file := $(LIB_SPD_BIN)
390spd.bin-type := spd
Martin Roth8e4bb312017-01-29 18:11:36 -0700391endif
Nico Huber2e6a0f82019-10-24 15:01:33 +0200392
393ramstage-y += uuid.c
Jamie Chen92ba06f2020-04-27 15:49:09 +0800394
Matt DeVillier8ead1dc2020-11-30 14:30:15 -0600395romstage-$(CONFIG_SPD_CACHE_IN_FMAP) += spd_cache.c
Arthur Heymans75226bb2022-03-30 20:16:36 +0200396
397cbfs-files-y += cbfs_master_header
398cbfs_master_header-file := cbfs_master_header.c:struct
399cbfs_master_header-type := "cbfs header"
400cbfs_master_header-position := 0
401
Felix Held87a9d8f2023-06-22 16:16:45 +0200402bootblock-$(CONFIG_ARCH_X86) += master_header_pointer.c
Arthur Heymans2efd8312022-05-18 21:37:58 +0200403
404NEED_CBFS_POINTER=
405
406ifneq ($(CONFIG_ARCH_X86),y)
407NEED_CBFS_POINTER=y
408endif
409ifneq ($(CONFIG_BOOTBLOCK_IN_CBFS),y)
410NEED_CBFS_POINTER=y
411endif
412
413cbfs-files-$(NEED_CBFS_POINTER) += header_pointer
Arthur Heymans75226bb2022-03-30 20:16:36 +0200414header_pointer-file := master_header_pointer.c:struct
415header_pointer-position := -4
416header_pointer-type := "cbfs header"
Hsuan Ting Chen3c2cdb62023-05-02 17:55:50 +0800417
418romstage-y += ux_locales.c