blob: e2170f5d40b22d6db8c33ceab0bdb30a03b1300b [file] [log] [blame]
Alexandru Gagniuc00b579a2012-07-20 00:11:21 -05001################################################################################
Stefan Reinauer30584912010-08-14 20:38:17 +00002##
3## This file is part of the coreboot project.
4##
Alexandru Gagniuc00b579a2012-07-20 00:11:21 -05005## Copyright (C) 2012 Alexandru Gagniuc <mr.nuke.me@gmail.com>
Stefan Reinauer30584912010-08-14 20:38:17 +00006## Copyright (C) 2009-2010 coresystems GmbH
7## Copyright (C) 2009 Ronald G. Minnich
8##
9## This program is free software; you can redistribute it and/or modify
10## it under the terms of the GNU General Public License as published by
11## the Free Software Foundation; version 2 of the License.
12##
13## This program is distributed in the hope that it will be useful,
14## but WITHOUT ANY WARRANTY; without even the implied warranty of
15## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16## GNU General Public License for more details.
17##
18## You should have received a copy of the GNU General Public License
19## along with this program; if not, write to the Free Software
Paul Menzela46a7122013-02-23 18:37:27 +010020## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Stefan Reinauer30584912010-08-14 20:38:17 +000021##
Furquan Shaikh88ca81a2014-04-22 16:33:22 -070022###############################################################################
Patrick Georgi0588d192009-08-12 15:00:51 +000023# Take care of subdirectories
Furquan Shaikh88ca81a2014-04-22 16:33:22 -070024###############################################################################
Patrick Georgi0588d192009-08-12 15:00:51 +000025subdirs-y += boot
Stefan Reinauere3778572010-01-30 09:47:18 +000026# subdirs-y += init
Patrick Georgi0588d192009-08-12 15:00:51 +000027subdirs-y += lib
28subdirs-y += smp
29
Edward O'Callaghanb0195a32014-05-23 01:32:44 +100030DISASSEMBLY=-Wa,--divide
Patrick Georgi327a8662014-01-18 16:26:11 +010031
Patrick Georgi70a6b4f2015-03-27 14:14:58 +010032################################################################################
33# i386 specific tools
34NVRAMTOOL:=$(objutil)/nvramtool/nvramtool
35
Patrick Georgi8463dd92010-09-30 16:55:02 +000036OPTION_TABLE_H:=
37ifeq ($(CONFIG_HAVE_OPTION_TABLE),y)
Patrick Georgi70a6b4f2015-03-27 14:14:58 +010038
Patrick Georgi5c0bca22011-01-30 16:31:15 +000039cbfs-files-y += cmos_layout.bin
40cmos_layout.bin-file = $(obj)/cmos_layout.bin
41cmos_layout.bin-type = 0x01aa
Patrick Georgi24479372011-01-18 13:56:36 +000042
Patrick Georgi70a6b4f2015-03-27 14:14:58 +010043$(obj)/cmos_layout.bin: $(NVRAMTOOL) $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout
44 @printf " OPTION $(subst $(obj)/,,$(@))\n"
45 $(NVRAMTOOL) -y $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout -L $@
46
Patrick Georgi8463dd92010-09-30 16:55:02 +000047OPTION_TABLE_H:=$(obj)/option_table.h
Patrick Georgi70a6b4f2015-03-27 14:14:58 +010048
49$(OPTION_TABLE_H): $(NVRAMTOOL) $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout
50 @printf " OPTION $(subst $(obj)/,,$(@))\n"
51 $(NVRAMTOOL) -y $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout -H $@
52endif # CONFIG_HAVE_OPTION_TABLE
Patrick Georgi0588d192009-08-12 15:00:51 +000053
Patrick Georgiff9d78c2011-01-30 16:37:39 +000054stripped_vgabios_id = $(call strip_quotes,$(CONFIG_VGA_BIOS_ID))
55cbfs-files-$(CONFIG_VGA_BIOS) += pci$(stripped_vgabios_id).rom
56pci$(stripped_vgabios_id).rom-file := $(call strip_quotes,$(CONFIG_VGA_BIOS_FILE))
57pci$(stripped_vgabios_id).rom-type := optionrom
58
59cbfs-files-$(CONFIG_INTEL_MBI) += mbi.bin
60mbi.bin-file := $(call strip_quotes,$(CONFIG_MBI_FILE))
61mbi.bin-type := mbi
62
Furquan Shaikh99ac98f2014-04-23 10:18:48 -070063ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32),y)
Furquan Shaikh88ca81a2014-04-22 16:33:22 -070064CBFSTOOL_PRE1_OPTS = -m x86 -o $$(( $(CONFIG_ROM_SIZE) - $(CONFIG_CBFS_SIZE) ))
Furquan Shaikhb4ce4d42014-10-30 11:47:20 -070065# Make sure that segment for .car.data is ignored while adding romstage.
66CBFSTOOL_PRE_OPTS = -b $(shell cat $(objcbfs)/base_xip.txt) -S ".car.data"
Furquan Shaikh99ac98f2014-04-23 10:18:48 -070067endif
Patrick Georgiff9d78c2011-01-30 16:37:39 +000068
Kyösti Mälkki0db2ae3a2012-04-19 12:00:06 +030069
Furquan Shaikh88ca81a2014-04-22 16:33:22 -070070###############################################################################
71# bootblock
72###############################################################################
Patrick Georgi641dd712011-11-01 18:55:59 +010073
Furquan Shaikh99ac98f2014-04-23 10:18:48 -070074ifeq ($(CONFIG_ARCH_BOOTBLOCK_X86_32),y)
75
Patrick Georgif1df82a2015-04-03 10:12:40 +020076bootblock_lds = $(src)/arch/x86/init/failover.ld
Patrick Georgiea9f3082015-03-27 13:50:11 +010077bootblock_lds += $(src)/cpu/x86/16bit/entry16.ld
78bootblock_lds += $(src)/cpu/x86/16bit/reset16.ld
79bootblock_lds += $(src)/arch/x86/lib/id.ld
Patrick Georgi641dd712011-11-01 18:55:59 +010080bootblock_lds += $(chipset_bootblock_lds)
Aaron Durbin6dccedd2012-12-03 16:17:40 -060081ifeq ($(CONFIG_CPU_INTEL_FIRMWARE_INTERFACE_TABLE),y)
Patrick Georgiea9f3082015-03-27 13:50:11 +010082bootblock_lds += $(src)/cpu/intel/fit/fit.ld
Aaron Durbin6dccedd2012-12-03 16:17:40 -060083endif
Patrick Georgi641dd712011-11-01 18:55:59 +010084
85bootblock_inc = $(src)/arch/x86/init/prologue.inc
86bootblock_inc += $(src)/cpu/x86/16bit/entry16.inc
87bootblock_inc += $(src)/cpu/x86/16bit/reset16.inc
88bootblock_inc += $(src)/cpu/x86/32bit/entry32.inc
89bootblock_inc += $(src)/arch/x86/lib/id.inc
Aaron Durbin6dccedd2012-12-03 16:17:40 -060090ifeq ($(CONFIG_CPU_INTEL_FIRMWARE_INTERFACE_TABLE),y)
91bootblock_inc += $(src)/cpu/intel/fit/fit.inc
92endif
Patrick Georgi641dd712011-11-01 18:55:59 +010093bootblock_inc += $(chipset_bootblock_inc)
94
95ifeq ($(CONFIG_SSE),y)
96bootblock_inc += $(src)/cpu/x86/sse_enable.inc
97endif
Kyösti Mälkkif775b8c2012-04-19 12:14:53 +030098bootblock_inc += $(objgenerated)/bootblock.inc
Patrick Georgi641dd712011-11-01 18:55:59 +010099bootblock_inc += $(src)/arch/x86/lib/walkcbfs.S
100
Kyösti Mälkkie8792be2014-02-26 15:19:04 +0200101bootblock_romccflags := -mcpu=i386 -O2 -D__PRE_RAM__ -D__BOOT_BLOCK__
Patrick Georgi641dd712011-11-01 18:55:59 +0100102ifeq ($(CONFIG_SSE),y)
Kyösti Mälkkie8792be2014-02-26 15:19:04 +0200103bootblock_romccflags := -mcpu=k7 -msse -O2 -D__PRE_RAM__ -D__BOOT_BLOCK__
Patrick Georgi641dd712011-11-01 18:55:59 +0100104endif
105
Kyösti Mälkkif775b8c2012-04-19 12:14:53 +0300106$(objgenerated)/bootblock.ld: $$(bootblock_lds) $(obj)/ldoptions
Patrick Georgi641dd712011-11-01 18:55:59 +0100107 @printf " GEN $(subst $(obj)/,,$(@))\n"
Patrick Georgi641dd712011-11-01 18:55:59 +0100108 printf '$(foreach ldscript,ldoptions $(bootblock_lds),INCLUDE "$(ldscript)"\n)' > $@
109
Marc Jones49fe74b2012-05-14 16:20:26 -0600110$(objgenerated)/bootblock_inc.S: $$(bootblock_inc)
Patrick Georgi641dd712011-11-01 18:55:59 +0100111 @printf " GEN $(subst $(obj)/,,$(@))\n"
Patrick Georgi950f20a2012-01-17 13:13:59 +0100112 printf '$(foreach crt0,$(bootblock_inc),#include "$(crt0)"\n)' > $@
Patrick Georgi641dd712011-11-01 18:55:59 +0100113
Kyösti Mälkkif775b8c2012-04-19 12:14:53 +0300114$(objgenerated)/bootblock.o: $(objgenerated)/bootblock.s
Daniele Forsi96639fb2014-08-02 13:45:17 +0200115 @printf " CC $(subst $(obj)/,,$(@))\n"
Patrick Georgi59307742014-05-19 09:23:57 +0200116 $(CC_bootblock) $(CFLAGS_x86_32) $(DISASSEMBLY) -c -o $@ $< > $(basename $@).disasm
Patrick Georgi641dd712011-11-01 18:55:59 +0100117
Marc Jones49fe74b2012-05-14 16:20:26 -0600118$(objgenerated)/bootblock.s: $(objgenerated)/bootblock_inc.S $(obj)/config.h $(obj)/build.h
Patrick Georgi641dd712011-11-01 18:55:59 +0100119 @printf " CC $(subst $(obj)/,,$(@))\n"
Furquan Shaikh99ac98f2014-04-23 10:18:48 -0700120 $(CC_bootblock) -MMD -x assembler-with-cpp -E -I$(src)/include -I$(src)/arch/x86/include -I$(obj) -include $(obj)/build.h -include $(obj)/config.h -I. -I$(src) $< -o $@
Patrick Georgi641dd712011-11-01 18:55:59 +0100121
Kyösti Mälkkif775b8c2012-04-19 12:14:53 +0300122$(objgenerated)/bootblock.inc: $(src)/arch/x86/init/$(subst ",,$(CONFIG_BOOTBLOCK_SOURCE)) $(objutil)/romcc/romcc $(OPTION_TABLE_H)
Patrick Georgi641dd712011-11-01 18:55:59 +0100123 @printf " ROMCC $(subst $(obj)/,,$(@))\n"
Patrick Georgi59307742014-05-19 09:23:57 +0200124 $(CC_bootblock) $(CPPFLAGS_bootblock) -MM -MT$(objgenerated)/bootblock.inc \
Kyösti Mälkkif775b8c2012-04-19 12:14:53 +0300125 $< > $(objgenerated)/bootblock.inc.d
Patrick Georgi59307742014-05-19 09:23:57 +0200126 $(ROMCC) -c -S $(bootblock_romccflags) -I. $(CPPFLAGS_bootblock) $< -o $@
Patrick Georgi641dd712011-11-01 18:55:59 +0100127
Kyösti Mälkkif775b8c2012-04-19 12:14:53 +0300128$(objcbfs)/bootblock.debug: $(objgenerated)/bootblock.o $(objgenerated)/bootblock.ld
Patrick Georgi641dd712011-11-01 18:55:59 +0100129 @printf " LINK $(subst $(obj)/,,$(@))\n"
Furquan Shaikh99ac98f2014-04-23 10:18:48 -0700130 $(LD_bootblock) -m elf_i386 -static -o $@ -L$(obj) $< -T $(objgenerated)/bootblock.ld
Patrick Georgi641dd712011-11-01 18:55:59 +0100131
Furquan Shaikh99ac98f2014-04-23 10:18:48 -0700132
133endif # CONFIG_ARCH_BOOTBLOCK_X86_32
134
Furquan Shaikh88ca81a2014-04-22 16:33:22 -0700135###############################################################################
136# romstage
137###############################################################################
138
Furquan Shaikh99ac98f2014-04-23 10:18:48 -0700139ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32),y)
140
Furquan Shaikh88ca81a2014-04-22 16:33:22 -0700141crt0s = $(src)/arch/x86/init/prologue.inc
142ldscripts =
143ldscripts += $(src)/arch/x86/init/romstage.ld
144crt0s += $(src)/cpu/x86/32bit/entry32.inc
Patrick Georgiea9f3082015-03-27 13:50:11 +0100145ldscripts += $(src)/cpu/x86/32bit/entry32.ld
Furquan Shaikh88ca81a2014-04-22 16:33:22 -0700146
147crt0s += $(src)/cpu/x86/fpu_enable.inc
148ifeq ($(CONFIG_SSE),y)
149crt0s += $(src)/cpu/x86/sse_enable.inc
150endif
151
152crt0s += $(cpu_incs)
153crt0s += $(cpu_incs-y)
154
155crt0s += $(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc
156
157ifeq ($(CONFIG_ROMCC),y)
158crt0s += $(src)/arch/x86/init/crt0_romcc_epilogue.inc
159endif
160
161ifeq ($(CONFIG_ROMCC),y)
162ifeq ($(CONFIG_MMX),y)
163 ifeq ($(CONFIG_SSE),y)
164 ROMCCFLAGS := -mcpu=p4 -O2 # MMX, SSE
165 else
166 ROMCCFLAGS := -mcpu=p2 -O2 # MMX, !SSE
167 endif
168else
169 ROMCCFLAGS := -mcpu=i386 -O2 # !MMX, !SSE
170endif
171
Patrick Georgi24cca752014-11-29 11:51:25 +0100172$(objcbfs)/romstage%.bin: $(objcbfs)/romstage%.elf
Furquan Shaikh99ac98f2014-04-23 10:18:48 -0700173 @printf " OBJCOPY $(subst $(obj)/,,$(@))\n"
174 $(OBJCOPY_romstage) -O binary $< $@
175
Patrick Georgi24cca752014-11-29 11:51:25 +0100176$(objcbfs)/romstage%.elf: $(objcbfs)/romstage%.debug
Furquan Shaikh99ac98f2014-04-23 10:18:48 -0700177 @printf " OBJCOPY $(subst $(obj)/,,$(@))\n"
178 cp $< $@.tmp
179 $(OBJCOPY_romstage) --strip-debug $@.tmp
180 $(OBJCOPY_romstage) --add-gnu-debuglink=$< $@.tmp
181 mv $@.tmp $@
182
Furquan Shaikh88ca81a2014-04-22 16:33:22 -0700183$(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc: $(src)/mainboard/$(MAINBOARDDIR)/romstage.c $(objutil)/romcc/romcc $(OPTION_TABLE_H) $(obj)/build.h $(obj)/config.h
184 printf " ROMCC romstage.inc\n"
Patrick Georgi59307742014-05-19 09:23:57 +0200185 $(ROMCC) -c -S $(ROMCCFLAGS) -D__PRE_RAM__ -I. $(CPPFLAGS_romstage) $< -o $@
Furquan Shaikh88ca81a2014-04-22 16:33:22 -0700186else
187
188$(obj)/mainboard/$(MAINBOARDDIR)/romstage.pre.inc: $(src)/mainboard/$(MAINBOARDDIR)/romstage.c $(OPTION_TABLE_H) $(obj)/build.h $(obj)/config.h
189 @printf " CC romstage.inc\n"
Patrick Georgi59307742014-05-19 09:23:57 +0200190 $(CC_romstage) $(CPPFLAGS_romstage) $(CFLAGS_romstage) -MMD -D__PRE_RAM__ -I$(src) -I. -I$(obj) -c -S $< -o $@
Furquan Shaikh88ca81a2014-04-22 16:33:22 -0700191
192$(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc: $(obj)/mainboard/$(MAINBOARDDIR)/romstage.pre.inc
193 @printf " POST romstage.inc\n"
194 sed -e 's/\.rodata/.rom.data/g' -e 's/\^\.text/.section .rom.text/g' \
195 -e 's/\^\.section \.text/.section .rom.text/g' $^ > $@.tmp
196 mv $@.tmp $@
197endif
198
Patrick Georgidb273062015-03-27 17:03:28 +0100199romstage-srcs += $(objgenerated)/crt0.S
Kyösti Mälkkia01ec142012-03-31 10:21:29 +0300200
Alexandru Gagniuceb3c9912014-03-29 13:01:11 -0500201romstage-libs ?=
202
203$(objcbfs)/romstage_null.debug: $$(romstage-objs) $(objgenerated)/romstage_null.ld $$(romstage-libs)
Patrick Georgi641dd712011-11-01 18:55:59 +0100204 @printf " LINK $(subst $(obj)/,,$(@))\n"
Aaron Durbina2a4bcf2015-03-20 19:28:55 -0500205 $(LD_romstage) --gc-sections -nostdlib -nostartfiles -static -o $@ -L$(obj) $(COMPILER_RT_FLAGS_romstage) --start-group $(romstage-objs) $(romstage-libs) $(COMPILER_RT_romstage) --end-group -T $(objgenerated)/romstage_null.ld
Furquan Shaikh3cf6aea2014-10-30 11:53:38 -0700206 $(OBJCOPY_romstage) --only-section .illegal_globals $(@) $(objcbfs)/romstage_null.offenders && \
207 $(NM_romstage) $(objcbfs)/romstage_null.offenders | grep -q ""; if [ $$? -eq 0 ]; then \
Stefan Reinauerb6e12372012-07-31 14:52:04 -0700208 echo "Forbidden global variables in romstage:"; \
Furquan Shaikh3cf6aea2014-10-30 11:53:38 -0700209 $(NM_romstage) $(objcbfs)/romstage_null.offenders; false; \
Stefan Reinauerb6e12372012-07-31 14:52:04 -0700210 else true; fi
Kyösti Mälkkia01ec142012-03-31 10:21:29 +0300211
Patrick Georgi24cca752014-11-29 11:51:25 +0100212$(objcbfs)/romstage.debug: $$(romstage-objs) $(objgenerated)/romstage.ld $$(romstage-libs)
Kyösti Mälkkia01ec142012-03-31 10:21:29 +0300213 @printf " LINK $(subst $(obj)/,,$(@))\n"
Aaron Durbinf69a99d2015-03-10 11:45:25 -0500214 $(LD_romstage) --gc-sections -nostdlib -nostartfiles -static -o $@ -L$(obj) $(COMPILER_RT_FLAGS_romstage) --start-group $(romstage-objs) $(romstage-libs) $(COMPILER_RT_romstage) --end-group -T $(objgenerated)/romstage.ld
Patrick Georgi641dd712011-11-01 18:55:59 +0100215
Kyösti Mälkki1e9c1b32012-04-19 14:43:47 +0300216$(objgenerated)/romstage_null.ld: $$(ldscripts) $(obj)/ldoptions
Patrick Georgi641dd712011-11-01 18:55:59 +0100217 @printf " GEN $(subst $(obj)/,,$(@))\n"
Kyösti Mälkkia01ec142012-03-31 10:21:29 +0300218 rm -f $@
219 printf "ROMSTAGE_BASE = 0x0;\n" > $@.tmp
220 printf '$(foreach ldscript,ldoptions $(ldscripts),INCLUDE "$(ldscript:$(obj)/%=%)"\n)' >> $@.tmp
221 mv $@.tmp $@
222
Patrick Georgi24cca752014-11-29 11:51:25 +0100223$(objgenerated)/romstage.ld: $(objgenerated)/romstage_null.ld $(objcbfs)/base_xip.txt
Kyösti Mälkkia01ec142012-03-31 10:21:29 +0300224 @printf " GEN $(subst $(obj)/,,$(@))\n"
225 rm -f $@
Kyösti Mälkki1e9c1b32012-04-19 14:43:47 +0300226 sed -e 's/^/ROMSTAGE_BASE = /g' -e 's/$$/;/g' $(objcbfs)/base_xip.txt > $@.tmp
227 sed -e '/ROMSTAGE_BASE/d' $(objgenerated)/romstage_null.ld >> $@.tmp
Kyösti Mälkkia01ec142012-03-31 10:21:29 +0300228 mv $@.tmp $@
229
Kyösti Mälkki1e9c1b32012-04-19 14:43:47 +0300230$(objcbfs)/base_xip.txt: $(obj)/coreboot.pre1 $(objcbfs)/romstage_null.bin
Kyösti Mälkkia01ec142012-03-31 10:21:29 +0300231 rm -f $@
Hung-Te Line9198372013-03-19 12:17:12 +0800232 $(CBFSTOOL) $(obj)/coreboot.pre1 locate -T -f $(objcbfs)/romstage_null.bin -n $(CONFIG_CBFS_PREFIX)/romstage -P $(CONFIG_XIP_ROM_SIZE) > $@.tmp \
Kyösti Mälkkia01ec142012-03-31 10:21:29 +0300233 || { echo "The romstage is larger than XIP size. Please expand the CONFIG_XIP_ROM_SIZE" ; exit 1; }
Hung-Te Lin657ea6a2013-01-28 23:00:47 +0800234 mv $@.tmp $@
Patrick Georgi641dd712011-11-01 18:55:59 +0100235
Patrick Georgid69839b2015-04-03 10:32:17 +0200236$(objgenerated)/crt0.S: $$(crt0s)
Patrick Georgi641dd712011-11-01 18:55:59 +0100237 @printf " GEN $(subst $(obj)/,,$(@))\n"
Patrick Georgid69839b2015-04-03 10:32:17 +0200238 printf '$(foreach crt0,$(crt0s),#include "$(crt0)"\n)' > $@
Patrick Georgi641dd712011-11-01 18:55:59 +0100239
Patrick Georgid69839b2015-04-03 10:32:17 +0200240# Compiling crt0 with -g seems to trigger https://sourceware.org/bugzilla/show_bug.cgi?id=6428
241romstage-S-ccopts += -I. -g0
Furquan Shaikh99ac98f2014-04-23 10:18:48 -0700242
243endif # CONFIG_ARCH_ROMSTAGE_X86_32
Stefan Reinauerf1939bb2010-12-30 17:39:50 +0000244
Furquan Shaikh88ca81a2014-04-22 16:33:22 -0700245###############################################################################
246# ramstage
247###############################################################################
248
Furquan Shaikh99ac98f2014-04-23 10:18:48 -0700249ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32),y)
250
Furquan Shaikh88ca81a2014-04-22 16:33:22 -0700251ramstage-srcs += $(wildcard src/mainboard/$(MAINBOARDDIR)/mainboard.c)
252ifeq ($(CONFIG_GENERATE_MP_TABLE),y)
253ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/mptable.c),)
254ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/mptable.c
255endif
256endif
257ifeq ($(CONFIG_GENERATE_PIRQ_TABLE),y)
258ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/irq_tables.c
259endif
260ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/reset.c),)
261ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/reset.c
262endif
Vladimir Serbinenko822bc652014-01-03 15:55:40 +0100263ifeq ($(CONFIG_HAVE_ACPI_TABLES),y)
Furquan Shaikh88ca81a2014-04-22 16:33:22 -0700264ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/acpi_tables.c
265ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/dsdt.asl
266ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/ssdt2.asl),)
267ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/ssdt2.asl
268endif
269ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/ssdt3.asl),)
270ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/ssdt3.asl
271endif
272ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/ssdt4.asl),)
273ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/ssdt4.asl
274endif
275ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/ssdt5.asl),)
276ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/ssdt5.asl
277endif
278ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/fadt.c),)
279ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/fadt.c
280endif
281endif
282ifeq ($(CONFIG_HAVE_SMI_HANDLER),y)
283ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/smihandler.c),)
284smm-srcs += src/mainboard/$(MAINBOARDDIR)/smihandler.c
285endif
286endif
287ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/get_bus_conf.c),)
288ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/get_bus_conf.c
289endif
290
291ramstage-libs ?=
292
293ifeq ($(CONFIG_RELOCATABLE_RAMSTAGE),y)
294
Furquan Shaikh133096b2014-07-31 09:28:55 -0700295$(eval $(call rmodule_link,$(objcbfs)/ramstage.debug, $(objgenerated)/ramstage.o, $(CONFIG_HEAP_SIZE),x86_32))
Furquan Shaikh88ca81a2014-04-22 16:33:22 -0700296
297# The rmodule_link defintion creates an elf file with .rmod extension.
298$(objcbfs)/ramstage.elf: $(objcbfs)/ramstage.debug.rmod
299 cp $< $@
300
301else
302
303$(objcbfs)/ramstage.debug: $(objgenerated)/ramstage.o $(src)/arch/x86/ramstage.ld
304 @printf " CC $(subst $(obj)/,,$(@))\n"
Aaron Durbinf69a99d2015-03-10 11:45:25 -0500305 $(LD_ramstage) --gc-sections -o $@ -L$(obj) $< -T $(src)/arch/x86/ramstage.ld
Furquan Shaikh88ca81a2014-04-22 16:33:22 -0700306
307endif
308
Patrick Georgi3ce96bd2014-11-22 17:42:58 +0100309$(objgenerated)/ramstage.o: $$(ramstage-objs) $(COMPILER_RT_ramstage) $$(ramstage-libs)
Furquan Shaikh88ca81a2014-04-22 16:33:22 -0700310 @printf " CC $(subst $(obj)/,,$(@))\n"
Patrick Georgi95948932014-11-22 17:55:46 +0100311 $(LD_ramstage) -m elf_i386 -r -o $@ $(COMPILER_RT_FLAGS_ramstage) --start-group $(ramstage-objs) $(ramstage-libs) $(COMPILER_RT_ramstage) --end-group
Furquan Shaikh88ca81a2014-04-22 16:33:22 -0700312
Furquan Shaikh99ac98f2014-04-23 10:18:48 -0700313endif # CONFIG_ARCH_RAMSTAGE_X86_32
Furquan Shaikh88ca81a2014-04-22 16:33:22 -0700314
315################################################################################
316
Stefan Reinauerf1939bb2010-12-30 17:39:50 +0000317seabios:
318 $(MAKE) -C payloads/external/SeaBIOS -f Makefile.inc \
Peter Stugeb1d1c4d2011-02-07 20:16:40 +0000319 HOSTCC="$(HOSTCC)" \
Furquan Shaikh99ac98f2014-04-23 10:18:48 -0700320 CC="$(CC_x86_32)" LD="$(LD_x86_32)" OBJDUMP="$(OBJDUMP_x86_32)" \
321 OBJCOPY="$(OBJCOPY_x86_32)" STRIP="$(STRIP_x86_32)" \
Patrick Georgi31dbb532014-05-10 14:21:38 +0200322 AS="$(AS_x86_32)" \
Stefan Reinauerf1939bb2010-12-30 17:39:50 +0000323 CONFIG_SEABIOS_MASTER=$(CONFIG_SEABIOS_MASTER) \
Stefan Reinaueraff6dc22012-01-21 10:34:22 -0800324 CONFIG_SEABIOS_STABLE=$(CONFIG_SEABIOS_STABLE) \
Idwer Vollering7c1a49b2014-04-01 22:47:33 +0000325 CONFIG_SEABIOS_THREAD_OPTIONROMS=$(CONFIG_SEABIOS_THREAD_OPTIONROMS) \
Edward O'Callaghana296f9e2014-09-13 03:43:49 +1000326 CONFIG_SEABIOS_VGA_COREBOOT=$(CONFIG_SEABIOS_VGA_COREBOOT) \
Martin Roth0d7f1332014-07-25 14:33:49 -0600327 CONFIG_CONSOLE_SERIAL=$(CONFIG_CONSOLE_SERIAL) \
328 CONFIG_TTYS0_BASE=$(CONFIG_TTYS0_BASE) \
Martin Roth4d7d25f2014-07-25 14:39:05 -0600329 CONFIG_SEABIOS_MALLOC_UPPERMEMORY=$(CONFIG_SEABIOS_MALLOC_UPPERMEMORY) \
Marc Jonesc2dff7f2012-05-14 21:06:10 -0600330 OUT=$(abspath $(obj)) IASL="$(IASL)"
Stefan Reinaueraff6dc22012-01-21 10:34:22 -0800331
Stefan Reinauere50952f2011-04-15 03:34:05 +0000332filo:
333 $(MAKE) -C payloads/external/FILO -f Makefile.inc \
334 HOSTCC="$(HOSTCC)" \
Furquan Shaikh99ac98f2014-04-23 10:18:48 -0700335 CC="$(CC_x86_32)" LD="$(LD_x86_32)" OBJDUMP="$(OBJDUMP_x86_32)" \
336 OBJCOPY="$(OBJCOPY_x86_32)" STRIP="$(STRIP_x86_32)" \
Stefan Reinauere50952f2011-04-15 03:34:05 +0000337 CONFIG_FILO_MASTER=$(CONFIG_FILO_MASTER) \
338 CONFIG_FILO_STABLE=$(CONFIG_FILO_STABLE)
Stefan Reinauerf1939bb2010-12-30 17:39:50 +0000339
Vladimir Serbinenko113a3662013-11-14 12:10:08 +0100340
341grub2:
342 $(MAKE) -C payloads/external/GRUB2 -f Makefile.inc \
343 HOSTCC="$(HOSTCC)" \
Furquan Shaikh99ac98f2014-04-23 10:18:48 -0700344 CC="$(CC_x86_32)" LD="$(LD_x86_32)" OBJDUMP="$(OBJDUMP_x86_32)" \
345 OBJCOPY="$(OBJCOPY_x86_32)" STRIP="$(STRIP_x86_32)" \
Vladimir Serbinenko113a3662013-11-14 12:10:08 +0100346 CONFIG_GRUB2_MASTER=$(CONFIG_GRUB2_MASTER)