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 |
| 33 | DISASSEMBLY= |
| 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) )) |
| 56 | CBFSTOOL_PRE_OPTS = -b $(shell cat $(objcbfs)/base_xip.txt) |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 57 | endif |
Patrick Georgi | ff9d78c | 2011-01-30 16:37:39 +0000 | [diff] [blame] | 58 | |
Alexandru Gagniuc | 00b579a | 2012-07-20 00:11:21 -0500 | [diff] [blame] | 59 | ################################################################################ |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 60 | # i386 specific tools |
Vikram Narayanan | a8111cf | 2012-04-14 15:25:13 +0530 | [diff] [blame] | 61 | NVRAMTOOL:=$(objutil)/nvramtool/nvramtool |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 62 | |
Vikram Narayanan | a8111cf | 2012-04-14 15:25:13 +0530 | [diff] [blame] | 63 | $(OPTION_TABLE_H): $(NVRAMTOOL) $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout |
Uwe Hermann | 6c73b441 | 2009-10-28 17:10:51 +0000 | [diff] [blame] | 64 | @printf " OPTION $(subst $(obj)/,,$(@))\n" |
Vikram Narayanan | a8111cf | 2012-04-14 15:25:13 +0530 | [diff] [blame] | 65 | $(NVRAMTOOL) -y $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout -H $@ |
Patrick Georgi | 1c797a1 | 2010-04-15 14:32:17 +0000 | [diff] [blame] | 66 | |
Vikram Narayanan | a8111cf | 2012-04-14 15:25:13 +0530 | [diff] [blame] | 67 | $(obj)/cmos_layout.bin: $(NVRAMTOOL) $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout |
Patrick Georgi | 1c797a1 | 2010-04-15 14:32:17 +0000 | [diff] [blame] | 68 | @printf " OPTION $(subst $(obj)/,,$(@))\n" |
Vikram Narayanan | a8111cf | 2012-04-14 15:25:13 +0530 | [diff] [blame] | 69 | $(NVRAMTOOL) -y $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout -L $@ |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 70 | |
Kyösti Mälkki | 0db2ae3a | 2012-04-19 12:00:06 +0300 | [diff] [blame] | 71 | |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 72 | ############################################################################### |
| 73 | # bootblock |
| 74 | ############################################################################### |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 75 | |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 76 | ifeq ($(CONFIG_ARCH_BOOTBLOCK_X86_32),y) |
| 77 | |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 78 | bootblock_lds = $(src)/arch/x86/init/ldscript_failover.lb |
| 79 | bootblock_lds += $(src)/cpu/x86/16bit/entry16.lds |
| 80 | bootblock_lds += $(src)/cpu/x86/16bit/reset16.lds |
| 81 | bootblock_lds += $(src)/arch/x86/lib/id.lds |
| 82 | bootblock_lds += $(chipset_bootblock_lds) |
Aaron Durbin | 6dccedd | 2012-12-03 16:17:40 -0600 | [diff] [blame] | 83 | ifeq ($(CONFIG_CPU_INTEL_FIRMWARE_INTERFACE_TABLE),y) |
| 84 | bootblock_lds += $(src)/cpu/intel/fit/fit.lds |
| 85 | endif |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 86 | |
| 87 | bootblock_inc = $(src)/arch/x86/init/prologue.inc |
| 88 | bootblock_inc += $(src)/cpu/x86/16bit/entry16.inc |
| 89 | bootblock_inc += $(src)/cpu/x86/16bit/reset16.inc |
| 90 | bootblock_inc += $(src)/cpu/x86/32bit/entry32.inc |
| 91 | bootblock_inc += $(src)/arch/x86/lib/id.inc |
Aaron Durbin | 6dccedd | 2012-12-03 16:17:40 -0600 | [diff] [blame] | 92 | ifeq ($(CONFIG_CPU_INTEL_FIRMWARE_INTERFACE_TABLE),y) |
| 93 | bootblock_inc += $(src)/cpu/intel/fit/fit.inc |
| 94 | endif |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 95 | bootblock_inc += $(chipset_bootblock_inc) |
| 96 | |
| 97 | ifeq ($(CONFIG_SSE),y) |
| 98 | bootblock_inc += $(src)/cpu/x86/sse_enable.inc |
| 99 | endif |
Kyösti Mälkki | f775b8c | 2012-04-19 12:14:53 +0300 | [diff] [blame] | 100 | bootblock_inc += $(objgenerated)/bootblock.inc |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 101 | bootblock_inc += $(src)/arch/x86/lib/walkcbfs.S |
| 102 | |
Kyösti Mälkki | e8792be | 2014-02-26 15:19:04 +0200 | [diff] [blame] | 103 | bootblock_romccflags := -mcpu=i386 -O2 -D__PRE_RAM__ -D__BOOT_BLOCK__ |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 104 | ifeq ($(CONFIG_SSE),y) |
Kyösti Mälkki | e8792be | 2014-02-26 15:19:04 +0200 | [diff] [blame] | 105 | bootblock_romccflags := -mcpu=k7 -msse -O2 -D__PRE_RAM__ -D__BOOT_BLOCK__ |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 106 | endif |
| 107 | |
Kyösti Mälkki | f775b8c | 2012-04-19 12:14:53 +0300 | [diff] [blame] | 108 | $(objgenerated)/bootblock.ld: $$(bootblock_lds) $(obj)/ldoptions |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 109 | @printf " GEN $(subst $(obj)/,,$(@))\n" |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 110 | printf '$(foreach ldscript,ldoptions $(bootblock_lds),INCLUDE "$(ldscript)"\n)' > $@ |
| 111 | |
Marc Jones | 49fe74b | 2012-05-14 16:20:26 -0600 | [diff] [blame] | 112 | $(objgenerated)/bootblock_inc.S: $$(bootblock_inc) |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 113 | @printf " GEN $(subst $(obj)/,,$(@))\n" |
Patrick Georgi | 950f20a | 2012-01-17 13:13:59 +0100 | [diff] [blame] | 114 | printf '$(foreach crt0,$(bootblock_inc),#include "$(crt0)"\n)' > $@ |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 115 | |
Kyösti Mälkki | f775b8c | 2012-04-19 12:14:53 +0300 | [diff] [blame] | 116 | $(objgenerated)/bootblock.o: $(objgenerated)/bootblock.s |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 117 | @printf " CC $(subst $(obj)/,,$(@))\n" |
Patrick Georgi | 5930774 | 2014-05-19 09:23:57 +0200 | [diff] [blame] | 118 | $(CC_bootblock) $(CFLAGS_x86_32) $(DISASSEMBLY) -c -o $@ $< > $(basename $@).disasm |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 119 | |
Marc Jones | 49fe74b | 2012-05-14 16:20:26 -0600 | [diff] [blame] | 120 | $(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] | 121 | @printf " CC $(subst $(obj)/,,$(@))\n" |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 122 | $(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] | 123 | |
Kyösti Mälkki | f775b8c | 2012-04-19 12:14:53 +0300 | [diff] [blame] | 124 | $(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] | 125 | @printf " ROMCC $(subst $(obj)/,,$(@))\n" |
Patrick Georgi | 5930774 | 2014-05-19 09:23:57 +0200 | [diff] [blame] | 126 | $(CC_bootblock) $(CPPFLAGS_bootblock) -MM -MT$(objgenerated)/bootblock.inc \ |
Kyösti Mälkki | f775b8c | 2012-04-19 12:14:53 +0300 | [diff] [blame] | 127 | $< > $(objgenerated)/bootblock.inc.d |
Patrick Georgi | 5930774 | 2014-05-19 09:23:57 +0200 | [diff] [blame] | 128 | $(ROMCC) -c -S $(bootblock_romccflags) -I. $(CPPFLAGS_bootblock) $< -o $@ |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 129 | |
Kyösti Mälkki | f775b8c | 2012-04-19 12:14:53 +0300 | [diff] [blame] | 130 | $(objcbfs)/bootblock.debug: $(objgenerated)/bootblock.o $(objgenerated)/bootblock.ld |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 131 | @printf " LINK $(subst $(obj)/,,$(@))\n" |
Patrick Georgi | 68b5da0e | 2012-03-11 20:15:21 +0100 | [diff] [blame] | 132 | ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y) |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 133 | $(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] | 134 | else |
Patrick Georgi | 5930774 | 2014-05-19 09:23:57 +0200 | [diff] [blame] | 135 | $(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] | 136 | endif |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 137 | |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 138 | |
| 139 | endif # CONFIG_ARCH_BOOTBLOCK_X86_32 |
| 140 | |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 141 | ############################################################################### |
| 142 | # romstage |
| 143 | ############################################################################### |
| 144 | |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 145 | ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32),y) |
| 146 | |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 147 | crt0s = $(src)/arch/x86/init/prologue.inc |
| 148 | ldscripts = |
| 149 | ldscripts += $(src)/arch/x86/init/romstage.ld |
| 150 | crt0s += $(src)/cpu/x86/32bit/entry32.inc |
| 151 | ldscripts += $(src)/cpu/x86/32bit/entry32.lds |
| 152 | |
| 153 | crt0s += $(src)/cpu/x86/fpu_enable.inc |
| 154 | ifeq ($(CONFIG_SSE),y) |
| 155 | crt0s += $(src)/cpu/x86/sse_enable.inc |
| 156 | endif |
| 157 | |
| 158 | crt0s += $(cpu_incs) |
| 159 | crt0s += $(cpu_incs-y) |
| 160 | |
| 161 | crt0s += $(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc |
| 162 | |
| 163 | ifeq ($(CONFIG_ROMCC),y) |
| 164 | crt0s += $(src)/arch/x86/init/crt0_romcc_epilogue.inc |
| 165 | endif |
| 166 | |
| 167 | ifeq ($(CONFIG_ROMCC),y) |
| 168 | ifeq ($(CONFIG_MMX),y) |
| 169 | ifeq ($(CONFIG_SSE),y) |
| 170 | ROMCCFLAGS := -mcpu=p4 -O2 # MMX, SSE |
| 171 | else |
| 172 | ROMCCFLAGS := -mcpu=p2 -O2 # MMX, !SSE |
| 173 | endif |
| 174 | else |
| 175 | ROMCCFLAGS := -mcpu=i386 -O2 # !MMX, !SSE |
| 176 | endif |
| 177 | |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 178 | $(objcbfs)/romstage_%.bin: $(objcbfs)/romstage_%.elf |
| 179 | @printf " OBJCOPY $(subst $(obj)/,,$(@))\n" |
| 180 | $(OBJCOPY_romstage) -O binary $< $@ |
| 181 | |
| 182 | $(objcbfs)/romstage_%.elf: $(objcbfs)/romstage_%.debug |
| 183 | @printf " OBJCOPY $(subst $(obj)/,,$(@))\n" |
| 184 | cp $< $@.tmp |
| 185 | $(OBJCOPY_romstage) --strip-debug $@.tmp |
| 186 | $(OBJCOPY_romstage) --add-gnu-debuglink=$< $@.tmp |
| 187 | mv $@.tmp $@ |
| 188 | |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 189 | $(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc: $(src)/mainboard/$(MAINBOARDDIR)/romstage.c $(objutil)/romcc/romcc $(OPTION_TABLE_H) $(obj)/build.h $(obj)/config.h |
| 190 | printf " ROMCC romstage.inc\n" |
Patrick Georgi | 5930774 | 2014-05-19 09:23:57 +0200 | [diff] [blame] | 191 | $(ROMCC) -c -S $(ROMCCFLAGS) -D__PRE_RAM__ -I. $(CPPFLAGS_romstage) $< -o $@ |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 192 | else |
| 193 | |
| 194 | $(obj)/mainboard/$(MAINBOARDDIR)/romstage.pre.inc: $(src)/mainboard/$(MAINBOARDDIR)/romstage.c $(OPTION_TABLE_H) $(obj)/build.h $(obj)/config.h |
| 195 | @printf " CC romstage.inc\n" |
Patrick Georgi | 5930774 | 2014-05-19 09:23:57 +0200 | [diff] [blame] | 196 | $(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] | 197 | |
| 198 | $(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc: $(obj)/mainboard/$(MAINBOARDDIR)/romstage.pre.inc |
| 199 | @printf " POST romstage.inc\n" |
| 200 | sed -e 's/\.rodata/.rom.data/g' -e 's/\^\.text/.section .rom.text/g' \ |
| 201 | -e 's/\^\.section \.text/.section .rom.text/g' $^ > $@.tmp |
| 202 | mv $@.tmp $@ |
| 203 | endif |
| 204 | |
| 205 | romstage-srcs += $(objgenerated)/crt0.s |
Kyösti Mälkki | a01ec14 | 2012-03-31 10:21:29 +0300 | [diff] [blame] | 206 | |
Alexandru Gagniuc | eb3c991 | 2014-03-29 13:01:11 -0500 | [diff] [blame] | 207 | romstage-libs ?= |
| 208 | |
| 209 | $(objcbfs)/romstage_null.debug: $$(romstage-objs) $(objgenerated)/romstage_null.ld $$(romstage-libs) |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 210 | @printf " LINK $(subst $(obj)/,,$(@))\n" |
Patrick Georgi | 68b5da0e | 2012-03-11 20:15:21 +0100 | [diff] [blame] | 211 | ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y) |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 212 | $(LD_romstage) -nostdlib -nostartfiles -static -o $@ -L$(obj) --wrap __divdi3 --wrap __udivdi3 --wrap __moddi3 --wrap __umoddi3 --start-group $(romstage-objs) $(romstage-libs) $(LIBGCC_FILE_NAME_romstage) --end-group -T $(objgenerated)/romstage_null.ld |
Patrick Georgi | 68b5da0e | 2012-03-11 20:15:21 +0100 | [diff] [blame] | 213 | else |
Patrick Georgi | 5930774 | 2014-05-19 09:23:57 +0200 | [diff] [blame] | 214 | $(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) $(LIBGCC_FILE_NAME_romstage) -Wl,--end-group |
Patrick Georgi | 68b5da0e | 2012-03-11 20:15:21 +0100 | [diff] [blame] | 215 | endif |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 216 | $(NM_romstage) $@ | grep -q " [DdBb] "; if [ $$? -eq 0 ]; then \ |
Stefan Reinauer | b6e1237 | 2012-07-31 14:52:04 -0700 | [diff] [blame] | 217 | echo "Forbidden global variables in romstage:"; \ |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 218 | $(NM_romstage) $@ | grep " [DdBb] "; test "$(CONFIG_CPU_AMD_AGESA)" = y; \ |
Stefan Reinauer | b6e1237 | 2012-07-31 14:52:04 -0700 | [diff] [blame] | 219 | else true; fi |
Kyösti Mälkki | a01ec14 | 2012-03-31 10:21:29 +0300 | [diff] [blame] | 220 | |
Alexandru Gagniuc | eb3c991 | 2014-03-29 13:01:11 -0500 | [diff] [blame] | 221 | $(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] | 222 | @printf " LINK $(subst $(obj)/,,$(@))\n" |
Patrick Georgi | 68b5da0e | 2012-03-11 20:15:21 +0100 | [diff] [blame] | 223 | ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y) |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 224 | $(LD_romstage) -nostdlib -nostartfiles -static -o $@ -L$(obj) --wrap __divdi3 --wrap __udivdi3 --wrap __moddi3 --wrap __umoddi3 --start-group $(romstage-objs) $(romstage-libs) $(LIBGCC_FILE_NAME_romstage) --end-group -T $(objgenerated)/romstage_xip.ld |
Patrick Georgi | 68b5da0e | 2012-03-11 20:15:21 +0100 | [diff] [blame] | 225 | else |
Patrick Georgi | 5930774 | 2014-05-19 09:23:57 +0200 | [diff] [blame] | 226 | $(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) $(LIBGCC_FILE_NAME_romstage) -Wl,--end-group |
Patrick Georgi | 68b5da0e | 2012-03-11 20:15:21 +0100 | [diff] [blame] | 227 | endif |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 228 | |
Kyösti Mälkki | 1e9c1b3 | 2012-04-19 14:43:47 +0300 | [diff] [blame] | 229 | $(objgenerated)/romstage_null.ld: $$(ldscripts) $(obj)/ldoptions |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 230 | @printf " GEN $(subst $(obj)/,,$(@))\n" |
Kyösti Mälkki | a01ec14 | 2012-03-31 10:21:29 +0300 | [diff] [blame] | 231 | rm -f $@ |
| 232 | printf "ROMSTAGE_BASE = 0x0;\n" > $@.tmp |
| 233 | printf '$(foreach ldscript,ldoptions $(ldscripts),INCLUDE "$(ldscript:$(obj)/%=%)"\n)' >> $@.tmp |
| 234 | mv $@.tmp $@ |
| 235 | |
Kyösti Mälkki | 1e9c1b3 | 2012-04-19 14:43:47 +0300 | [diff] [blame] | 236 | $(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] | 237 | @printf " GEN $(subst $(obj)/,,$(@))\n" |
| 238 | rm -f $@ |
Kyösti Mälkki | 1e9c1b3 | 2012-04-19 14:43:47 +0300 | [diff] [blame] | 239 | sed -e 's/^/ROMSTAGE_BASE = /g' -e 's/$$/;/g' $(objcbfs)/base_xip.txt > $@.tmp |
| 240 | sed -e '/ROMSTAGE_BASE/d' $(objgenerated)/romstage_null.ld >> $@.tmp |
Kyösti Mälkki | a01ec14 | 2012-03-31 10:21:29 +0300 | [diff] [blame] | 241 | mv $@.tmp $@ |
| 242 | |
Kyösti Mälkki | 1e9c1b3 | 2012-04-19 14:43:47 +0300 | [diff] [blame] | 243 | $(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] | 244 | rm -f $@ |
Hung-Te Lin | e919837 | 2013-03-19 12:17:12 +0800 | [diff] [blame] | 245 | $(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] | 246 | || { 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] | 247 | mv $@.tmp $@ |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 248 | |
Marc Jones | 49fe74b | 2012-05-14 16:20:26 -0600 | [diff] [blame] | 249 | $(objgenerated)/crt0.romstage.S: $$(crt0s) |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 250 | @printf " GEN $(subst $(obj)/,,$(@))\n" |
Patrick Georgi | 950f20a | 2012-01-17 13:13:59 +0100 | [diff] [blame] | 251 | printf '$(foreach crt0,$(crt0s),#include "$(crt0:$(obj)/%=%)"\n)' > $@ |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 252 | |
Kyösti Mälkki | 1e9c1b3 | 2012-04-19 14:43:47 +0300 | [diff] [blame] | 253 | $(objgenerated)/crt0.romstage.o: $(objgenerated)/crt0.s |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 254 | @printf " CC $(subst $(obj)/,,$(@))\n" |
Patrick Georgi | 5930774 | 2014-05-19 09:23:57 +0200 | [diff] [blame] | 255 | $(CC_romstage) $(CFLAGS_x86_32) $(DISASSEMBLY) -c -o $@ $< > $(basename $@).disasm |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 256 | |
Marc Jones | 49fe74b | 2012-05-14 16:20:26 -0600 | [diff] [blame] | 257 | $(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] | 258 | @printf " CC $(subst $(obj)/,,$(@))\n" |
Patrick Georgi | 5930774 | 2014-05-19 09:23:57 +0200 | [diff] [blame] | 259 | $(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] | 260 | |
| 261 | endif # CONFIG_ARCH_ROMSTAGE_X86_32 |
Stefan Reinauer | f1939bb | 2010-12-30 17:39:50 +0000 | [diff] [blame] | 262 | |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 263 | ############################################################################### |
| 264 | # ramstage |
| 265 | ############################################################################### |
| 266 | |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 267 | ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32),y) |
| 268 | |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 269 | ramstage-srcs += $(wildcard src/mainboard/$(MAINBOARDDIR)/mainboard.c) |
| 270 | ifeq ($(CONFIG_GENERATE_MP_TABLE),y) |
| 271 | ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/mptable.c),) |
| 272 | ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/mptable.c |
| 273 | endif |
| 274 | endif |
| 275 | ifeq ($(CONFIG_GENERATE_PIRQ_TABLE),y) |
| 276 | ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/irq_tables.c |
| 277 | endif |
| 278 | ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/reset.c),) |
| 279 | ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/reset.c |
| 280 | endif |
| 281 | ifeq ($(CONFIG_GENERATE_ACPI_TABLES),y) |
| 282 | ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/acpi_tables.c |
| 283 | ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/dsdt.asl |
| 284 | ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/ssdt2.asl),) |
| 285 | ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/ssdt2.asl |
| 286 | endif |
| 287 | ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/ssdt3.asl),) |
| 288 | ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/ssdt3.asl |
| 289 | endif |
| 290 | ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/ssdt4.asl),) |
| 291 | ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/ssdt4.asl |
| 292 | endif |
| 293 | ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/ssdt5.asl),) |
| 294 | ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/ssdt5.asl |
| 295 | endif |
| 296 | ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/fadt.c),) |
| 297 | ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/fadt.c |
| 298 | endif |
| 299 | endif |
| 300 | ifeq ($(CONFIG_HAVE_SMI_HANDLER),y) |
| 301 | ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/smihandler.c),) |
| 302 | smm-srcs += src/mainboard/$(MAINBOARDDIR)/smihandler.c |
| 303 | endif |
| 304 | endif |
| 305 | ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/get_bus_conf.c),) |
| 306 | ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/get_bus_conf.c |
| 307 | endif |
| 308 | |
| 309 | ramstage-libs ?= |
| 310 | |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 311 | $(eval $(call create_class_compiler,rmodules,x86_32)) |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 312 | ifeq ($(CONFIG_RELOCATABLE_RAMSTAGE),y) |
| 313 | |
| 314 | $(eval $(call rmodule_link,$(objcbfs)/ramstage.debug, $(objgenerated)/ramstage.o, $(CONFIG_HEAP_SIZE))) |
| 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 | |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 332 | $(objgenerated)/ramstage.o: $$(ramstage-objs) $(LIBGCC_FILE_NAME_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) |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 335 | $(LD_ramstage) -m elf_i386 -r -o $@ --wrap __divdi3 --wrap __udivdi3 --wrap __moddi3 --wrap __umoddi3 --start-group $(ramstage-objs) $(ramstage-libs) $(LIBGCC_FILE_NAME_ramstage) --end-group |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 336 | else |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [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) $(LIBGCC_FILE_NAME_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) \ |
Marc Jones | c2dff7f | 2012-05-14 21:06:10 -0600 | [diff] [blame] | 353 | OUT=$(abspath $(obj)) IASL="$(IASL)" |
Stefan Reinauer | aff6dc2 | 2012-01-21 10:34:22 -0800 | [diff] [blame] | 354 | |
Stefan Reinauer | e50952f | 2011-04-15 03:34:05 +0000 | [diff] [blame] | 355 | filo: |
| 356 | $(MAKE) -C payloads/external/FILO -f Makefile.inc \ |
| 357 | HOSTCC="$(HOSTCC)" \ |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 358 | CC="$(CC_x86_32)" LD="$(LD_x86_32)" OBJDUMP="$(OBJDUMP_x86_32)" \ |
| 359 | OBJCOPY="$(OBJCOPY_x86_32)" STRIP="$(STRIP_x86_32)" \ |
Stefan Reinauer | e50952f | 2011-04-15 03:34:05 +0000 | [diff] [blame] | 360 | CONFIG_FILO_MASTER=$(CONFIG_FILO_MASTER) \ |
| 361 | CONFIG_FILO_STABLE=$(CONFIG_FILO_STABLE) |
Stefan Reinauer | f1939bb | 2010-12-30 17:39:50 +0000 | [diff] [blame] | 362 | |
Vladimir Serbinenko | 113a366 | 2013-11-14 12:10:08 +0100 | [diff] [blame] | 363 | |
| 364 | grub2: |
| 365 | $(MAKE) -C payloads/external/GRUB2 -f Makefile.inc \ |
| 366 | HOSTCC="$(HOSTCC)" \ |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 367 | CC="$(CC_x86_32)" LD="$(LD_x86_32)" OBJDUMP="$(OBJDUMP_x86_32)" \ |
| 368 | OBJCOPY="$(OBJCOPY_x86_32)" STRIP="$(STRIP_x86_32)" \ |
Vladimir Serbinenko | 113a366 | 2013-11-14 12:10:08 +0100 | [diff] [blame] | 369 | CONFIG_GRUB2_MASTER=$(CONFIG_GRUB2_MASTER) |