2012-07-20 07:11:21 +02:00
|
|
|
################################################################################
|
2010-08-14 22:38:17 +02:00
|
|
|
##
|
|
|
|
## This file is part of the coreboot project.
|
|
|
|
##
|
2012-07-20 07:11:21 +02:00
|
|
|
## Copyright (C) 2012 Alexandru Gagniuc <mr.nuke.me@gmail.com>
|
2010-08-14 22:38:17 +02:00
|
|
|
## Copyright (C) 2009-2010 coresystems GmbH
|
|
|
|
## Copyright (C) 2009 Ronald G. Minnich
|
|
|
|
##
|
|
|
|
## This program is free software; you can redistribute it and/or modify
|
|
|
|
## it under the terms of the GNU General Public License as published by
|
|
|
|
## the Free Software Foundation; version 2 of the License.
|
|
|
|
##
|
|
|
|
## This program is distributed in the hope that it will be useful,
|
|
|
|
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
## GNU General Public License for more details.
|
|
|
|
##
|
|
|
|
## You should have received a copy of the GNU General Public License
|
|
|
|
## along with this program; if not, write to the Free Software
|
|
|
|
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
##
|
2012-07-20 07:11:21 +02:00
|
|
|
################################################################################
|
2010-08-14 22:38:17 +02:00
|
|
|
|
2009-08-12 17:00:51 +02:00
|
|
|
# Take care of subdirectories
|
|
|
|
subdirs-y += boot
|
2010-01-30 10:47:18 +01:00
|
|
|
# subdirs-y += init
|
2009-08-12 17:00:51 +02:00
|
|
|
subdirs-y += lib
|
|
|
|
subdirs-y += smp
|
|
|
|
|
2010-09-30 18:55:02 +02:00
|
|
|
OPTION_TABLE_H:=
|
|
|
|
ifeq ($(CONFIG_HAVE_OPTION_TABLE),y)
|
2011-01-30 17:31:15 +01:00
|
|
|
cbfs-files-y += cmos_layout.bin
|
|
|
|
cmos_layout.bin-file = $(obj)/cmos_layout.bin
|
|
|
|
cmos_layout.bin-type = 0x01aa
|
2011-01-18 14:56:36 +01:00
|
|
|
|
2010-09-30 18:55:02 +02:00
|
|
|
OPTION_TABLE_H:=$(obj)/option_table.h
|
|
|
|
endif
|
2009-08-12 17:00:51 +02:00
|
|
|
|
2012-07-20 07:11:21 +02:00
|
|
|
################################################################################
|
2009-08-12 17:00:51 +02:00
|
|
|
# Build the final rom image
|
2010-03-16 17:59:03 +01:00
|
|
|
COREBOOT_ROM_DEPENDENCIES:=
|
2010-12-30 18:39:50 +01:00
|
|
|
ifeq ($(CONFIG_PAYLOAD_ELF),y)
|
2010-12-19 22:20:14 +01:00
|
|
|
COREBOOT_ROM_DEPENDENCIES+=$(CONFIG_PAYLOAD_FILE)
|
2010-03-16 17:59:03 +01:00
|
|
|
endif
|
2010-12-30 18:39:50 +01:00
|
|
|
ifeq ($(CONFIG_PAYLOAD_SEABIOS),y)
|
|
|
|
COREBOOT_ROM_DEPENDENCIES+=seabios
|
|
|
|
endif
|
2011-04-15 05:34:05 +02:00
|
|
|
ifeq ($(CONFIG_PAYLOAD_FILO),y)
|
|
|
|
COREBOOT_ROM_DEPENDENCIES+=filo
|
|
|
|
endif
|
2010-03-30 23:52:05 +02:00
|
|
|
ifeq ($(CONFIG_AP_CODE_IN_CAR),y)
|
2012-04-19 13:22:43 +02:00
|
|
|
COREBOOT_ROM_DEPENDENCIES+=$(objcbfs)/coreboot_ap.elf
|
2010-03-30 23:52:05 +02:00
|
|
|
endif
|
|
|
|
|
2010-12-16 08:36:28 +01:00
|
|
|
extract_nth=$(word $(1), $(subst |, ,$(2)))
|
|
|
|
|
|
|
|
ifneq ($(CONFIG_UPDATE_IMAGE),y)
|
|
|
|
prebuild-files = \
|
|
|
|
$(foreach file,$(cbfs-files), \
|
2012-08-14 18:59:17 +02:00
|
|
|
$(CBFSTOOL) $@.tmp \
|
|
|
|
add$(if $(filter stage,$(call extract_nth,3,$(file))),-stage)$(if $(filter payload,$(call extract_nth,3,$(file))),-payload) \
|
2012-10-30 00:52:36 +01:00
|
|
|
-f $(call extract_nth,1,$(file)) \
|
|
|
|
-n $(call extract_nth,2,$(file)) $(if $(filter-out stage,$(call extract_nth,3,$(file))),-t $(call extract_nth,3,$(file))) \
|
|
|
|
$(if $(call extract_nth,4,$(file)),-b $(call extract_nth,4,$(file))) &&)
|
2010-12-16 08:36:28 +01:00
|
|
|
prebuilt-files = $(foreach file,$(cbfs-files), $(call extract_nth,1,$(file)))
|
|
|
|
|
2012-04-19 11:14:53 +02:00
|
|
|
$(obj)/coreboot.pre1: $(objcbfs)/bootblock.bin $$(prebuilt-files) $(CBFSTOOL)
|
2012-11-16 23:48:22 +01:00
|
|
|
$(CBFSTOOL) $@.tmp create -m x86 -s $(CONFIG_COREBOOT_ROMSIZE_KB)K \
|
2012-10-30 00:52:36 +01:00
|
|
|
-B $(objcbfs)/bootblock.bin -a 64 \
|
|
|
|
-o $$(( $(CONFIG_ROM_SIZE) - $(CONFIG_CBFS_SIZE) ))
|
2011-11-05 03:07:01 +01:00
|
|
|
$(prebuild-files) true
|
|
|
|
mv $@.tmp $@
|
2010-12-16 08:36:28 +01:00
|
|
|
else
|
2011-10-28 22:52:11 +02:00
|
|
|
.PHONY: $(obj)/coreboot.pre1
|
2010-12-16 08:36:28 +01:00
|
|
|
$(obj)/coreboot.pre1: $(CBFSTOOL)
|
|
|
|
mv $(obj)/coreboot.rom $@
|
|
|
|
endif
|
|
|
|
|
2012-08-16 23:05:42 +02:00
|
|
|
$(obj)/coreboot.rom: $(obj)/coreboot.pre $(objcbfs)/coreboot_ram.elf $(CBFSTOOL) $(call strip_quotes,$(COREBOOT_ROM_DEPENDENCIES)) $$(INTERMEDIATE)
|
2010-04-19 22:39:22 +02:00
|
|
|
@printf " CBFS $(subst $(obj)/,,$(@))\n"
|
2010-03-16 17:59:03 +01:00
|
|
|
cp $(obj)/coreboot.pre $@.tmp
|
2012-04-19 13:22:43 +02:00
|
|
|
if [ -f $(objcbfs)/coreboot_ap.elf ]; \
|
2009-08-12 17:00:51 +02:00
|
|
|
then \
|
2012-10-30 00:52:36 +01:00
|
|
|
$(CBFSTOOL) $@.tmp add-stage -f $(objcbfs)/coreboot_ap.elf -n $(CONFIG_CBFS_PREFIX)/coreboot_ap -c $(CBFS_COMPRESS_FLAG); \
|
2009-08-12 17:00:51 +02:00
|
|
|
fi
|
2012-10-30 00:52:36 +01:00
|
|
|
$(CBFSTOOL) $@.tmp add-stage -f $(objcbfs)/coreboot_ram.elf -n $(CONFIG_CBFS_PREFIX)/coreboot_ram -c $(CBFS_COMPRESS_FLAG)
|
2009-08-12 17:00:51 +02:00
|
|
|
ifeq ($(CONFIG_PAYLOAD_NONE),y)
|
2012-12-19 10:58:08 +01:00
|
|
|
@printf " PAYLOAD none (as specified by user)\n"
|
2010-12-30 18:39:50 +01:00
|
|
|
endif
|
|
|
|
ifeq ($(CONFIG_PAYLOAD_ELF),y)
|
2012-10-30 00:52:36 +01:00
|
|
|
@printf " PAYLOAD $(CONFIG_PAYLOAD_FILE) (compression: $(CBFS_PAYLOAD_COMPRESS_FLAG))\n"
|
|
|
|
$(CBFSTOOL) $@.tmp add-payload -f $(CONFIG_PAYLOAD_FILE) -n $(CONFIG_CBFS_PREFIX)/payload -c $(CBFS_PAYLOAD_COMPRESS_FLAG)
|
2009-10-23 14:14:15 +02:00
|
|
|
endif
|
2010-12-30 18:39:50 +01:00
|
|
|
ifeq ($(CONFIG_PAYLOAD_SEABIOS),y)
|
2012-10-30 00:52:36 +01:00
|
|
|
@printf " PAYLOAD SeaBIOS (internal, compression: $(CBFS_PAYLOAD_COMPRESS_FLAG))\n"
|
|
|
|
$(CBFSTOOL) $@.tmp add-payload -f $(CONFIG_PAYLOAD_FILE) -n $(CONFIG_CBFS_PREFIX)/payload -c $(CBFS_PAYLOAD_COMPRESS_FLAG)
|
2010-12-30 18:39:50 +01:00
|
|
|
endif
|
2011-04-15 05:34:05 +02:00
|
|
|
ifeq ($(CONFIG_PAYLOAD_FILO),y)
|
2012-10-30 00:52:36 +01:00
|
|
|
@printf " PAYLOAD FILO (internal, compression: $(CBFS_PAYLOAD_COMPRESS_FLAG))\n"
|
|
|
|
$(CBFSTOOL) $@.tmp add-payload -f $(CONFIG_PAYLOAD_FILE) -n $(CONFIG_CBFS_PREFIX)/payload -c $(CBFS_PAYLOAD_COMPRESS_FLAG)
|
2011-04-15 05:34:05 +02:00
|
|
|
endif
|
2013-01-16 02:02:58 +01:00
|
|
|
ifeq ($(CONFIG_PAYLOAD_TIANOCORE),y)
|
2013-02-04 19:15:06 +01:00
|
|
|
@printf " PAYLOAD Tiano Core (compression: $(CBFS_PAYLOAD_COMPRESS_FLAG))\n"
|
2013-02-05 22:58:29 +01:00
|
|
|
$(CBFSTOOL) $@.tmp add-payload -f $(CONFIG_PAYLOAD_FILE) -n $(CONFIG_CBFS_PREFIX)/payload -c $(CBFS_PAYLOAD_COMPRESS_FLAG)
|
2013-01-16 02:02:58 +01:00
|
|
|
endif
|
2011-06-19 03:03:28 +02:00
|
|
|
ifeq ($(CONFIG_INCLUDE_CONFIG_FILE),y)
|
|
|
|
@printf " CONFIG $(DOTCONFIG)\n"
|
|
|
|
if [ -f $(DOTCONFIG) ]; then \
|
|
|
|
echo "# This image was built using git revision" `git rev-parse HEAD` > $(obj)/config.tmp ; \
|
|
|
|
sed -e '/^#/d' -e '/^ *$$/d' $(DOTCONFIG) >> $(obj)/config.tmp ; \
|
2012-10-30 00:52:36 +01:00
|
|
|
$(CBFSTOOL) $@.tmp add -f $(obj)/config.tmp -n config -t raw; rm -f $(obj)/config.tmp ; fi
|
2009-08-17 16:46:13 +02:00
|
|
|
endif
|
2010-03-16 17:59:03 +01:00
|
|
|
mv $@.tmp $@
|
2010-04-19 22:39:22 +02:00
|
|
|
@printf " CBFSPRINT $(subst $(obj)/,,$(@))\n\n"
|
2010-03-16 17:59:03 +01:00
|
|
|
$(CBFSTOOL) $@ print
|
2009-08-12 17:00:51 +02:00
|
|
|
|
2011-01-30 17:37:39 +01:00
|
|
|
stripped_vgabios_id = $(call strip_quotes,$(CONFIG_VGA_BIOS_ID))
|
|
|
|
cbfs-files-$(CONFIG_VGA_BIOS) += pci$(stripped_vgabios_id).rom
|
|
|
|
pci$(stripped_vgabios_id).rom-file := $(call strip_quotes,$(CONFIG_VGA_BIOS_FILE))
|
|
|
|
pci$(stripped_vgabios_id).rom-type := optionrom
|
|
|
|
|
|
|
|
cbfs-files-$(CONFIG_INTEL_MBI) += mbi.bin
|
|
|
|
mbi.bin-file := $(call strip_quotes,$(CONFIG_MBI_FILE))
|
|
|
|
mbi.bin-type := mbi
|
|
|
|
|
|
|
|
cbfs-files-$(CONFIG_BOOTSPLASH) += bootsplash.jpg
|
|
|
|
bootsplash.jpg-file := $(call strip_quotes,$(CONFIG_BOOTSPLASH_FILE))
|
|
|
|
bootsplash.jpg-type := bootsplash
|
|
|
|
|
2012-07-20 07:11:21 +02:00
|
|
|
################################################################################
|
2009-08-12 17:00:51 +02:00
|
|
|
# i386 specific tools
|
2012-04-14 11:55:13 +02:00
|
|
|
NVRAMTOOL:=$(objutil)/nvramtool/nvramtool
|
2009-08-12 17:00:51 +02:00
|
|
|
|
2012-04-14 11:55:13 +02:00
|
|
|
$(OPTION_TABLE_H): $(NVRAMTOOL) $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout
|
2009-10-28 18:10:51 +01:00
|
|
|
@printf " OPTION $(subst $(obj)/,,$(@))\n"
|
2012-04-14 11:55:13 +02:00
|
|
|
$(NVRAMTOOL) -y $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout -H $@
|
2010-04-15 16:32:17 +02:00
|
|
|
|
2012-04-14 11:55:13 +02:00
|
|
|
$(obj)/cmos_layout.bin: $(NVRAMTOOL) $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout
|
2010-04-15 16:32:17 +02:00
|
|
|
@printf " OPTION $(subst $(obj)/,,$(@))\n"
|
2012-04-14 11:55:13 +02:00
|
|
|
$(NVRAMTOOL) -y $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout -L $@
|
2009-08-12 17:00:51 +02:00
|
|
|
|
2012-07-20 07:11:21 +02:00
|
|
|
################################################################################
|
2012-04-19 11:00:06 +02:00
|
|
|
# Common recipes for all stages
|
|
|
|
|
|
|
|
$(objcbfs)/%.bin: $(objcbfs)/%.elf
|
|
|
|
@printf " OBJCOPY $(subst $(obj)/,,$(@))\n"
|
|
|
|
$(OBJCOPY) -O binary $< $@
|
|
|
|
|
|
|
|
$(objcbfs)/%.elf: $(objcbfs)/%.debug
|
|
|
|
@printf " OBJCOPY $(subst $(obj)/,,$(@))\n"
|
|
|
|
cp $< $@.tmp
|
|
|
|
$(NM) -n $@.tmp | sort > $(basename $@).map
|
|
|
|
$(OBJCOPY) --strip-debug $@.tmp
|
|
|
|
$(OBJCOPY) --add-gnu-debuglink=$< $@.tmp
|
|
|
|
mv $@.tmp $@
|
|
|
|
|
2012-07-20 07:11:21 +02:00
|
|
|
################################################################################
|
2009-08-12 17:00:51 +02:00
|
|
|
# Build the coreboot_ram (stage 2)
|
|
|
|
|
2012-04-19 11:21:36 +02:00
|
|
|
$(objcbfs)/coreboot_ram.debug: $(objgenerated)/coreboot_ram.o $(src)/arch/x86/coreboot_ram.ld
|
2009-10-28 18:10:51 +01:00
|
|
|
@printf " CC $(subst $(obj)/,,$(@))\n"
|
2012-03-11 20:15:21 +01:00
|
|
|
ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y)
|
|
|
|
$(LD) -m elf_i386 -o $@ -L$(obj) $< -T $(src)/arch/x86/coreboot_ram.ld
|
|
|
|
else
|
2012-04-19 11:21:36 +02:00
|
|
|
$(CC) -nostdlib -nostartfiles -static -o $@ -L$(obj) -T $(src)/arch/x86/coreboot_ram.ld $<
|
2012-03-11 20:15:21 +01:00
|
|
|
endif
|
2009-08-12 17:00:51 +02:00
|
|
|
|
2012-11-25 17:31:25 +01:00
|
|
|
$(objgenerated)/coreboot_ram.o: $$(ramstage-objs) $(LIBGCC_FILE_NAME)
|
2009-10-28 18:10:51 +01:00
|
|
|
@printf " CC $(subst $(obj)/,,$(@))\n"
|
2012-03-11 20:15:21 +01:00
|
|
|
ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y)
|
2012-11-25 17:31:25 +01:00
|
|
|
$(LD) -m elf_i386 -r -o $@ --wrap __divdi3 --wrap __udivdi3 --wrap __moddi3 --wrap __umoddi3 --start-group $(ramstage-objs) $(LIBGCC_FILE_NAME) --end-group
|
2012-03-11 20:15:21 +01:00
|
|
|
else
|
Implement GCC code coverage analysis
In order to provide some insight on what code is executed during
coreboot's run time and how well our test scenarios work, this
adds code coverage support to coreboot's ram stage. This should
be easily adaptable for payloads, and maybe even romstage.
See http://gcc.gnu.org/onlinedocs/gcc/Gcov.html for
more information.
To instrument coreboot, select CONFIG_COVERAGE ("Code coverage
support") in Kconfig, and recompile coreboot. coreboot will then
store its code coverage information into CBMEM, if possible.
Then, run "cbmem -CV" as root on the target system running the
instrumented coreboot binary. This will create a whole bunch of
.gcda files that contain coverage information. Tar them up, copy
them to your build system machine, and untar them. Then you can
use your favorite coverage utility (gcov, lcov, ...) to visualize
code coverage.
For a sneak peak of what will expect you, please take a look
at http://www.coreboot.org/~stepan/coreboot-coverage/
Change-Id: Ib287d8309878a1f5c4be770c38b1bc0bb3aa6ec7
Signed-off-by: Stefan Reinauer <reinauer@google.com>
Reviewed-on: http://review.coreboot.org/2052
Tested-by: build bot (Jenkins)
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Martin Roth <martin@se-eng.com>
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
2012-12-19 01:23:28 +01:00
|
|
|
$(CC) $(CFLAGS) -nostdlib -r -o $@ -Wl,--wrap,__divdi3 -Wl,--wrap,__udivdi3 -Wl,--wrap,__moddi3 -Wl,--wrap,__umoddi3 -Wl,--start-group $(ramstage-objs) $(LIBGCC_FILE_NAME) -Wl,--end-group
|
2012-03-11 20:15:21 +01:00
|
|
|
endif
|
2009-08-12 17:00:51 +02:00
|
|
|
|
2012-07-20 07:11:21 +02:00
|
|
|
################################################################################
|
2012-04-19 13:22:43 +02:00
|
|
|
# Ramstage for AP CPU (AMD K8, obsolete?)
|
2010-03-30 23:52:05 +02:00
|
|
|
|
2012-04-19 13:22:43 +02:00
|
|
|
$(objcbfs)/coreboot_ap.debug: $(objgenerated)/coreboot_ap.o $(src)/arch/x86/init/ldscript_apc.lb
|
2010-03-30 23:52:05 +02:00
|
|
|
@printf " CC $(subst $(obj)/,,$(@))\n"
|
2012-04-19 13:22:43 +02:00
|
|
|
$(CC) -nostdlib -nostartfiles -static -o $@ -L$(obj) -T $(src)/arch/x86/init/ldscript_apc.lb $<
|
2010-03-30 23:52:05 +02:00
|
|
|
|
2012-04-19 13:22:43 +02:00
|
|
|
$(objgenerated)/coreboot_ap.o: $(src)/mainboard/$(MAINBOARDDIR)/ap_romstage.c $(OPTION_TABLE_H)
|
|
|
|
@printf " CC $(subst $(obj)/,,$(@))\n"
|
|
|
|
$(CC) -MMD $(CFLAGS) -I$(src) -D__PRE_RAM__ -I. -I$(obj) -c $< -o $@
|
2010-03-30 23:52:05 +02:00
|
|
|
|
2012-07-20 07:11:21 +02:00
|
|
|
################################################################################
|
2009-08-12 17:00:51 +02:00
|
|
|
# done
|
|
|
|
|
2010-12-11 21:33:41 +01:00
|
|
|
crt0s = $(src)/arch/x86/init/prologue.inc
|
2010-03-30 22:32:01 +02:00
|
|
|
ldscripts =
|
2012-05-11 21:23:45 +02:00
|
|
|
ldscripts += $(src)/arch/x86/init/romstage.ld
|
2010-02-25 18:03:17 +01:00
|
|
|
crt0s += $(src)/cpu/x86/32bit/entry32.inc
|
2010-02-25 22:50:26 +01:00
|
|
|
ldscripts += $(src)/cpu/x86/32bit/entry32.lds
|
2010-02-25 18:03:17 +01:00
|
|
|
|
|
|
|
crt0s += $(src)/cpu/x86/fpu_enable.inc
|
|
|
|
ifeq ($(CONFIG_SSE),y)
|
|
|
|
crt0s += $(src)/cpu/x86/sse_enable.inc
|
|
|
|
endif
|
|
|
|
|
2010-04-12 17:28:34 +02:00
|
|
|
crt0s += $(cpu_incs)
|
2012-02-28 13:01:34 +01:00
|
|
|
crt0s += $(cpu_incs-y)
|
2010-02-25 18:03:17 +01:00
|
|
|
|
2010-03-13 23:07:15 +01:00
|
|
|
ifeq ($(CONFIG_LLSHELL),y)
|
2010-12-11 21:33:41 +01:00
|
|
|
crt0s += $(src)/arch/x86/llshell/llshell.inc
|
2010-03-13 23:07:15 +01:00
|
|
|
endif
|
|
|
|
|
2010-02-25 18:03:17 +01:00
|
|
|
crt0s += $(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc
|
|
|
|
|
2010-04-08 23:04:45 +02:00
|
|
|
ifeq ($(CONFIG_ROMCC),y)
|
2010-12-11 21:33:41 +01:00
|
|
|
crt0s += $(src)/arch/x86/init/crt0_romcc_epilogue.inc
|
2010-04-08 23:04:45 +02:00
|
|
|
endif
|
|
|
|
|
2010-02-09 13:21:10 +01:00
|
|
|
ifeq ($(CONFIG_ROMCC),y)
|
2013-02-09 15:26:47 +01:00
|
|
|
ifeq ($(CONFIG_MMX),y)
|
|
|
|
ifeq ($(CONFIG_SSE),y)
|
|
|
|
ROMCCFLAGS := -mcpu=p4 -O2 # MMX, SSE
|
|
|
|
else
|
|
|
|
ROMCCFLAGS := -mcpu=p2 -O2 # MMX, !SSE
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
ROMCCFLAGS := -mcpu=i386 -O2 # !MMX, !SSE
|
|
|
|
endif
|
2010-02-09 13:21:10 +01:00
|
|
|
|
2010-04-17 01:01:34 +02:00
|
|
|
$(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc: $(src)/mainboard/$(MAINBOARDDIR)/romstage.c $(objutil)/romcc/romcc $(OPTION_TABLE_H) $(obj)/build.h $(obj)/config.h
|
2010-03-16 13:01:13 +01:00
|
|
|
printf " ROMCC romstage.inc\n"
|
2010-03-29 15:04:13 +02:00
|
|
|
$(ROMCC) -c -S $(ROMCCFLAGS) -D__PRE_RAM__ -I. $(INCLUDES) $< -o $@
|
2010-02-09 13:21:10 +01:00
|
|
|
else
|
2010-02-11 09:44:20 +01:00
|
|
|
|
2011-03-29 11:01:10 +02:00
|
|
|
$(obj)/mainboard/$(MAINBOARDDIR)/romstage.pre.inc: $(src)/mainboard/$(MAINBOARDDIR)/romstage.c $(OPTION_TABLE_H) $(obj)/build.h $(obj)/config.h
|
2010-04-19 22:39:22 +02:00
|
|
|
@printf " CC romstage.inc\n"
|
2010-09-25 12:40:47 +02:00
|
|
|
$(CC) -MMD $(CFLAGS) -D__PRE_RAM__ -I$(src) -I. -I$(obj) -c -S $< -o $@
|
2010-03-24 16:51:48 +01:00
|
|
|
|
|
|
|
$(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc: $(obj)/mainboard/$(MAINBOARDDIR)/romstage.pre.inc
|
2010-04-19 22:39:22 +02:00
|
|
|
@printf " POST romstage.inc\n"
|
2011-10-12 21:54:08 +02:00
|
|
|
sed -e 's/\.rodata/.rom.data/g' -e 's/\^\.text/.section .rom.text/g' \
|
|
|
|
-e 's/\^\.section \.text/.section .rom.text/g' $^ > $@.tmp
|
2010-02-10 19:08:22 +01:00
|
|
|
mv $@.tmp $@
|
2010-02-09 13:21:10 +01:00
|
|
|
endif
|
2010-02-27 09:39:04 +01:00
|
|
|
|
|
|
|
# Things that appear in every board
|
2012-04-19 13:43:47 +02:00
|
|
|
romstage-srcs += $(objgenerated)/crt0.s
|
2012-11-15 06:05:43 +01:00
|
|
|
ramstage-srcs += $(wildcard src/mainboard/$(MAINBOARDDIR)/mainboard.c)
|
2010-02-27 09:39:04 +01:00
|
|
|
ifeq ($(CONFIG_GENERATE_MP_TABLE),y)
|
2012-11-13 20:32:56 +01:00
|
|
|
ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/mptable.c),)
|
2010-09-30 18:55:02 +02:00
|
|
|
ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/mptable.c
|
2010-02-27 09:39:04 +01:00
|
|
|
endif
|
2012-08-24 23:21:44 +02:00
|
|
|
endif
|
2010-02-27 09:39:04 +01:00
|
|
|
ifeq ($(CONFIG_GENERATE_PIRQ_TABLE),y)
|
2010-09-30 18:55:02 +02:00
|
|
|
ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/irq_tables.c
|
2010-02-27 09:39:04 +01:00
|
|
|
endif
|
2012-11-13 20:32:56 +01:00
|
|
|
ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/reset.c),)
|
2010-09-30 18:55:02 +02:00
|
|
|
ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/reset.c
|
2010-02-27 09:39:04 +01:00
|
|
|
endif
|
2010-02-28 19:23:00 +01:00
|
|
|
ifeq ($(CONFIG_GENERATE_ACPI_TABLES),y)
|
2010-09-30 18:55:02 +02:00
|
|
|
ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/acpi_tables.c
|
|
|
|
ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/dsdt.asl
|
2012-11-13 20:32:56 +01:00
|
|
|
ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/ssdt2.asl),)
|
2010-09-30 18:55:02 +02:00
|
|
|
ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/ssdt2.asl
|
2012-11-13 20:32:56 +01:00
|
|
|
endif
|
|
|
|
ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/ssdt3.asl),)
|
2010-09-30 18:55:02 +02:00
|
|
|
ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/ssdt3.asl
|
2012-11-13 20:32:56 +01:00
|
|
|
endif
|
|
|
|
ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/ssdt4.asl),)
|
2010-09-30 18:55:02 +02:00
|
|
|
ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/ssdt4.asl
|
2010-03-01 08:42:02 +01:00
|
|
|
endif
|
2012-11-13 20:32:56 +01:00
|
|
|
ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/ssdt5.asl),)
|
2010-09-30 18:55:02 +02:00
|
|
|
ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/ssdt5.asl
|
2010-03-01 08:42:02 +01:00
|
|
|
endif
|
2012-11-13 20:32:56 +01:00
|
|
|
ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/fadt.c),)
|
2010-09-30 18:55:02 +02:00
|
|
|
ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/fadt.c
|
2010-02-28 19:23:00 +01:00
|
|
|
endif
|
|
|
|
endif
|
2012-11-13 23:06:38 +01:00
|
|
|
ifeq ($(CONFIG_HAVE_SMI_HANDLER),y)
|
2012-12-19 16:32:47 +01:00
|
|
|
ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/smihandler.c),)
|
|
|
|
smm-srcs += src/mainboard/$(MAINBOARDDIR)/smihandler.c
|
2012-11-13 23:06:38 +01:00
|
|
|
endif
|
|
|
|
endif
|
2012-11-13 20:32:56 +01:00
|
|
|
ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/get_bus_conf.c),)
|
2010-09-30 18:55:02 +02:00
|
|
|
ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/get_bus_conf.c
|
2010-02-28 19:23:00 +01:00
|
|
|
endif
|
2010-02-27 09:39:04 +01:00
|
|
|
|
2012-07-20 07:11:21 +02:00
|
|
|
################################################################################
|
2011-11-01 18:55:59 +01:00
|
|
|
# Build the final rom image
|
|
|
|
|
2012-04-19 13:43:47 +02:00
|
|
|
$(obj)/coreboot.pre: $(objcbfs)/romstage_xip.elf $(obj)/coreboot.pre1 $(CBFSTOOL)
|
2011-11-01 18:55:59 +01:00
|
|
|
@printf " CBFS $(subst $(obj)/,,$(@))\n"
|
2011-11-05 03:07:01 +01:00
|
|
|
cp $(obj)/coreboot.pre1 $@.tmp
|
2012-10-30 00:52:36 +01:00
|
|
|
$(CBFSTOOL) $@.tmp add-stage -f $(objcbfs)/romstage_xip.elf \
|
|
|
|
-n $(CONFIG_CBFS_PREFIX)/romstage -c none \
|
|
|
|
-b $(shell cat $(objcbfs)/base_xip.txt)
|
2011-11-05 03:07:01 +01:00
|
|
|
mv $@.tmp $@
|
2011-11-01 18:55:59 +01:00
|
|
|
|
2012-07-20 07:11:21 +02:00
|
|
|
################################################################################
|
2011-11-01 18:55:59 +01:00
|
|
|
# Build the bootblock
|
|
|
|
|
|
|
|
bootblock_lds = $(src)/arch/x86/init/ldscript_failover.lb
|
|
|
|
bootblock_lds += $(src)/cpu/x86/16bit/entry16.lds
|
|
|
|
bootblock_lds += $(src)/cpu/x86/16bit/reset16.lds
|
|
|
|
bootblock_lds += $(src)/arch/x86/lib/id.lds
|
|
|
|
bootblock_lds += $(chipset_bootblock_lds)
|
|
|
|
|
|
|
|
bootblock_inc = $(src)/arch/x86/init/prologue.inc
|
|
|
|
bootblock_inc += $(src)/cpu/x86/16bit/entry16.inc
|
|
|
|
bootblock_inc += $(src)/cpu/x86/16bit/reset16.inc
|
|
|
|
bootblock_inc += $(src)/cpu/x86/32bit/entry32.inc
|
|
|
|
bootblock_inc += $(src)/arch/x86/lib/id.inc
|
|
|
|
bootblock_inc += $(chipset_bootblock_inc)
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_SSE),y)
|
|
|
|
bootblock_inc += $(src)/cpu/x86/sse_enable.inc
|
|
|
|
endif
|
2012-04-19 11:14:53 +02:00
|
|
|
bootblock_inc += $(objgenerated)/bootblock.inc
|
2011-11-01 18:55:59 +01:00
|
|
|
bootblock_inc += $(src)/arch/x86/lib/walkcbfs.S
|
|
|
|
|
|
|
|
bootblock_romccflags := -mcpu=i386 -O2 -D__PRE_RAM__
|
|
|
|
ifeq ($(CONFIG_SSE),y)
|
|
|
|
bootblock_romccflags := -mcpu=k7 -msse -O2 -D__PRE_RAM__
|
|
|
|
endif
|
|
|
|
|
2012-04-19 11:14:53 +02:00
|
|
|
$(objgenerated)/bootblock.ld: $$(bootblock_lds) $(obj)/ldoptions
|
2011-11-01 18:55:59 +01:00
|
|
|
@printf " GEN $(subst $(obj)/,,$(@))\n"
|
|
|
|
printf '$(foreach ldscript,ldoptions $(bootblock_lds),INCLUDE "$(ldscript)"\n)' > $@
|
|
|
|
|
2012-05-15 00:20:26 +02:00
|
|
|
$(objgenerated)/bootblock_inc.S: $$(bootblock_inc)
|
2011-11-01 18:55:59 +01:00
|
|
|
@printf " GEN $(subst $(obj)/,,$(@))\n"
|
2012-01-17 13:13:59 +01:00
|
|
|
printf '$(foreach crt0,$(bootblock_inc),#include "$(crt0)"\n)' > $@
|
2011-11-01 18:55:59 +01:00
|
|
|
|
2012-04-19 11:14:53 +02:00
|
|
|
$(objgenerated)/bootblock.o: $(objgenerated)/bootblock.s
|
2011-11-01 18:55:59 +01:00
|
|
|
@printf " CC $(subst $(obj)/,,$(@))\n"
|
2012-04-19 11:14:53 +02:00
|
|
|
$(CC) -Wa,-acdlns -c -o $@ $< > $(basename $@).disasm
|
2011-11-01 18:55:59 +01:00
|
|
|
|
2012-05-15 00:20:26 +02:00
|
|
|
$(objgenerated)/bootblock.s: $(objgenerated)/bootblock_inc.S $(obj)/config.h $(obj)/build.h
|
2011-11-01 18:55:59 +01:00
|
|
|
@printf " CC $(subst $(obj)/,,$(@))\n"
|
2012-04-19 11:14:53 +02:00
|
|
|
$(CC) -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 $@
|
2011-11-01 18:55:59 +01:00
|
|
|
|
2012-04-19 11:14:53 +02:00
|
|
|
$(objgenerated)/bootblock.inc: $(src)/arch/x86/init/$(subst ",,$(CONFIG_BOOTBLOCK_SOURCE)) $(objutil)/romcc/romcc $(OPTION_TABLE_H)
|
2011-11-01 18:55:59 +01:00
|
|
|
@printf " ROMCC $(subst $(obj)/,,$(@))\n"
|
2012-04-19 11:14:53 +02:00
|
|
|
$(CC) $(INCLUDES) -MM -MT$(objgenerated)/bootblock.inc \
|
|
|
|
$< > $(objgenerated)/bootblock.inc.d
|
2013-02-09 14:35:55 +01:00
|
|
|
$(ROMCC) -c -S $(bootblock_romccflags) -I. $(INCLUDES) $< -o $@
|
2011-11-01 18:55:59 +01:00
|
|
|
|
2012-04-19 11:14:53 +02:00
|
|
|
$(objcbfs)/bootblock.debug: $(objgenerated)/bootblock.o $(objgenerated)/bootblock.ld
|
2011-11-01 18:55:59 +01:00
|
|
|
@printf " LINK $(subst $(obj)/,,$(@))\n"
|
2012-03-11 20:15:21 +01:00
|
|
|
ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y)
|
|
|
|
$(LD) -m elf_i386 -static -o $@.tmp -L$(obj) $< -T $(objgenerated)/bootblock.ld
|
|
|
|
else
|
2012-04-19 11:14:53 +02:00
|
|
|
$(CC) -nostdlib -nostartfiles -static -o $@ -L$(obj) -T $(objgenerated)/bootblock.ld $<
|
2012-03-11 20:15:21 +01:00
|
|
|
endif
|
2011-11-01 18:55:59 +01:00
|
|
|
|
2012-07-20 07:11:21 +02:00
|
|
|
################################################################################
|
2011-11-01 18:55:59 +01:00
|
|
|
# Build the romstage
|
2012-03-31 09:21:29 +02:00
|
|
|
|
2012-04-19 13:43:47 +02:00
|
|
|
$(objcbfs)/romstage_null.debug: $$(romstage-objs) $(objgenerated)/romstage_null.ld
|
2011-11-01 18:55:59 +01:00
|
|
|
@printf " LINK $(subst $(obj)/,,$(@))\n"
|
2012-03-11 20:15:21 +01:00
|
|
|
ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y)
|
|
|
|
$(LD) -nostdlib -nostartfiles -static -o $@ -L$(obj) $(romstage-objs) -T $(objgenerated)/romstage_null.ld
|
|
|
|
else
|
2012-04-19 13:43:47 +02:00
|
|
|
$(CC) -nostdlib -nostartfiles -static -o $@ -L$(obj) -T $(objgenerated)/romstage_null.ld $(romstage-objs)
|
2012-03-11 20:15:21 +01:00
|
|
|
endif
|
2012-07-31 23:52:04 +02:00
|
|
|
$(NM) $@ | grep -q " [DdBb] "; if [ $$? -eq 0 ]; then \
|
|
|
|
echo "Forbidden global variables in romstage:"; \
|
2012-11-12 08:48:21 +01:00
|
|
|
$(NM) $@ | grep " [DdBb] "; test "$(CONFIG_CPU_AMD_AGESA)" = y; \
|
2012-07-31 23:52:04 +02:00
|
|
|
else true; fi
|
2012-03-31 09:21:29 +02:00
|
|
|
|
2012-04-19 13:43:47 +02:00
|
|
|
$(objcbfs)/romstage_xip.debug: $$(romstage-objs) $(objgenerated)/romstage_xip.ld
|
2012-03-31 09:21:29 +02:00
|
|
|
@printf " LINK $(subst $(obj)/,,$(@))\n"
|
2012-03-11 20:15:21 +01:00
|
|
|
ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y)
|
|
|
|
$(LD) -nostdlib -nostartfiles -static -o $@ -L$(obj) $(romstage-objs) -T $(objgenerated)/romstage_xip.ld
|
|
|
|
else
|
2012-04-19 13:43:47 +02:00
|
|
|
$(CC) -nostdlib -nostartfiles -static -o $@ -L$(obj) -T $(objgenerated)/romstage_xip.ld $(romstage-objs)
|
2012-03-11 20:15:21 +01:00
|
|
|
endif
|
2012-04-19 13:43:47 +02:00
|
|
|
|
|
|
|
$(objgenerated)/romstage_null.ld: $$(ldscripts) $(obj)/ldoptions
|
2011-11-01 18:55:59 +01:00
|
|
|
@printf " GEN $(subst $(obj)/,,$(@))\n"
|
2012-03-31 09:21:29 +02:00
|
|
|
rm -f $@
|
|
|
|
printf "ROMSTAGE_BASE = 0x0;\n" > $@.tmp
|
|
|
|
printf '$(foreach ldscript,ldoptions $(ldscripts),INCLUDE "$(ldscript:$(obj)/%=%)"\n)' >> $@.tmp
|
|
|
|
mv $@.tmp $@
|
|
|
|
|
2012-04-19 13:43:47 +02:00
|
|
|
$(objgenerated)/romstage_xip.ld: $(objgenerated)/romstage_null.ld $(objcbfs)/base_xip.txt
|
2012-03-31 09:21:29 +02:00
|
|
|
@printf " GEN $(subst $(obj)/,,$(@))\n"
|
|
|
|
rm -f $@
|
2012-04-19 13:43:47 +02:00
|
|
|
sed -e 's/^/ROMSTAGE_BASE = /g' -e 's/$$/;/g' $(objcbfs)/base_xip.txt > $@.tmp
|
|
|
|
sed -e '/ROMSTAGE_BASE/d' $(objgenerated)/romstage_null.ld >> $@.tmp
|
2012-03-31 09:21:29 +02:00
|
|
|
mv $@.tmp $@
|
|
|
|
|
2012-04-19 13:43:47 +02:00
|
|
|
$(objcbfs)/base_xip.txt: $(obj)/coreboot.pre1 $(objcbfs)/romstage_null.bin
|
2012-03-31 09:21:29 +02:00
|
|
|
rm -f $@
|
2013-01-28 20:46:02 +01:00
|
|
|
$(CBFSTOOL) $(obj)/coreboot.pre1 locate -T -f $(objcbfs)/romstage_null.bin -n $(CONFIG_CBFS_PREFIX)/romstage -a $(CONFIG_XIP_ROM_SIZE) > $@.tmp \
|
2012-03-31 09:21:29 +02:00
|
|
|
|| { echo "The romstage is larger than XIP size. Please expand the CONFIG_XIP_ROM_SIZE" ; exit 1; }
|
2013-01-28 16:00:47 +01:00
|
|
|
mv $@.tmp $@
|
2011-11-01 18:55:59 +01:00
|
|
|
|
2012-05-15 00:20:26 +02:00
|
|
|
$(objgenerated)/crt0.romstage.S: $$(crt0s)
|
2011-11-01 18:55:59 +01:00
|
|
|
@printf " GEN $(subst $(obj)/,,$(@))\n"
|
2012-01-17 13:13:59 +01:00
|
|
|
printf '$(foreach crt0,$(crt0s),#include "$(crt0:$(obj)/%=%)"\n)' > $@
|
2011-11-01 18:55:59 +01:00
|
|
|
|
2012-04-19 13:43:47 +02:00
|
|
|
$(objgenerated)/crt0.romstage.o: $(objgenerated)/crt0.s
|
2011-11-01 18:55:59 +01:00
|
|
|
@printf " CC $(subst $(obj)/,,$(@))\n"
|
2012-04-19 13:43:47 +02:00
|
|
|
$(CC) -Wa,-acdlns -c -o $@ $< > $(basename $@).disasm
|
2011-11-01 18:55:59 +01:00
|
|
|
|
2012-05-15 00:20:26 +02:00
|
|
|
$(objgenerated)/crt0.s: $(objgenerated)/crt0.romstage.S $(obj)/config.h $(obj)/build.h
|
2011-11-01 18:55:59 +01:00
|
|
|
@printf " CC $(subst $(obj)/,,$(@))\n"
|
2012-04-19 13:43:47 +02:00
|
|
|
$(CC) -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 $@
|
2010-12-30 18:39:50 +01:00
|
|
|
|
|
|
|
seabios:
|
|
|
|
$(MAKE) -C payloads/external/SeaBIOS -f Makefile.inc \
|
2011-02-07 21:16:40 +01:00
|
|
|
HOSTCC="$(HOSTCC)" \
|
2011-01-29 06:51:54 +01:00
|
|
|
CC="$(CC)" LD="$(LD)" OBJDUMP="$(OBJDUMP)" \
|
|
|
|
OBJCOPY="$(OBJCOPY)" STRIP="$(STRIP)" \
|
2010-12-30 18:39:50 +01:00
|
|
|
CONFIG_SEABIOS_MASTER=$(CONFIG_SEABIOS_MASTER) \
|
2012-01-21 19:34:22 +01:00
|
|
|
CONFIG_SEABIOS_STABLE=$(CONFIG_SEABIOS_STABLE) \
|
2012-05-15 05:06:10 +02:00
|
|
|
OUT=$(abspath $(obj)) IASL="$(IASL)"
|
2012-01-21 19:34:22 +01:00
|
|
|
|
2011-04-15 05:34:05 +02:00
|
|
|
filo:
|
|
|
|
$(MAKE) -C payloads/external/FILO -f Makefile.inc \
|
|
|
|
HOSTCC="$(HOSTCC)" \
|
|
|
|
CC="$(CC)" LD="$(LD)" OBJDUMP="$(OBJDUMP)" \
|
|
|
|
OBJCOPY="$(OBJCOPY)" STRIP="$(STRIP)" \
|
|
|
|
CONFIG_FILO_MASTER=$(CONFIG_FILO_MASTER) \
|
|
|
|
CONFIG_FILO_STABLE=$(CONFIG_FILO_STABLE)
|
2010-12-30 18:39:50 +01:00
|
|
|
|