Alexandru Gagniuc | 00b579a | 2012-07-20 00:11:21 -0500 | [diff] [blame] | 1 | ################################################################################ |
Stefan Reinauer | 3058491 | 2010-08-14 20:38:17 +0000 | [diff] [blame] | 2 | ## |
| 3 | ## This file is part of the coreboot project. |
| 4 | ## |
Alexandru Gagniuc | 00b579a | 2012-07-20 00:11:21 -0500 | [diff] [blame] | 5 | ## Copyright (C) 2012 Alexandru Gagniuc <mr.nuke.me@gmail.com> |
Stefan Reinauer | 3058491 | 2010-08-14 20:38:17 +0000 | [diff] [blame] | 6 | ## 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 Menzel | a46a712 | 2013-02-23 18:37:27 +0100 | [diff] [blame] | 20 | ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
Stefan Reinauer | 3058491 | 2010-08-14 20:38:17 +0000 | [diff] [blame] | 21 | ## |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 22 | ############################################################################### |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 23 | # Take care of subdirectories |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 24 | ############################################################################### |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 25 | subdirs-y += boot |
Stefan Reinauer | e377857 | 2010-01-30 09:47:18 +0000 | [diff] [blame] | 26 | # subdirs-y += init |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 27 | subdirs-y += lib |
| 28 | subdirs-y += smp |
| 29 | |
Patrick Georgi | 327a866 | 2014-01-18 16:26:11 +0100 | [diff] [blame] | 30 | ifeq ($(CONFIG_COMPILER_GCC),y) |
Patrick Georgi | 5930774 | 2014-05-19 09:23:57 +0200 | [diff] [blame] | 31 | DISASSEMBLY=-Wa,-acdlns |
Patrick Georgi | 327a866 | 2014-01-18 16:26:11 +0100 | [diff] [blame] | 32 | else |
Edward O'Callaghan | b0195a3 | 2014-05-23 01:32:44 +1000 | [diff] [blame] | 33 | DISASSEMBLY=-Wa,--divide |
Patrick Georgi | 327a866 | 2014-01-18 16:26:11 +0100 | [diff] [blame] | 34 | endif |
| 35 | |
Patrick Georgi | 8463dd9 | 2010-09-30 16:55:02 +0000 | [diff] [blame] | 36 | OPTION_TABLE_H:= |
| 37 | ifeq ($(CONFIG_HAVE_OPTION_TABLE),y) |
Patrick Georgi | 5c0bca2 | 2011-01-30 16:31:15 +0000 | [diff] [blame] | 38 | cbfs-files-y += cmos_layout.bin |
| 39 | cmos_layout.bin-file = $(obj)/cmos_layout.bin |
| 40 | cmos_layout.bin-type = 0x01aa |
Patrick Georgi | 2447937 | 2011-01-18 13:56:36 +0000 | [diff] [blame] | 41 | |
Patrick Georgi | 8463dd9 | 2010-09-30 16:55:02 +0000 | [diff] [blame] | 42 | OPTION_TABLE_H:=$(obj)/option_table.h |
| 43 | endif |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 44 | |
Patrick Georgi | ff9d78c | 2011-01-30 16:37:39 +0000 | [diff] [blame] | 45 | stripped_vgabios_id = $(call strip_quotes,$(CONFIG_VGA_BIOS_ID)) |
| 46 | cbfs-files-$(CONFIG_VGA_BIOS) += pci$(stripped_vgabios_id).rom |
| 47 | pci$(stripped_vgabios_id).rom-file := $(call strip_quotes,$(CONFIG_VGA_BIOS_FILE)) |
| 48 | pci$(stripped_vgabios_id).rom-type := optionrom |
| 49 | |
| 50 | cbfs-files-$(CONFIG_INTEL_MBI) += mbi.bin |
| 51 | mbi.bin-file := $(call strip_quotes,$(CONFIG_MBI_FILE)) |
| 52 | mbi.bin-type := mbi |
| 53 | |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 54 | ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32),y) |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 55 | CBFSTOOL_PRE1_OPTS = -m x86 -o $$(( $(CONFIG_ROM_SIZE) - $(CONFIG_CBFS_SIZE) )) |
Furquan Shaikh | b4ce4d4 | 2014-10-30 11:47:20 -0700 | [diff] [blame] | 56 | # Make sure that segment for .car.data is ignored while adding romstage. |
| 57 | CBFSTOOL_PRE_OPTS = -b $(shell cat $(objcbfs)/base_xip.txt) -S ".car.data" |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 58 | endif |
Patrick Georgi | ff9d78c | 2011-01-30 16:37:39 +0000 | [diff] [blame] | 59 | |
Alexandru Gagniuc | 00b579a | 2012-07-20 00:11:21 -0500 | [diff] [blame] | 60 | ################################################################################ |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 61 | # i386 specific tools |
Vikram Narayanan | a8111cf | 2012-04-14 15:25:13 +0530 | [diff] [blame] | 62 | NVRAMTOOL:=$(objutil)/nvramtool/nvramtool |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 63 | |
Vikram Narayanan | a8111cf | 2012-04-14 15:25:13 +0530 | [diff] [blame] | 64 | $(OPTION_TABLE_H): $(NVRAMTOOL) $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout |
Uwe Hermann | 6c73b441 | 2009-10-28 17:10:51 +0000 | [diff] [blame] | 65 | @printf " OPTION $(subst $(obj)/,,$(@))\n" |
Vikram Narayanan | a8111cf | 2012-04-14 15:25:13 +0530 | [diff] [blame] | 66 | $(NVRAMTOOL) -y $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout -H $@ |
Patrick Georgi | 1c797a1 | 2010-04-15 14:32:17 +0000 | [diff] [blame] | 67 | |
Vikram Narayanan | a8111cf | 2012-04-14 15:25:13 +0530 | [diff] [blame] | 68 | $(obj)/cmos_layout.bin: $(NVRAMTOOL) $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout |
Patrick Georgi | 1c797a1 | 2010-04-15 14:32:17 +0000 | [diff] [blame] | 69 | @printf " OPTION $(subst $(obj)/,,$(@))\n" |
Vikram Narayanan | a8111cf | 2012-04-14 15:25:13 +0530 | [diff] [blame] | 70 | $(NVRAMTOOL) -y $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout -L $@ |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 71 | |
Kyösti Mälkki | 0db2ae3a | 2012-04-19 12:00:06 +0300 | [diff] [blame] | 72 | |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 73 | ############################################################################### |
| 74 | # bootblock |
| 75 | ############################################################################### |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 76 | |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 77 | ifeq ($(CONFIG_ARCH_BOOTBLOCK_X86_32),y) |
| 78 | |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 79 | bootblock_lds = $(src)/arch/x86/init/ldscript_failover.lb |
| 80 | bootblock_lds += $(src)/cpu/x86/16bit/entry16.lds |
| 81 | bootblock_lds += $(src)/cpu/x86/16bit/reset16.lds |
| 82 | bootblock_lds += $(src)/arch/x86/lib/id.lds |
| 83 | bootblock_lds += $(chipset_bootblock_lds) |
Aaron Durbin | 6dccedd | 2012-12-03 16:17:40 -0600 | [diff] [blame] | 84 | ifeq ($(CONFIG_CPU_INTEL_FIRMWARE_INTERFACE_TABLE),y) |
| 85 | bootblock_lds += $(src)/cpu/intel/fit/fit.lds |
| 86 | endif |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 87 | |
| 88 | bootblock_inc = $(src)/arch/x86/init/prologue.inc |
| 89 | bootblock_inc += $(src)/cpu/x86/16bit/entry16.inc |
| 90 | bootblock_inc += $(src)/cpu/x86/16bit/reset16.inc |
| 91 | bootblock_inc += $(src)/cpu/x86/32bit/entry32.inc |
| 92 | bootblock_inc += $(src)/arch/x86/lib/id.inc |
Aaron Durbin | 6dccedd | 2012-12-03 16:17:40 -0600 | [diff] [blame] | 93 | ifeq ($(CONFIG_CPU_INTEL_FIRMWARE_INTERFACE_TABLE),y) |
| 94 | bootblock_inc += $(src)/cpu/intel/fit/fit.inc |
| 95 | endif |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 96 | bootblock_inc += $(chipset_bootblock_inc) |
| 97 | |
| 98 | ifeq ($(CONFIG_SSE),y) |
| 99 | bootblock_inc += $(src)/cpu/x86/sse_enable.inc |
| 100 | endif |
Kyösti Mälkki | f775b8c | 2012-04-19 12:14:53 +0300 | [diff] [blame] | 101 | bootblock_inc += $(objgenerated)/bootblock.inc |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 102 | bootblock_inc += $(src)/arch/x86/lib/walkcbfs.S |
| 103 | |
Kyösti Mälkki | e8792be | 2014-02-26 15:19:04 +0200 | [diff] [blame] | 104 | bootblock_romccflags := -mcpu=i386 -O2 -D__PRE_RAM__ -D__BOOT_BLOCK__ |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 105 | ifeq ($(CONFIG_SSE),y) |
Kyösti Mälkki | e8792be | 2014-02-26 15:19:04 +0200 | [diff] [blame] | 106 | bootblock_romccflags := -mcpu=k7 -msse -O2 -D__PRE_RAM__ -D__BOOT_BLOCK__ |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 107 | endif |
| 108 | |
Kyösti Mälkki | f775b8c | 2012-04-19 12:14:53 +0300 | [diff] [blame] | 109 | $(objgenerated)/bootblock.ld: $$(bootblock_lds) $(obj)/ldoptions |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 110 | @printf " GEN $(subst $(obj)/,,$(@))\n" |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 111 | printf '$(foreach ldscript,ldoptions $(bootblock_lds),INCLUDE "$(ldscript)"\n)' > $@ |
| 112 | |
Marc Jones | 49fe74b | 2012-05-14 16:20:26 -0600 | [diff] [blame] | 113 | $(objgenerated)/bootblock_inc.S: $$(bootblock_inc) |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 114 | @printf " GEN $(subst $(obj)/,,$(@))\n" |
Patrick Georgi | 950f20a | 2012-01-17 13:13:59 +0100 | [diff] [blame] | 115 | printf '$(foreach crt0,$(bootblock_inc),#include "$(crt0)"\n)' > $@ |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 116 | |
Kyösti Mälkki | f775b8c | 2012-04-19 12:14:53 +0300 | [diff] [blame] | 117 | $(objgenerated)/bootblock.o: $(objgenerated)/bootblock.s |
Daniele Forsi | 96639fb | 2014-08-02 13:45:17 +0200 | [diff] [blame] | 118 | @printf " CC $(subst $(obj)/,,$(@))\n" |
Patrick Georgi | 5930774 | 2014-05-19 09:23:57 +0200 | [diff] [blame] | 119 | $(CC_bootblock) $(CFLAGS_x86_32) $(DISASSEMBLY) -c -o $@ $< > $(basename $@).disasm |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 120 | |
Marc Jones | 49fe74b | 2012-05-14 16:20:26 -0600 | [diff] [blame] | 121 | $(objgenerated)/bootblock.s: $(objgenerated)/bootblock_inc.S $(obj)/config.h $(obj)/build.h |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 122 | @printf " CC $(subst $(obj)/,,$(@))\n" |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 123 | $(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 Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 124 | |
Kyösti Mälkki | f775b8c | 2012-04-19 12:14:53 +0300 | [diff] [blame] | 125 | $(objgenerated)/bootblock.inc: $(src)/arch/x86/init/$(subst ",,$(CONFIG_BOOTBLOCK_SOURCE)) $(objutil)/romcc/romcc $(OPTION_TABLE_H) |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 126 | @printf " ROMCC $(subst $(obj)/,,$(@))\n" |
Patrick Georgi | 5930774 | 2014-05-19 09:23:57 +0200 | [diff] [blame] | 127 | $(CC_bootblock) $(CPPFLAGS_bootblock) -MM -MT$(objgenerated)/bootblock.inc \ |
Kyösti Mälkki | f775b8c | 2012-04-19 12:14:53 +0300 | [diff] [blame] | 128 | $< > $(objgenerated)/bootblock.inc.d |
Patrick Georgi | 5930774 | 2014-05-19 09:23:57 +0200 | [diff] [blame] | 129 | $(ROMCC) -c -S $(bootblock_romccflags) -I. $(CPPFLAGS_bootblock) $< -o $@ |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 130 | |
Kyösti Mälkki | f775b8c | 2012-04-19 12:14:53 +0300 | [diff] [blame] | 131 | $(objcbfs)/bootblock.debug: $(objgenerated)/bootblock.o $(objgenerated)/bootblock.ld |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 132 | @printf " LINK $(subst $(obj)/,,$(@))\n" |
Patrick Georgi | 68b5da0e | 2012-03-11 20:15:21 +0100 | [diff] [blame] | 133 | ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y) |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 134 | $(LD_bootblock) -m elf_i386 -static -o $@ -L$(obj) $< -T $(objgenerated)/bootblock.ld |
Patrick Georgi | 68b5da0e | 2012-03-11 20:15:21 +0100 | [diff] [blame] | 135 | else |
Patrick Georgi | 5930774 | 2014-05-19 09:23:57 +0200 | [diff] [blame] | 136 | $(CC_bootblock) $(CFLAGS_bootblock) -nostdlib -nostartfiles -static -o $@ -L$(obj) -T $(objgenerated)/bootblock.ld $< |
Patrick Georgi | 68b5da0e | 2012-03-11 20:15:21 +0100 | [diff] [blame] | 137 | endif |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 138 | |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 139 | |
| 140 | endif # CONFIG_ARCH_BOOTBLOCK_X86_32 |
| 141 | |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 142 | ############################################################################### |
| 143 | # romstage |
| 144 | ############################################################################### |
| 145 | |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 146 | ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32),y) |
| 147 | |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 148 | crt0s = $(src)/arch/x86/init/prologue.inc |
| 149 | ldscripts = |
| 150 | ldscripts += $(src)/arch/x86/init/romstage.ld |
| 151 | crt0s += $(src)/cpu/x86/32bit/entry32.inc |
| 152 | ldscripts += $(src)/cpu/x86/32bit/entry32.lds |
| 153 | |
| 154 | crt0s += $(src)/cpu/x86/fpu_enable.inc |
| 155 | ifeq ($(CONFIG_SSE),y) |
| 156 | crt0s += $(src)/cpu/x86/sse_enable.inc |
| 157 | endif |
| 158 | |
| 159 | crt0s += $(cpu_incs) |
| 160 | crt0s += $(cpu_incs-y) |
| 161 | |
| 162 | crt0s += $(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc |
| 163 | |
| 164 | ifeq ($(CONFIG_ROMCC),y) |
| 165 | crt0s += $(src)/arch/x86/init/crt0_romcc_epilogue.inc |
| 166 | endif |
| 167 | |
| 168 | ifeq ($(CONFIG_ROMCC),y) |
| 169 | ifeq ($(CONFIG_MMX),y) |
| 170 | ifeq ($(CONFIG_SSE),y) |
| 171 | ROMCCFLAGS := -mcpu=p4 -O2 # MMX, SSE |
| 172 | else |
| 173 | ROMCCFLAGS := -mcpu=p2 -O2 # MMX, !SSE |
| 174 | endif |
| 175 | else |
| 176 | ROMCCFLAGS := -mcpu=i386 -O2 # !MMX, !SSE |
| 177 | endif |
| 178 | |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 179 | $(objcbfs)/romstage_%.bin: $(objcbfs)/romstage_%.elf |
| 180 | @printf " OBJCOPY $(subst $(obj)/,,$(@))\n" |
| 181 | $(OBJCOPY_romstage) -O binary $< $@ |
| 182 | |
| 183 | $(objcbfs)/romstage_%.elf: $(objcbfs)/romstage_%.debug |
| 184 | @printf " OBJCOPY $(subst $(obj)/,,$(@))\n" |
| 185 | cp $< $@.tmp |
| 186 | $(OBJCOPY_romstage) --strip-debug $@.tmp |
| 187 | $(OBJCOPY_romstage) --add-gnu-debuglink=$< $@.tmp |
| 188 | mv $@.tmp $@ |
| 189 | |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 190 | $(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc: $(src)/mainboard/$(MAINBOARDDIR)/romstage.c $(objutil)/romcc/romcc $(OPTION_TABLE_H) $(obj)/build.h $(obj)/config.h |
| 191 | printf " ROMCC romstage.inc\n" |
Patrick Georgi | 5930774 | 2014-05-19 09:23:57 +0200 | [diff] [blame] | 192 | $(ROMCC) -c -S $(ROMCCFLAGS) -D__PRE_RAM__ -I. $(CPPFLAGS_romstage) $< -o $@ |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 193 | else |
| 194 | |
| 195 | $(obj)/mainboard/$(MAINBOARDDIR)/romstage.pre.inc: $(src)/mainboard/$(MAINBOARDDIR)/romstage.c $(OPTION_TABLE_H) $(obj)/build.h $(obj)/config.h |
| 196 | @printf " CC romstage.inc\n" |
Patrick Georgi | 5930774 | 2014-05-19 09:23:57 +0200 | [diff] [blame] | 197 | $(CC_romstage) $(CPPFLAGS_romstage) $(CFLAGS_romstage) -MMD -D__PRE_RAM__ -I$(src) -I. -I$(obj) -c -S $< -o $@ |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 198 | |
| 199 | $(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc: $(obj)/mainboard/$(MAINBOARDDIR)/romstage.pre.inc |
| 200 | @printf " POST romstage.inc\n" |
| 201 | sed -e 's/\.rodata/.rom.data/g' -e 's/\^\.text/.section .rom.text/g' \ |
| 202 | -e 's/\^\.section \.text/.section .rom.text/g' $^ > $@.tmp |
| 203 | mv $@.tmp $@ |
| 204 | endif |
| 205 | |
| 206 | romstage-srcs += $(objgenerated)/crt0.s |
Kyösti Mälkki | a01ec14 | 2012-03-31 10:21:29 +0300 | [diff] [blame] | 207 | |
Alexandru Gagniuc | eb3c991 | 2014-03-29 13:01:11 -0500 | [diff] [blame] | 208 | romstage-libs ?= |
| 209 | |
| 210 | $(objcbfs)/romstage_null.debug: $$(romstage-objs) $(objgenerated)/romstage_null.ld $$(romstage-libs) |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 211 | @printf " LINK $(subst $(obj)/,,$(@))\n" |
Patrick Georgi | 68b5da0e | 2012-03-11 20:15:21 +0100 | [diff] [blame] | 212 | ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y) |
Patrick Georgi | 3ce96bd | 2014-11-22 17:42:58 +0100 | [diff] [blame^] | 213 | $(LD_romstage) -nostdlib -nostartfiles -static -o $@ -L$(obj) --start-group $(romstage-objs) $(romstage-libs) $(COMPILER_RT_romstage) --end-group -T $(objgenerated)/romstage_null.ld |
Patrick Georgi | 68b5da0e | 2012-03-11 20:15:21 +0100 | [diff] [blame] | 214 | else |
Patrick Georgi | 3ce96bd | 2014-11-22 17:42:58 +0100 | [diff] [blame^] | 215 | $(CC_romstage) $(CFLAGS_romstage) -nostdlib -nostartfiles -static -o $@ -L$(obj) -T $(objgenerated)/romstage_null.ld -Wl,--wrap,__divdi3 -Wl,--wrap,__udivdi3 -Wl,--wrap,__moddi3 -Wl,--wrap,__umoddi3 -Wl,--start-group $(romstage-objs) $(romstage-libs) $(COMPILER_RT_romstage) -Wl,--end-group |
Patrick Georgi | 68b5da0e | 2012-03-11 20:15:21 +0100 | [diff] [blame] | 216 | endif |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 217 | $(NM_romstage) $@ | grep -q " [DdBb] "; if [ $$? -eq 0 ]; then \ |
Stefan Reinauer | b6e1237 | 2012-07-31 14:52:04 -0700 | [diff] [blame] | 218 | echo "Forbidden global variables in romstage:"; \ |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 219 | $(NM_romstage) $@ | grep " [DdBb] "; test "$(CONFIG_CPU_AMD_AGESA)" = y; \ |
Stefan Reinauer | b6e1237 | 2012-07-31 14:52:04 -0700 | [diff] [blame] | 220 | else true; fi |
Kyösti Mälkki | a01ec14 | 2012-03-31 10:21:29 +0300 | [diff] [blame] | 221 | |
Alexandru Gagniuc | eb3c991 | 2014-03-29 13:01:11 -0500 | [diff] [blame] | 222 | $(objcbfs)/romstage_xip.debug: $$(romstage-objs) $(objgenerated)/romstage_xip.ld $$(romstage-libs) |
Kyösti Mälkki | a01ec14 | 2012-03-31 10:21:29 +0300 | [diff] [blame] | 223 | @printf " LINK $(subst $(obj)/,,$(@))\n" |
Patrick Georgi | 68b5da0e | 2012-03-11 20:15:21 +0100 | [diff] [blame] | 224 | ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y) |
Patrick Georgi | 3ce96bd | 2014-11-22 17:42:58 +0100 | [diff] [blame^] | 225 | $(LD_romstage) -nostdlib -nostartfiles -static -o $@ -L$(obj) --start-group $(romstage-objs) $(romstage-libs) $(COMPILER_RT_romstage) --end-group -T $(objgenerated)/romstage_xip.ld |
Patrick Georgi | 68b5da0e | 2012-03-11 20:15:21 +0100 | [diff] [blame] | 226 | else |
Patrick Georgi | 3ce96bd | 2014-11-22 17:42:58 +0100 | [diff] [blame^] | 227 | $(CC_romstage) $(CFLAGS_romstage) -nostdlib -nostartfiles -static -o $@ -L$(obj) -T $(objgenerated)/romstage_xip.ld -Wl,--wrap,__divdi3 -Wl,--wrap,__udivdi3 -Wl,--wrap,__moddi3 -Wl,--wrap,__umoddi3 -Wl,--start-group $(romstage-objs) $(romstage-libs) $(COMPILER_RT_romstage) -Wl,--end-group |
Patrick Georgi | 68b5da0e | 2012-03-11 20:15:21 +0100 | [diff] [blame] | 228 | endif |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 229 | |
Kyösti Mälkki | 1e9c1b3 | 2012-04-19 14:43:47 +0300 | [diff] [blame] | 230 | $(objgenerated)/romstage_null.ld: $$(ldscripts) $(obj)/ldoptions |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 231 | @printf " GEN $(subst $(obj)/,,$(@))\n" |
Kyösti Mälkki | a01ec14 | 2012-03-31 10:21:29 +0300 | [diff] [blame] | 232 | rm -f $@ |
| 233 | printf "ROMSTAGE_BASE = 0x0;\n" > $@.tmp |
| 234 | printf '$(foreach ldscript,ldoptions $(ldscripts),INCLUDE "$(ldscript:$(obj)/%=%)"\n)' >> $@.tmp |
| 235 | mv $@.tmp $@ |
| 236 | |
Kyösti Mälkki | 1e9c1b3 | 2012-04-19 14:43:47 +0300 | [diff] [blame] | 237 | $(objgenerated)/romstage_xip.ld: $(objgenerated)/romstage_null.ld $(objcbfs)/base_xip.txt |
Kyösti Mälkki | a01ec14 | 2012-03-31 10:21:29 +0300 | [diff] [blame] | 238 | @printf " GEN $(subst $(obj)/,,$(@))\n" |
| 239 | rm -f $@ |
Kyösti Mälkki | 1e9c1b3 | 2012-04-19 14:43:47 +0300 | [diff] [blame] | 240 | sed -e 's/^/ROMSTAGE_BASE = /g' -e 's/$$/;/g' $(objcbfs)/base_xip.txt > $@.tmp |
| 241 | sed -e '/ROMSTAGE_BASE/d' $(objgenerated)/romstage_null.ld >> $@.tmp |
Kyösti Mälkki | a01ec14 | 2012-03-31 10:21:29 +0300 | [diff] [blame] | 242 | mv $@.tmp $@ |
| 243 | |
Kyösti Mälkki | 1e9c1b3 | 2012-04-19 14:43:47 +0300 | [diff] [blame] | 244 | $(objcbfs)/base_xip.txt: $(obj)/coreboot.pre1 $(objcbfs)/romstage_null.bin |
Kyösti Mälkki | a01ec14 | 2012-03-31 10:21:29 +0300 | [diff] [blame] | 245 | rm -f $@ |
Hung-Te Lin | e919837 | 2013-03-19 12:17:12 +0800 | [diff] [blame] | 246 | $(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älkki | a01ec14 | 2012-03-31 10:21:29 +0300 | [diff] [blame] | 247 | || { echo "The romstage is larger than XIP size. Please expand the CONFIG_XIP_ROM_SIZE" ; exit 1; } |
Hung-Te Lin | 657ea6a | 2013-01-28 23:00:47 +0800 | [diff] [blame] | 248 | mv $@.tmp $@ |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 249 | |
Marc Jones | 49fe74b | 2012-05-14 16:20:26 -0600 | [diff] [blame] | 250 | $(objgenerated)/crt0.romstage.S: $$(crt0s) |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 251 | @printf " GEN $(subst $(obj)/,,$(@))\n" |
Patrick Georgi | 950f20a | 2012-01-17 13:13:59 +0100 | [diff] [blame] | 252 | printf '$(foreach crt0,$(crt0s),#include "$(crt0:$(obj)/%=%)"\n)' > $@ |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 253 | |
Kyösti Mälkki | 1e9c1b3 | 2012-04-19 14:43:47 +0300 | [diff] [blame] | 254 | $(objgenerated)/crt0.romstage.o: $(objgenerated)/crt0.s |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 255 | @printf " CC $(subst $(obj)/,,$(@))\n" |
Patrick Georgi | 5930774 | 2014-05-19 09:23:57 +0200 | [diff] [blame] | 256 | $(CC_romstage) $(CFLAGS_x86_32) $(DISASSEMBLY) -c -o $@ $< > $(basename $@).disasm |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 257 | |
Marc Jones | 49fe74b | 2012-05-14 16:20:26 -0600 | [diff] [blame] | 258 | $(objgenerated)/crt0.s: $(objgenerated)/crt0.romstage.S $(obj)/config.h $(obj)/build.h |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 259 | @printf " CC $(subst $(obj)/,,$(@))\n" |
Patrick Georgi | 5930774 | 2014-05-19 09:23:57 +0200 | [diff] [blame] | 260 | $(CC_romstage) $(CPPFLAGS_romstage) -MMD -x assembler-with-cpp -E -I$(src)/include -I$(src)/arch/x86/include -I$(obj) -include $(obj)/config.h -include $(obj)/build.h -I. -I$(src) $< -o $@ |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 261 | |
| 262 | endif # CONFIG_ARCH_ROMSTAGE_X86_32 |
Stefan Reinauer | f1939bb | 2010-12-30 17:39:50 +0000 | [diff] [blame] | 263 | |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 264 | ############################################################################### |
| 265 | # ramstage |
| 266 | ############################################################################### |
| 267 | |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 268 | ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32),y) |
| 269 | |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 270 | ramstage-srcs += $(wildcard src/mainboard/$(MAINBOARDDIR)/mainboard.c) |
| 271 | ifeq ($(CONFIG_GENERATE_MP_TABLE),y) |
| 272 | ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/mptable.c),) |
| 273 | ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/mptable.c |
| 274 | endif |
| 275 | endif |
| 276 | ifeq ($(CONFIG_GENERATE_PIRQ_TABLE),y) |
| 277 | ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/irq_tables.c |
| 278 | endif |
| 279 | ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/reset.c),) |
| 280 | ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/reset.c |
| 281 | endif |
Vladimir Serbinenko | 822bc65 | 2014-01-03 15:55:40 +0100 | [diff] [blame] | 282 | ifeq ($(CONFIG_HAVE_ACPI_TABLES),y) |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 283 | ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/acpi_tables.c |
| 284 | ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/dsdt.asl |
| 285 | ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/ssdt2.asl),) |
| 286 | ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/ssdt2.asl |
| 287 | endif |
| 288 | ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/ssdt3.asl),) |
| 289 | ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/ssdt3.asl |
| 290 | endif |
| 291 | ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/ssdt4.asl),) |
| 292 | ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/ssdt4.asl |
| 293 | endif |
| 294 | ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/ssdt5.asl),) |
| 295 | ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/ssdt5.asl |
| 296 | endif |
| 297 | ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/fadt.c),) |
| 298 | ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/fadt.c |
| 299 | endif |
| 300 | endif |
| 301 | ifeq ($(CONFIG_HAVE_SMI_HANDLER),y) |
| 302 | ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/smihandler.c),) |
| 303 | smm-srcs += src/mainboard/$(MAINBOARDDIR)/smihandler.c |
| 304 | endif |
| 305 | endif |
| 306 | ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/get_bus_conf.c),) |
| 307 | ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/get_bus_conf.c |
| 308 | endif |
| 309 | |
| 310 | ramstage-libs ?= |
| 311 | |
| 312 | ifeq ($(CONFIG_RELOCATABLE_RAMSTAGE),y) |
| 313 | |
Furquan Shaikh | 133096b | 2014-07-31 09:28:55 -0700 | [diff] [blame] | 314 | $(eval $(call rmodule_link,$(objcbfs)/ramstage.debug, $(objgenerated)/ramstage.o, $(CONFIG_HEAP_SIZE),x86_32)) |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 315 | |
| 316 | # The rmodule_link defintion creates an elf file with .rmod extension. |
| 317 | $(objcbfs)/ramstage.elf: $(objcbfs)/ramstage.debug.rmod |
| 318 | cp $< $@ |
| 319 | |
| 320 | else |
| 321 | |
| 322 | $(objcbfs)/ramstage.debug: $(objgenerated)/ramstage.o $(src)/arch/x86/ramstage.ld |
| 323 | @printf " CC $(subst $(obj)/,,$(@))\n" |
| 324 | ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y) |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 325 | $(LD_ramstage) -m elf_i386 -o $@ -L$(obj) $< -T $(src)/arch/x86/ramstage.ld |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 326 | else |
Patrick Georgi | 5930774 | 2014-05-19 09:23:57 +0200 | [diff] [blame] | 327 | $(CC_ramstage) $(CFLAGS_ramstage) -nostdlib -nostartfiles -static -o $@ -L$(obj) -T $(src)/arch/x86/ramstage.ld $< |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 328 | endif |
| 329 | |
| 330 | endif |
| 331 | |
Patrick Georgi | 3ce96bd | 2014-11-22 17:42:58 +0100 | [diff] [blame^] | 332 | $(objgenerated)/ramstage.o: $$(ramstage-objs) $(COMPILER_RT_ramstage) $$(ramstage-libs) |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 333 | @printf " CC $(subst $(obj)/,,$(@))\n" |
| 334 | ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y) |
Patrick Georgi | 3ce96bd | 2014-11-22 17:42:58 +0100 | [diff] [blame^] | 335 | $(LD_ramstage) -m elf_i386 -r -o $@ --start-group $(ramstage-objs) $(ramstage-libs) $(COMPILER_RT_ramstage) --end-group |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 336 | else |
Patrick Georgi | 3ce96bd | 2014-11-22 17:42:58 +0100 | [diff] [blame^] | 337 | $(CC_ramstage) $(CFLAGS_ramstage) -nostdlib -r -o $@ -Wl,--wrap,__divdi3 -Wl,--wrap,__udivdi3 -Wl,--wrap,__moddi3 -Wl,--wrap,__umoddi3 -Wl,--start-group $(ramstage-objs) $(ramstage-libs) $(COMPILER_RT_ramstage) -Wl,--end-group |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 338 | endif |
| 339 | |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 340 | endif # CONFIG_ARCH_RAMSTAGE_X86_32 |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 341 | |
| 342 | ################################################################################ |
| 343 | |
Stefan Reinauer | f1939bb | 2010-12-30 17:39:50 +0000 | [diff] [blame] | 344 | seabios: |
| 345 | $(MAKE) -C payloads/external/SeaBIOS -f Makefile.inc \ |
Peter Stuge | b1d1c4d | 2011-02-07 20:16:40 +0000 | [diff] [blame] | 346 | HOSTCC="$(HOSTCC)" \ |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 347 | CC="$(CC_x86_32)" LD="$(LD_x86_32)" OBJDUMP="$(OBJDUMP_x86_32)" \ |
| 348 | OBJCOPY="$(OBJCOPY_x86_32)" STRIP="$(STRIP_x86_32)" \ |
Patrick Georgi | 31dbb53 | 2014-05-10 14:21:38 +0200 | [diff] [blame] | 349 | AS="$(AS_x86_32)" \ |
Stefan Reinauer | f1939bb | 2010-12-30 17:39:50 +0000 | [diff] [blame] | 350 | CONFIG_SEABIOS_MASTER=$(CONFIG_SEABIOS_MASTER) \ |
Stefan Reinauer | aff6dc2 | 2012-01-21 10:34:22 -0800 | [diff] [blame] | 351 | CONFIG_SEABIOS_STABLE=$(CONFIG_SEABIOS_STABLE) \ |
Idwer Vollering | 7c1a49b | 2014-04-01 22:47:33 +0000 | [diff] [blame] | 352 | CONFIG_SEABIOS_THREAD_OPTIONROMS=$(CONFIG_SEABIOS_THREAD_OPTIONROMS) \ |
Edward O'Callaghan | a296f9e | 2014-09-13 03:43:49 +1000 | [diff] [blame] | 353 | CONFIG_SEABIOS_VGA_COREBOOT=$(CONFIG_SEABIOS_VGA_COREBOOT) \ |
Martin Roth | 0d7f133 | 2014-07-25 14:33:49 -0600 | [diff] [blame] | 354 | CONFIG_CONSOLE_SERIAL=$(CONFIG_CONSOLE_SERIAL) \ |
| 355 | CONFIG_TTYS0_BASE=$(CONFIG_TTYS0_BASE) \ |
Martin Roth | 4d7d25f | 2014-07-25 14:39:05 -0600 | [diff] [blame] | 356 | CONFIG_SEABIOS_MALLOC_UPPERMEMORY=$(CONFIG_SEABIOS_MALLOC_UPPERMEMORY) \ |
Marc Jones | c2dff7f | 2012-05-14 21:06:10 -0600 | [diff] [blame] | 357 | OUT=$(abspath $(obj)) IASL="$(IASL)" |
Stefan Reinauer | aff6dc2 | 2012-01-21 10:34:22 -0800 | [diff] [blame] | 358 | |
Stefan Reinauer | e50952f | 2011-04-15 03:34:05 +0000 | [diff] [blame] | 359 | filo: |
| 360 | $(MAKE) -C payloads/external/FILO -f Makefile.inc \ |
| 361 | HOSTCC="$(HOSTCC)" \ |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 362 | CC="$(CC_x86_32)" LD="$(LD_x86_32)" OBJDUMP="$(OBJDUMP_x86_32)" \ |
| 363 | OBJCOPY="$(OBJCOPY_x86_32)" STRIP="$(STRIP_x86_32)" \ |
Stefan Reinauer | e50952f | 2011-04-15 03:34:05 +0000 | [diff] [blame] | 364 | CONFIG_FILO_MASTER=$(CONFIG_FILO_MASTER) \ |
| 365 | CONFIG_FILO_STABLE=$(CONFIG_FILO_STABLE) |
Stefan Reinauer | f1939bb | 2010-12-30 17:39:50 +0000 | [diff] [blame] | 366 | |
Vladimir Serbinenko | 113a366 | 2013-11-14 12:10:08 +0100 | [diff] [blame] | 367 | |
| 368 | grub2: |
| 369 | $(MAKE) -C payloads/external/GRUB2 -f Makefile.inc \ |
| 370 | HOSTCC="$(HOSTCC)" \ |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 371 | CC="$(CC_x86_32)" LD="$(LD_x86_32)" OBJDUMP="$(OBJDUMP_x86_32)" \ |
| 372 | OBJCOPY="$(OBJCOPY_x86_32)" STRIP="$(STRIP_x86_32)" \ |
Vladimir Serbinenko | 113a366 | 2013-11-14 12:10:08 +0100 | [diff] [blame] | 373 | CONFIG_GRUB2_MASTER=$(CONFIG_GRUB2_MASTER) |