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.
|
|
|
|
##
|
2009-08-12 17:00:51 +02:00
|
|
|
|
2015-03-27 14:14:58 +01:00
|
|
|
################################################################################
|
|
|
|
# i386 specific tools
|
|
|
|
NVRAMTOOL:=$(objutil)/nvramtool/nvramtool
|
|
|
|
|
2010-09-30 18:55:02 +02:00
|
|
|
OPTION_TABLE_H:=
|
|
|
|
ifeq ($(CONFIG_HAVE_OPTION_TABLE),y)
|
2015-03-27 14:14:58 +01:00
|
|
|
|
2011-01-30 17:31:15 +01:00
|
|
|
cbfs-files-y += cmos_layout.bin
|
|
|
|
cmos_layout.bin-file = $(obj)/cmos_layout.bin
|
2016-09-19 21:58:01 +02:00
|
|
|
cmos_layout.bin-type = cmos_layout
|
2011-01-18 14:56:36 +01:00
|
|
|
|
2015-03-27 14:14:58 +01:00
|
|
|
$(obj)/cmos_layout.bin: $(NVRAMTOOL) $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout
|
|
|
|
@printf " OPTION $(subst $(obj)/,,$(@))\n"
|
|
|
|
$(NVRAMTOOL) -y $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout -L $@
|
|
|
|
|
2010-09-30 18:55:02 +02:00
|
|
|
OPTION_TABLE_H:=$(obj)/option_table.h
|
2015-03-27 14:14:58 +01:00
|
|
|
|
|
|
|
$(OPTION_TABLE_H): $(NVRAMTOOL) $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout
|
|
|
|
@printf " OPTION $(subst $(obj)/,,$(@))\n"
|
|
|
|
$(NVRAMTOOL) -y $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout -H $@
|
|
|
|
endif # CONFIG_HAVE_OPTION_TABLE
|
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
|
|
|
|
|
2016-01-21 07:08:17 +01:00
|
|
|
###############################################################################
|
|
|
|
# common support for early assembly includes
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
# Chipset specific assembly stubs in the romstage program flow. Certain
|
|
|
|
# boards have more than one assembly stub so collect those and put them
|
|
|
|
# into a single generated file.
|
|
|
|
crt0s = $(cpu_incs-y)
|
|
|
|
|
|
|
|
$(objgenerated)/assembly.inc: $$(crt0s)
|
|
|
|
@printf " GEN $(subst $(obj)/,,$(@))\n"
|
|
|
|
printf '$(foreach crt0,$(crt0s),#include "$(crt0)"\n)' > $@
|
|
|
|
|
|
|
|
|
|
|
|
define early_x86_assembly_entry_rule
|
|
|
|
# $1 stage name
|
|
|
|
# Add the assembly file that pulls in the rest of the dependencies in
|
|
|
|
# the right order. Make sure the auto generated assembly.inc is a proper
|
|
|
|
# dependency.
|
|
|
|
$(1)-y += assembly_entry.S
|
2016-01-23 00:50:00 +01:00
|
|
|
$(call src-to-obj,$(1),$(dir)/assembly_entry.S): $(objgenerated)/assembly.inc
|
2016-01-21 07:08:17 +01:00
|
|
|
endef
|
|
|
|
|
|
|
|
define early_x86_stage
|
|
|
|
# $1 stage name
|
|
|
|
# $2 oformat
|
|
|
|
$(1)-y += memlayout.ld
|
|
|
|
|
|
|
|
# The '.' include path is needed for the generated assembly.inc file.
|
|
|
|
$(1)-S-ccopts += -I.
|
|
|
|
|
|
|
|
$$(objcbfs)/$(1).debug: $$$$($(1)-libs) $$$$($(1)-objs)
|
|
|
|
@printf " LINK $$(subst $$(obj)/,,$$(@))\n"
|
2016-01-23 00:50:00 +01:00
|
|
|
$$(LD_$(1)) $$(LDFLAGS_$(1)) -o $$@ -L$$(obj) $$(COMPILER_RT_FLAGS_$(1)) --whole-archive --start-group $$(filter-out %.ld,$$($(1)-objs)) $$($(1)-libs) --no-whole-archive $$(COMPILER_RT_$(1)) --end-group -T $(call src-to-obj,$(1),$(dir)/memlayout.ld) --oformat $(2)
|
2016-01-21 07:08:17 +01:00
|
|
|
-LANG=C LC_ALL= $$(OBJCOPY_$(1)) --only-section .illegal_globals $$(@) $$(objcbfs)/$(1)_null.offenders >/dev/null 2>&1
|
|
|
|
if [ -z "$$$$($$(NM_$(1)) $$(objcbfs)/$(1)_null.offenders 2>&1 | grep 'no symbols')" ];then \
|
|
|
|
echo "Forbidden global variables in $(1):"; \
|
|
|
|
$$(NM_$(1)) $$(objcbfs)/$(1)_null.offenders; false; \
|
|
|
|
fi
|
|
|
|
endef
|
|
|
|
|
2014-04-23 01:33:22 +02:00
|
|
|
###############################################################################
|
|
|
|
# bootblock
|
|
|
|
###############################################################################
|
2011-11-01 18:55:59 +01:00
|
|
|
|
2015-03-15 19:23:50 +01:00
|
|
|
ifeq ($(CONFIG_ARCH_BOOTBLOCK_X86_32)$(CONFIG_ARCH_BOOTBLOCK_X86_64),y)
|
Introduce stage-specific architecture for coreboot
Make all three coreboot stages (bootblock, romstage and ramstage) aware of the
architecture specific to that stage i.e. we will have CONFIG_ARCH variables for
each of the three stages. This allows us to have an SOC with any combination of
architectures and thus every stage can be made to run on a completely different
architecture independent of others. Thus, bootblock can have an x86 arch whereas
romstage and ramstage can have arm32 and arm64 arch respectively. These stage
specific CONFIG_ARCH_ variables enable us to select the proper set of toolchain
and compiler flags for every stage.
These options can be considered as either arch or modes eg: x86 running in
different modes or ARM having different arch types (v4, v7, v8). We have got rid
of the original CONFIG_ARCH option completely as every stage can have any
architecture of its own. Thus, almost all the components of coreboot are
identified as being part of one of the three stages (bootblock, romstage or
ramstage). The components which cannot be classified as such e.g. smm, rmodules
can have their own compiler toolset which is for now set to *_i386. Hence, all
special classes are treated in a similar way and the compiler toolset is defined
using create_class_compiler defined in Makefile.
In order to meet these requirements, changes have been made to CC, LD, OBJCOPY
and family to add CC_bootblock, CC_romstage, CC_ramstage and similarly others.
Additionally, CC_x86_32 and CC_armv7 handle all the special classes. All the
toolsets are defined using create_class_compiler.
Few additional macros have been introduced to identify the class to be used at
various points, e.g.: CC_$(class) derives the $(class) part from the name of
the stage being compiled.
We have also got rid of COREBOOT_COMPILER, COREBOOT_ASSEMBLER and COREBOOT_LINKER
as they do not make any sense for coreboot as a whole. All these attributes are
associated with each of the stages.
Change-Id: I923f3d4fb097d21071030b104c372cc138c68c7b
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: http://review.coreboot.org/5577
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@gmail.com>
2014-04-23 19:18:48 +02:00
|
|
|
|
2016-01-09 08:05:00 +01:00
|
|
|
bootblock-y += boot.c
|
2016-07-24 17:09:40 +02:00
|
|
|
bootblock-y += cpu_common.c
|
2018-04-20 09:39:30 +02:00
|
|
|
bootblock-$(CONFIG_IDT_IN_EVERY_STAGE) += exception.c
|
|
|
|
bootblock-$(CONFIG_IDT_IN_EVERY_STAGE) += idt.S
|
2016-01-09 08:05:00 +01:00
|
|
|
bootblock-y += memcpy.c
|
|
|
|
bootblock-y += memset.c
|
2018-01-25 01:35:58 +01:00
|
|
|
bootblock-$(CONFIG_COLLECT_TIMESTAMPS_TSC) += timestamp.c
|
2015-10-27 18:27:30 +01:00
|
|
|
bootblock-$(CONFIG_X86_TOP4G_BOOTMEDIA_MAP) += mmap_boot.c
|
2016-01-09 08:05:00 +01:00
|
|
|
|
2015-10-05 02:47:36 +02:00
|
|
|
bootblock-y += id.S
|
2016-01-23 00:50:00 +01:00
|
|
|
$(call src-to-obj,bootblock,$(dir)/id.S): $(obj)/build.h
|
2015-10-15 11:07:07 +02:00
|
|
|
|
2016-01-21 07:08:17 +01:00
|
|
|
ifeq ($(CONFIG_C_ENVIRONMENT_BOOTBLOCK),y)
|
|
|
|
|
2016-01-27 03:22:43 +01:00
|
|
|
bootblock-y += bootblock_crt0.S
|
2016-01-21 07:08:17 +01:00
|
|
|
|
|
|
|
ifeq ($(CONFIG_ARCH_BOOTBLOCK_X86_32),y)
|
|
|
|
$(eval $(call early_x86_stage,bootblock,elf32-i386))
|
|
|
|
else
|
|
|
|
$(eval $(call early_x86_stage,bootblock,elf64-x86-64))
|
|
|
|
endif
|
|
|
|
|
|
|
|
else # !C_ENVIRONMENT_BOOTBLOCK
|
|
|
|
|
|
|
|
# x86-specific linker flags
|
|
|
|
ifeq ($(CONFIG_ARCH_BOOTBLOCK_X86_32),y)
|
|
|
|
LDFLAGS_bootblock += -m elf_i386 --oformat elf32-i386
|
|
|
|
else
|
|
|
|
LDFLAGS_bootblock += -m elf_x86_64 --oformat elf64-x86-64
|
|
|
|
endif
|
|
|
|
|
2015-10-02 21:42:26 +02:00
|
|
|
# Add the assembly file that pulls in the rest of the dependencies in
|
|
|
|
# the right order. Make sure the auto generated bootblock.inc is a proper
|
|
|
|
# dependency. Make the same true for the linker sript.
|
|
|
|
bootblock-y += bootblock_romcc.S
|
2015-10-03 01:17:41 +02:00
|
|
|
bootblock-y += walkcbfs.S
|
2015-10-02 21:42:26 +02:00
|
|
|
$(call src-to-obj,bootblock,$(dir)/bootblock_romcc.S): $(objgenerated)/bootblock.inc
|
2011-11-01 18:55:59 +01:00
|
|
|
|
2015-09-03 07:41:29 +02:00
|
|
|
bootblock-y += bootblock.ld
|
2016-01-23 00:50:00 +01:00
|
|
|
$(call src-to-obj,bootblock,$(dir)/bootblock.ld): $(objgenerated)/bootblock.ld
|
2011-11-01 18:55:59 +01:00
|
|
|
|
2015-04-02 19:44:19 +02:00
|
|
|
bootblock_romccflags := -mcpu=i386 -O2 -D__PRE_RAM__ -D__BOOTBLOCK__
|
2011-11-01 18:55:59 +01:00
|
|
|
ifeq ($(CONFIG_SSE),y)
|
2015-04-02 19:44:19 +02:00
|
|
|
bootblock_romccflags := -mcpu=k7 -msse -O2 -D__PRE_RAM__ -D__BOOTBLOCK__
|
2011-11-01 18:55:59 +01:00
|
|
|
endif
|
|
|
|
|
2015-09-03 07:41:29 +02:00
|
|
|
# This is a hack in case there are no per chipset linker files.
|
2015-12-14 22:04:54 +01:00
|
|
|
$(objgenerated)/empty: build-dirs
|
2015-09-03 07:41:29 +02:00
|
|
|
touch $@
|
|
|
|
|
2016-01-23 00:50:00 +01:00
|
|
|
$(objgenerated)/bootblock.ld: $$(filter-out $(call src-to-obj,bootblock,src/arch/x86/bootblock.ld), $$(filter %.ld,$$(bootblock-objs))) $(objgenerated)/empty
|
2011-11-01 18:55:59 +01:00
|
|
|
@printf " GEN $(subst $(obj)/,,$(@))\n"
|
2015-06-30 23:46:49 +02:00
|
|
|
cat $^ >> $@.tmp
|
|
|
|
mv $@.tmp $@
|
2011-11-01 18:55:59 +01:00
|
|
|
|
2018-09-03 15:39:33 +02:00
|
|
|
-include $(objgenerated)/bootblock.inc.d
|
2015-07-27 17:47:55 +02:00
|
|
|
$(objgenerated)/bootblock.inc: $(src)/arch/x86/$(subst ",,$(CONFIG_BOOTBLOCK_SOURCE)) $(objutil)/romcc/romcc $(OPTION_TABLE_H) $(KCONFIG_AUTOHEADER)
|
2016-01-15 19:12:04 +01:00
|
|
|
# The open quote in the subst messes with syntax highlighting. Fix it - ")
|
2011-11-01 18:55:59 +01:00
|
|
|
@printf " ROMCC $(subst $(obj)/,,$(@))\n"
|
2014-05-19 09:23:57 +02:00
|
|
|
$(CC_bootblock) $(CPPFLAGS_bootblock) -MM -MT$(objgenerated)/bootblock.inc \
|
2012-04-19 11:14:53 +02:00
|
|
|
$< > $(objgenerated)/bootblock.inc.d
|
2014-05-19 09:23:57 +02:00
|
|
|
$(ROMCC) -c -S $(bootblock_romccflags) -I. $(CPPFLAGS_bootblock) $< -o $@
|
2011-11-01 18:55:59 +01:00
|
|
|
|
2016-01-23 00:50:00 +01:00
|
|
|
# bootblock.ld is part of $(bootblock-objs)
|
2015-10-02 21:17:56 +02:00
|
|
|
$(objcbfs)/bootblock.debug: $$(bootblock-objs)
|
2011-11-01 18:55:59 +01:00
|
|
|
@printf " LINK $(subst $(obj)/,,$(@))\n"
|
2015-10-02 21:17:56 +02:00
|
|
|
$(LD_bootblock) $(LDFLAGS_bootblock) -o $@ -L$(obj) \
|
|
|
|
$(filter-out %.ld,$(bootblock-objs)) \
|
2016-01-23 00:50:00 +01:00
|
|
|
-T $(call src-to-obj,bootblock,src/arch/x86/bootblock.ld)
|
2011-11-01 18:55:59 +01:00
|
|
|
|
2016-01-21 07:08:17 +01:00
|
|
|
endif # C_ENVIRONMENT_BOOTBLOCK
|
Introduce stage-specific architecture for coreboot
Make all three coreboot stages (bootblock, romstage and ramstage) aware of the
architecture specific to that stage i.e. we will have CONFIG_ARCH variables for
each of the three stages. This allows us to have an SOC with any combination of
architectures and thus every stage can be made to run on a completely different
architecture independent of others. Thus, bootblock can have an x86 arch whereas
romstage and ramstage can have arm32 and arm64 arch respectively. These stage
specific CONFIG_ARCH_ variables enable us to select the proper set of toolchain
and compiler flags for every stage.
These options can be considered as either arch or modes eg: x86 running in
different modes or ARM having different arch types (v4, v7, v8). We have got rid
of the original CONFIG_ARCH option completely as every stage can have any
architecture of its own. Thus, almost all the components of coreboot are
identified as being part of one of the three stages (bootblock, romstage or
ramstage). The components which cannot be classified as such e.g. smm, rmodules
can have their own compiler toolset which is for now set to *_i386. Hence, all
special classes are treated in a similar way and the compiler toolset is defined
using create_class_compiler defined in Makefile.
In order to meet these requirements, changes have been made to CC, LD, OBJCOPY
and family to add CC_bootblock, CC_romstage, CC_ramstage and similarly others.
Additionally, CC_x86_32 and CC_armv7 handle all the special classes. All the
toolsets are defined using create_class_compiler.
Few additional macros have been introduced to identify the class to be used at
various points, e.g.: CC_$(class) derives the $(class) part from the name of
the stage being compiled.
We have also got rid of COREBOOT_COMPILER, COREBOOT_ASSEMBLER and COREBOOT_LINKER
as they do not make any sense for coreboot as a whole. All these attributes are
associated with each of the stages.
Change-Id: I923f3d4fb097d21071030b104c372cc138c68c7b
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: http://review.coreboot.org/5577
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@gmail.com>
2014-04-23 19:18:48 +02:00
|
|
|
|
2015-09-29 23:31:20 +02:00
|
|
|
|
2016-01-21 07:08:17 +01:00
|
|
|
endif # CONFIG_ARCH_BOOTBLOCK_X86_32 / CONFIG_ARCH_BOOTBLOCK_X86_64
|
2015-09-29 21:54:25 +02:00
|
|
|
|
2015-09-29 23:31:20 +02:00
|
|
|
###############################################################################
|
|
|
|
# verstage
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_ARCH_VERSTAGE_X86_32)$(CONFIG_ARCH_VERSTAGE_X86_64),y)
|
|
|
|
|
|
|
|
verstage-y += boot.c
|
2018-04-27 18:09:04 +02:00
|
|
|
verstage-$(CONFIG_VBOOT_SEPARATE_VERSTAGE) += gdt_init.S
|
2018-04-20 09:39:30 +02:00
|
|
|
verstage-$(CONFIG_IDT_IN_EVERY_STAGE) += exception.c
|
|
|
|
verstage-$(CONFIG_IDT_IN_EVERY_STAGE) += idt.S
|
2015-09-29 23:31:20 +02:00
|
|
|
|
|
|
|
verstage-$(CONFIG_ARCH_RAMSTAGE_X86_32) += cpu_common.c
|
|
|
|
verstage-y += memset.c
|
|
|
|
verstage-y += memcpy.c
|
|
|
|
verstage-y += memmove.c
|
2016-03-18 19:12:41 +01:00
|
|
|
verstage-$(CONFIG_X86_TOP4G_BOOTMEDIA_MAP) += mmap_boot.c
|
2018-06-06 18:19:56 +02:00
|
|
|
# If verstage is a separate stage it means there's no need
|
2016-05-26 17:55:48 +02:00
|
|
|
# for a chipset-specific car_stage_entry() so use the generic one
|
|
|
|
# which just calls verstage().
|
2018-06-06 18:19:56 +02:00
|
|
|
verstage-$(CONFIG_VBOOT_SEPARATE_VERSTAGE) += verstage.c
|
2015-09-29 23:31:20 +02:00
|
|
|
|
2018-01-25 01:35:58 +01:00
|
|
|
verstage-$(CONFIG_COLLECT_TIMESTAMPS_TSC) += timestamp.c
|
2015-09-29 23:31:20 +02:00
|
|
|
|
Remove libverstage as separate library and source file class
In builds without CONFIG_VBOOT_SEPARATE_VERSTAGE, verstage files are
linked directly into the bootblock or the romstage. However, they're
still compiled with a separate "libverstage" source file class, linked
into an intermediate library and then linked into the final destination
stage.
There is no obvious benefit to doing it this way and it's unclear why it
was chosen in the first place... there are, however, obvious
disadvantages: it can result in code that is used by both libverstage
and the host stage to occur twice in the output binary. It also means
that libverstage files have their separate compiler flags that are not
necessarily aligned with the host stage, which can lead to weird effects
like <rules.h> macros not being set the way you would expect. In fact,
VBOOT_STARTS_IN_ROMSTAGE configurations are currently broken on x86
because their libverstage code that gets compiled into the romstage sets
ENV_VERSTAGE, but CAR migration code expects all ENV_VERSTAGE code to
run pre-migration.
This patch resolves these problems by removing the separate library.
There is no more difference between the 'verstage' and 'libverstage'
classes, and the source files added to them are just treated the same
way a bootblock or romstage source files in configurations where the
verstage is linked into either of these respective stages (allowing for
the normal object code deduplication and causing those files to be
compiled with the same flags as the host stage's files).
Tested this whole series by booting a Kevin, an Elm (both with and
without SEPARATE_VERSTAGE) and a Falco in normal and recovery mode.
Change-Id: I6bb84a9bf1cd54f2e02ca1f665740a9c88d88df4
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://review.coreboot.org/18302
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2017-03-20 23:32:15 +01:00
|
|
|
verstage-libs ?=
|
2015-09-29 23:31:20 +02:00
|
|
|
|
2016-01-21 07:08:17 +01:00
|
|
|
$(eval $(call early_x86_assembly_entry_rule,verstage))
|
|
|
|
|
2015-09-29 23:31:20 +02:00
|
|
|
ifeq ($(CONFIG_ARCH_VERSTAGE_X86_32),y)
|
|
|
|
$(eval $(call early_x86_stage,verstage,elf32-i386))
|
|
|
|
else
|
|
|
|
$(eval $(call early_x86_stage,verstage,elf64-x86-64))
|
|
|
|
endif
|
|
|
|
|
|
|
|
endif # CONFIG_ARCH_VERSTAGE_X86_32 / CONFIG_ARCH_VERSTAGE_X86_64
|
|
|
|
|
2015-09-29 21:54:25 +02:00
|
|
|
###############################################################################
|
|
|
|
# romstage
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32)$(CONFIG_ARCH_ROMSTAGE_X86_64),y)
|
2014-04-23 01:33:22 +02:00
|
|
|
|
2016-07-26 02:07:53 +02:00
|
|
|
romstage-$(CONFIG_HAVE_ACPI_RESUME) += acpi_s3.c
|
|
|
|
romstage-y += boot.c
|
2018-04-27 18:09:04 +02:00
|
|
|
# gdt_init.S is included by entry32.inc when romstage is the first C
|
|
|
|
# environment.
|
|
|
|
romstage-$(CONFIG_C_ENVIRONMENT_BOOTBLOCK) += gdt_init.S
|
2016-07-26 02:07:53 +02:00
|
|
|
romstage-y += cbmem.c
|
|
|
|
romstage-y += cbfs_and_run.c
|
|
|
|
romstage-$(CONFIG_ARCH_RAMSTAGE_X86_32) += cpu_common.c
|
2017-09-04 15:14:38 +02:00
|
|
|
romstage-$(CONFIG_EARLY_EBDA_INIT) += ebda.c
|
2018-04-20 09:39:30 +02:00
|
|
|
romstage-$(CONFIG_IDT_IN_EVERY_STAGE) += exception.c
|
|
|
|
romstage-$(CONFIG_IDT_IN_EVERY_STAGE) += idt.S
|
2016-07-26 02:07:53 +02:00
|
|
|
romstage-y += memcpy.c
|
|
|
|
romstage-y += memmove.c
|
|
|
|
romstage-y += memset.c
|
|
|
|
romstage-$(CONFIG_X86_TOP4G_BOOTMEDIA_MAP) += mmap_boot.c
|
2016-08-26 17:38:50 +02:00
|
|
|
romstage-y += postcar_loader.c
|
2018-01-25 01:35:58 +01:00
|
|
|
romstage-$(CONFIG_COLLECT_TIMESTAMPS_TSC) += timestamp.c
|
2016-07-26 02:07:53 +02:00
|
|
|
|
2015-09-03 18:01:17 +02:00
|
|
|
romstage-srcs += $(src)/mainboard/$(MAINBOARDDIR)/romstage.c
|
2014-03-29 19:01:11 +01:00
|
|
|
romstage-libs ?=
|
2016-01-21 07:08:17 +01:00
|
|
|
|
|
|
|
$(eval $(call early_x86_assembly_entry_rule,romstage))
|
2014-03-29 19:01:11 +01:00
|
|
|
|
2015-06-23 21:57:06 +02:00
|
|
|
ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32),y)
|
2015-09-29 21:54:25 +02:00
|
|
|
$(eval $(call early_x86_stage,romstage,elf32-i386))
|
2015-06-23 21:57:06 +02:00
|
|
|
else
|
2015-09-29 21:54:25 +02:00
|
|
|
$(eval $(call early_x86_stage,romstage,elf64-x86-64))
|
2015-06-23 21:57:06 +02:00
|
|
|
endif
|
|
|
|
|
2015-04-03 10:32:17 +02:00
|
|
|
# Compiling crt0 with -g seems to trigger https://sourceware.org/bugzilla/show_bug.cgi?id=6428
|
2015-09-29 23:31:20 +02:00
|
|
|
romstage-S-ccopts += -g0
|
Introduce stage-specific architecture for coreboot
Make all three coreboot stages (bootblock, romstage and ramstage) aware of the
architecture specific to that stage i.e. we will have CONFIG_ARCH variables for
each of the three stages. This allows us to have an SOC with any combination of
architectures and thus every stage can be made to run on a completely different
architecture independent of others. Thus, bootblock can have an x86 arch whereas
romstage and ramstage can have arm32 and arm64 arch respectively. These stage
specific CONFIG_ARCH_ variables enable us to select the proper set of toolchain
and compiler flags for every stage.
These options can be considered as either arch or modes eg: x86 running in
different modes or ARM having different arch types (v4, v7, v8). We have got rid
of the original CONFIG_ARCH option completely as every stage can have any
architecture of its own. Thus, almost all the components of coreboot are
identified as being part of one of the three stages (bootblock, romstage or
ramstage). The components which cannot be classified as such e.g. smm, rmodules
can have their own compiler toolset which is for now set to *_i386. Hence, all
special classes are treated in a similar way and the compiler toolset is defined
using create_class_compiler defined in Makefile.
In order to meet these requirements, changes have been made to CC, LD, OBJCOPY
and family to add CC_bootblock, CC_romstage, CC_ramstage and similarly others.
Additionally, CC_x86_32 and CC_armv7 handle all the special classes. All the
toolsets are defined using create_class_compiler.
Few additional macros have been introduced to identify the class to be used at
various points, e.g.: CC_$(class) derives the $(class) part from the name of
the stage being compiled.
We have also got rid of COREBOOT_COMPILER, COREBOOT_ASSEMBLER and COREBOOT_LINKER
as they do not make any sense for coreboot as a whole. All these attributes are
associated with each of the stages.
Change-Id: I923f3d4fb097d21071030b104c372cc138c68c7b
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: http://review.coreboot.org/5577
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@gmail.com>
2014-04-23 19:18:48 +02:00
|
|
|
|
2015-03-15 19:23:50 +01:00
|
|
|
endif # CONFIG_ARCH_ROMSTAGE_X86_32 / CONFIG_ARCH_ROMSTAGE_X86_64
|
2010-12-30 18:39:50 +01:00
|
|
|
|
2016-07-24 16:43:23 +02:00
|
|
|
###############################################################################
|
|
|
|
# postcar
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
$(eval $(call create_class_compiler,postcar,x86_32))
|
|
|
|
postcar-generic-ccopts += -D__POSTCAR__
|
|
|
|
|
2017-09-21 15:47:33 +02:00
|
|
|
postcar-$(CONFIG_HAVE_ACPI_RESUME) += acpi_s3.c
|
2016-07-24 16:43:23 +02:00
|
|
|
postcar-y += boot.c
|
2018-04-27 18:09:04 +02:00
|
|
|
postcar-y += gdt_init.S
|
2016-07-24 16:43:23 +02:00
|
|
|
postcar-y += cbfs_and_run.c
|
2017-09-07 07:13:19 +02:00
|
|
|
postcar-y += cbmem.c
|
2016-07-24 17:09:40 +02:00
|
|
|
postcar-y += cpu_common.c
|
2017-09-04 15:14:38 +02:00
|
|
|
postcar-$(CONFIG_EARLY_EBDA_INIT) += ebda.c
|
2018-04-20 09:39:30 +02:00
|
|
|
postcar-$(CONFIG_IDT_IN_EVERY_STAGE) += exception.c
|
|
|
|
postcar-$(CONFIG_IDT_IN_EVERY_STAGE) += idt.S
|
2016-07-24 16:43:23 +02:00
|
|
|
postcar-y += exit_car.S
|
|
|
|
postcar-y += memcpy.c
|
|
|
|
postcar-y += memmove.c
|
|
|
|
postcar-y += memset.c
|
|
|
|
postcar-y += memlayout.ld
|
|
|
|
postcar-$(CONFIG_X86_TOP4G_BOOTMEDIA_MAP) += mmap_boot.c
|
2016-09-16 23:15:14 +02:00
|
|
|
postcar-y += postcar.c
|
2018-01-25 01:35:58 +01:00
|
|
|
postcar-$(CONFIG_COLLECT_TIMESTAMPS_TSC) += timestamp.c
|
2016-07-24 16:43:23 +02:00
|
|
|
|
2016-07-24 16:51:24 +02:00
|
|
|
LDFLAGS_postcar += -Map $(objcbfs)/postcar.map
|
|
|
|
|
2016-07-24 16:43:23 +02:00
|
|
|
$(objcbfs)/postcar.debug: $$(postcar-objs)
|
|
|
|
@printf " LINK $(subst $(obj)/,,$(@))\n"
|
|
|
|
$(LD_postcar) $(LDFLAGS_postcar) -o $@ -L$(obj) $(COMPILER_RT_FLAGS_postcar) --whole-archive --start-group $(filter-out %.ld,$^) --no-whole-archive $(COMPILER_RT_postcar) --end-group -T $(call src-to-obj,postcar,src/arch/x86/memlayout.ld)
|
|
|
|
|
|
|
|
$(objcbfs)/postcar.elf: $(objcbfs)/postcar.debug.rmod
|
|
|
|
cp $< $@
|
|
|
|
|
|
|
|
# Add postcar to CBFS
|
|
|
|
cbfs-files-$(CONFIG_POSTCAR_STAGE) += $(CONFIG_CBFS_PREFIX)/postcar
|
|
|
|
$(CONFIG_CBFS_PREFIX)/postcar-file := $(objcbfs)/postcar.elf
|
|
|
|
$(CONFIG_CBFS_PREFIX)/postcar-type := stage
|
|
|
|
$(CONFIG_CBFS_PREFIX)/postcar-compression := none
|
|
|
|
|
2014-04-23 01:33:22 +02:00
|
|
|
###############################################################################
|
|
|
|
# ramstage
|
|
|
|
###############################################################################
|
|
|
|
|
2015-03-15 19:23:50 +01:00
|
|
|
ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32)$(CONFIG_ARCH_RAMSTAGE_X86_64),y)
|
Introduce stage-specific architecture for coreboot
Make all three coreboot stages (bootblock, romstage and ramstage) aware of the
architecture specific to that stage i.e. we will have CONFIG_ARCH variables for
each of the three stages. This allows us to have an SOC with any combination of
architectures and thus every stage can be made to run on a completely different
architecture independent of others. Thus, bootblock can have an x86 arch whereas
romstage and ramstage can have arm32 and arm64 arch respectively. These stage
specific CONFIG_ARCH_ variables enable us to select the proper set of toolchain
and compiler flags for every stage.
These options can be considered as either arch or modes eg: x86 running in
different modes or ARM having different arch types (v4, v7, v8). We have got rid
of the original CONFIG_ARCH option completely as every stage can have any
architecture of its own. Thus, almost all the components of coreboot are
identified as being part of one of the three stages (bootblock, romstage or
ramstage). The components which cannot be classified as such e.g. smm, rmodules
can have their own compiler toolset which is for now set to *_i386. Hence, all
special classes are treated in a similar way and the compiler toolset is defined
using create_class_compiler defined in Makefile.
In order to meet these requirements, changes have been made to CC, LD, OBJCOPY
and family to add CC_bootblock, CC_romstage, CC_ramstage and similarly others.
Additionally, CC_x86_32 and CC_armv7 handle all the special classes. All the
toolsets are defined using create_class_compiler.
Few additional macros have been introduced to identify the class to be used at
various points, e.g.: CC_$(class) derives the $(class) part from the name of
the stage being compiled.
We have also got rid of COREBOOT_COMPILER, COREBOOT_ASSEMBLER and COREBOOT_LINKER
as they do not make any sense for coreboot as a whole. All these attributes are
associated with each of the stages.
Change-Id: I923f3d4fb097d21071030b104c372cc138c68c7b
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: http://review.coreboot.org/5577
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@gmail.com>
2014-04-23 19:18:48 +02:00
|
|
|
|
2016-07-26 02:18:50 +02:00
|
|
|
ramstage-$(CONFIG_HAVE_ACPI_TABLES) += acpi.c
|
|
|
|
ramstage-$(CONFIG_HAVE_ACPI_TABLES) += acpigen.c
|
2016-10-22 01:40:17 +02:00
|
|
|
ramstage-$(CONFIG_HAVE_ACPI_TABLES) += acpigen_dsm.c
|
2016-07-26 02:18:50 +02:00
|
|
|
ramstage-$(CONFIG_HAVE_ACPI_TABLES) += acpi_device.c
|
2018-05-07 23:18:13 +02:00
|
|
|
ramstage-$(CONFIG_HAVE_ACPI_TABLES) += acpi_pld.c
|
2016-07-26 02:18:50 +02:00
|
|
|
ramstage-$(CONFIG_HAVE_ACPI_RESUME) += acpi_s3.c
|
|
|
|
ramstage-y += boot.c
|
|
|
|
ramstage-y += c_start.S
|
|
|
|
ramstage-y += cbmem.c
|
|
|
|
ramstage-y += cpu.c
|
|
|
|
ramstage-y += cpu_common.c
|
|
|
|
ramstage-y += ebda.c
|
|
|
|
ramstage-y += exception.c
|
2018-04-20 08:56:57 +02:00
|
|
|
ramstage-y += idt.S
|
2016-07-26 02:18:50 +02:00
|
|
|
ramstage-y += gdt.c
|
|
|
|
ramstage-$(CONFIG_IOAPIC) += ioapic.c
|
|
|
|
ramstage-y += memcpy.c
|
|
|
|
ramstage-y += memlayout.ld
|
|
|
|
ramstage-y += memmove.c
|
|
|
|
ramstage-y += memset.c
|
|
|
|
ramstage-$(CONFIG_X86_TOP4G_BOOTMEDIA_MAP) += mmap_boot.c
|
|
|
|
ramstage-$(CONFIG_GENERATE_MP_TABLE) += mpspec.c
|
|
|
|
ramstage-y += pci_ops_conf1.c
|
2018-05-04 16:29:13 +02:00
|
|
|
ramstage-$(CONFIG_NO_MMCONF_SUPPORT) += pci_ops.c
|
2016-07-26 02:18:50 +02:00
|
|
|
ramstage-$(CONFIG_GENERATE_PIRQ_TABLE) += pirq_routing.c
|
2017-02-13 22:44:14 +01:00
|
|
|
ramstage-y += rdrand.c
|
2016-07-26 02:18:50 +02:00
|
|
|
ramstage-$(CONFIG_GENERATE_SMBIOS_TABLES) += smbios.c
|
|
|
|
ramstage-y += tables.c
|
|
|
|
ramstage-$(CONFIG_COOP_MULTITASKING) += thread.c
|
|
|
|
ramstage-$(CONFIG_COOP_MULTITASKING) += thread_switch.S
|
2018-01-25 01:35:58 +01:00
|
|
|
ramstage-$(CONFIG_COLLECT_TIMESTAMPS_TSC) += timestamp.c
|
2016-07-26 02:18:50 +02:00
|
|
|
ramstage-$(CONFIG_HAVE_ACPI_RESUME) += wakeup.S
|
|
|
|
|
2018-04-20 09:39:30 +02:00
|
|
|
smm-$(CONFIG_IDT_IN_EVERY_STAGE) += exception.c
|
|
|
|
smm-$(CONFIG_IDT_IN_EVERY_STAGE) += idt.S
|
2016-07-26 02:18:50 +02:00
|
|
|
smm-y += memcpy.c
|
|
|
|
smm-y += memmove.c
|
|
|
|
smm-y += memset.c
|
|
|
|
smm-$(CONFIG_X86_TOP4G_BOOTMEDIA_MAP) += mmap_boot.c
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32),y)
|
|
|
|
rmodules_x86_32-y += memcpy.c
|
|
|
|
rmodules_x86_32-y += memmove.c
|
|
|
|
rmodules_x86_32-y += memset.c
|
|
|
|
else
|
|
|
|
rmodules_x86_64-y += memcpy.c
|
|
|
|
rmodules_x86_64-y += memmove.c
|
|
|
|
rmodules_x86_64-y += memset.c
|
|
|
|
endif
|
|
|
|
|
2015-06-22 21:10:34 +02:00
|
|
|
ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32),y)
|
|
|
|
target-objcopy=-O elf32-i386 -B i386
|
|
|
|
endif
|
|
|
|
ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_64),y)
|
2015-07-31 03:03:18 +02:00
|
|
|
target-objcopy=-O elf64-x86-64 -B i386:x86-64
|
2015-06-22 21:10:34 +02:00
|
|
|
endif
|
|
|
|
|
2014-04-23 01:33:22 +02:00
|
|
|
ramstage-srcs += $(wildcard src/mainboard/$(MAINBOARDDIR)/mainboard.c)
|
|
|
|
ifeq ($(CONFIG_GENERATE_MP_TABLE),y)
|
|
|
|
ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/mptable.c),)
|
|
|
|
ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/mptable.c
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
ifeq ($(CONFIG_GENERATE_PIRQ_TABLE),y)
|
|
|
|
ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/irq_tables.c
|
|
|
|
endif
|
|
|
|
ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/reset.c),)
|
|
|
|
ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/reset.c
|
|
|
|
endif
|
2014-01-03 15:55:40 +01:00
|
|
|
ifeq ($(CONFIG_HAVE_ACPI_TABLES),y)
|
2014-04-23 01:33:22 +02:00
|
|
|
ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/acpi_tables.c
|
2015-05-31 12:31:59 +02:00
|
|
|
$(eval $(call asl_template,dsdt))
|
2014-04-23 01:33:22 +02:00
|
|
|
ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/fadt.c),)
|
|
|
|
ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/fadt.c
|
|
|
|
endif
|
2015-04-03 10:47:15 +02:00
|
|
|
endif # CONFIG_GENERATE_ACPI_TABLES
|
2014-04-23 01:33:22 +02:00
|
|
|
ifeq ($(CONFIG_HAVE_SMI_HANDLER),y)
|
|
|
|
ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/smihandler.c),)
|
|
|
|
smm-srcs += src/mainboard/$(MAINBOARDDIR)/smihandler.c
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/get_bus_conf.c),)
|
|
|
|
ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/get_bus_conf.c
|
|
|
|
endif
|
|
|
|
|
|
|
|
ramstage-libs ?=
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_RELOCATABLE_RAMSTAGE),y)
|
|
|
|
|
2018-08-07 12:24:42 +02:00
|
|
|
# The rmodule_link definition creates an elf file with .rmod extension.
|
2014-04-23 01:33:22 +02:00
|
|
|
$(objcbfs)/ramstage.elf: $(objcbfs)/ramstage.debug.rmod
|
|
|
|
cp $< $@
|
|
|
|
|
2015-09-06 17:45:18 +02:00
|
|
|
endif
|
2014-04-23 01:33:22 +02:00
|
|
|
|
2016-01-23 00:50:00 +01:00
|
|
|
$(objcbfs)/ramstage.debug: $(objgenerated)/ramstage.o $(call src-to-obj,ramstage,src/arch/x86/memlayout.ld)
|
2014-04-23 01:33:22 +02:00
|
|
|
@printf " CC $(subst $(obj)/,,$(@))\n"
|
2016-01-23 00:50:00 +01:00
|
|
|
$(LD_ramstage) $(CPPFLAGS) $(LDFLAGS_ramstage) -o $@ -L$(obj) $< -T $(call src-to-obj,ramstage,src/arch/x86/memlayout.ld)
|
2014-04-23 01:33:22 +02:00
|
|
|
|
2014-11-22 17:42:58 +01:00
|
|
|
$(objgenerated)/ramstage.o: $$(ramstage-objs) $(COMPILER_RT_ramstage) $$(ramstage-libs)
|
2014-04-23 01:33:22 +02:00
|
|
|
@printf " CC $(subst $(obj)/,,$(@))\n"
|
2015-03-15 19:23:50 +01:00
|
|
|
ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32),y)
|
2015-05-07 22:24:41 +02:00
|
|
|
$(LD_ramstage) -m elf_i386 -r -o $@ $(COMPILER_RT_FLAGS_ramstage) --whole-archive --start-group $(filter-out %.ld,$(ramstage-objs)) $(ramstage-libs) --no-whole-archive $(COMPILER_RT_ramstage) --end-group
|
2015-03-15 19:23:50 +01:00
|
|
|
else
|
|
|
|
$(LD_ramstage) -m elf_x86_64 -r -o $@ $(COMPILER_RT_FLAGS_ramstage) --whole-archive --start-group $(filter-out %.ld,$(ramstage-objs)) $(ramstage-libs) --no-whole-archive $(COMPILER_RT_ramstage) --end-group
|
|
|
|
endif
|
2014-04-23 01:33:22 +02:00
|
|
|
|
2015-03-15 19:23:50 +01:00
|
|
|
endif # CONFIG_ARCH_RAMSTAGE_X86_32 / CONFIG_ARCH_RAMSTAGE_X86_64
|