Makefile: Preprocess linker scripts and other general improvements

This patch started out as an attempt to run linker scripts through the
preprocessor. However, since that required some more infrastructure
changes, the build system is so intertwined, and there are so many other
small issues that turned up and are easier to fix (and get running, and
test thoroughly) in a single go, it turned out a little bigger. In order
of appearance, it:

- wraps direct linker invocations in a macro to avoid the widespread
  ifeq($(CONFIG_COMPILER_LLVM_CLANG),y) duplication.

- introduces an $(generic-deps) (equivalent to $(<class>-deps)) variable
  for targets that all files depend on

- makes the $(src-to-obj) function usable in multiple places as the
  authoritative way to get an output file name (even if the respective
  source file is also under build/), and makes it preserve extensions on
  everything except %.c and %.S (e.g. %.ld and %.asl)

- replaces the old $(<class>-postprocess) with a single
  $(postprocessors) variable. The old ramstage-postprocess was weird
  because it contained unescaped $(eval ...)s, meaning it gets executed
  as soon as the variable is first substituted (and the other
  $(eval ...) in the toplevel Makefile does essentially nothing). The
  new mechanism is just $(eval ...)ed directly after the recursive parse
  with no further magic. Files can freely append their own (escaped)
  content to it and access variables valid in the calling context (like
  $(<class>-objs)) directly.

- enhances the existing $(<class>-<type>-ccopts) mechanism with
  $(<class>-generic-ccopts) and $(generic-<type>-ccopts) to reduce
  duplication.

- makes .ld a type that can be added like a normal class file, causing
  it to be preprocessed with the correct #defines for the current class
  (needed for a follow-up feature). Migrates all linker scripts to this
  mechanism, which allows us to get rid of the weird $(ldoptions)
  mechanism (Kconfigs are replaced by preprocessor and no longer need to
  be defined as symbols).

- removes duplicate $(INCLUDES) from $(CFLAGS)

- repairs the crazy state of MIPS Makefiles, which seem to have been
  copied together from X86 despite having absolutely nothing in common
  with that architecture. They were using the same code to paste
  assembly pieces and linker scripts together without really needing it
  for anything, and even accidentally relied on a Kconfig default set
  in the arch/x86 subdirectory (I wish I was kidding). Changed them to
  work equivalent to the arm/arm64 Makefiles which are far closer
  related (also being SRAM-based platforms).

- moves the x86-specifc $(OPTION_TABLES_H) into the x86 Makefile.inc and
  fixes an rule that would've had an empty target if it wasn't defined

- removes the custom ldscript-gathering variables for x86 bootblock and
  romstage. The Makefile simply combines all .ld files that have been
  added to the respective class now.

- uses the normal class build system to replace some of the custom rules
  for autogenerated bootblock/crt0 files on x86, and removes some
  hardcoded flags by using the normal $(...-ccopts) variables.

- moves the handling of .asl files from the global Makefile.inc to x86.
  Changed to reuse the generic template for the preprocessing and C
  compilation steps.

- removed the extra <name>.o linking step before linking an rmodule for
  modules that don't require special linker flags (most of them).

- removes the incorrect assumption that there was a global $(LDFLAGS)
  from the SMM Makefile.inc (it was named $(LDFLAGFS in one place so it
  couldn't have been all that important ;) ).

- allow -j flag for parallel builds to be properly passed through to
  vboot child invocation by using special $(MAKE) variable.

BUG=None
TEST=Built for Falco, Nyan_Blaze, Stout, Rush_Ryu and Urara. Binary
diffed old and new coreboot.rom (and some manually uncompressed stages),
confirmed that images/stages are byte-for-byte identical except for some
embedded timestamps and commit hashes. (Addresses in Falco/Stout
ramstages shifting slightly due to different link order for ASL object
files within their directory. Some addresses in Urara ramstage .rodata
and some relocation entries in rmodules moved around due to linking them
in fewer steps.)

Change-Id: I50af7dacf616e0f8ff4c43f4acc679089ad7022b
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/219170
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Julius Werner 2014-09-10 10:20:19 -07:00 committed by chrome-internal-fetch
commit af6852b98f
42 changed files with 248 additions and 400 deletions

View file

@ -79,6 +79,9 @@ HOSTCXX = g++
HOSTCFLAGS := -g
HOSTCXXFLAGS := -g
# Pass -undef to avoid predefined legacy macros like 'i386'
PREPROCESS_ONLY := -E -P -x assembler-with-cpp -undef
DOXYGEN := doxygen
DOXYGEN_OUTPUT_DIR := doxygen
@ -115,10 +118,20 @@ include $(HAVE_DOTCONFIG)
include toolchain.inc
COMMA:=,
# Function to wrap calls to the linker (will be overridden for CLANG)
# $1 stage
# $2 objects to link (will be wrapped in --start-group and --end-group)
# $3 options passed directly (to GCC or LD) (-nostdlib and -static are default)
# $4 options passed to LD (wrapped with -Wl, for GCC)
link=$(CC_$(1)) $(CFLAGS_$(1)) -nostdlib -static $(3) $(foreach opt,$(4),-Wl$(COMMA)$(opt)) -Wl,--start-group $(2) -Wl,--end-group
ifneq ($(INNER_SCANBUILD),y)
ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y)
CC:=clang -m32 -mno-mmx -mno-sse
HOSTCC:=clang
link:=$(LD_$(1)) -nostdlib -static $(3) $(4) --start-group $(2) --end-group
endif
endif
@ -165,6 +178,12 @@ endif
$(obj)/config.h:
$(MAKE) oldconfig
# Dependencies that should be built before all files in all classes
generic-deps = $(obj)/config.h
# Every file can append to this string. It is simply eval'ed after the scan.
postprocessors :=
# Add a new class of source/object files to the build system
add-class= \
$(eval $(1)-srcs:=) \
@ -214,12 +233,16 @@ endif
# Eliminate duplicate mentions of source files in a class
$(foreach class,$(classes),$(eval $(class)-srcs:=$(sort $($(class)-srcs))))
src-to-obj=$(addsuffix .$(1).o, $(basename $(patsubst src/%, $(obj)/%, $($(1)-srcs))))
$(foreach class,$(classes),$(eval $(class)-objs:=$(call src-to-obj,$(class))))
# Converts one or more source file paths to their corresponding build/ paths.
# Only .c and .S get converted to .o, other files (like .ld) keep their name.
# $1 stage name
# $2 file path (list)
src-to-obj=$(foreach file,$(2),$(basename $(patsubst src/%,$(obj)/%,$(file))).$(1)$(patsubst %.c,%.o,$(patsubst %.S,%.o,$(suffix $(file)))))
$(foreach class,$(classes),$(eval $(class)-objs+=$(call src-to-obj,$(class),$($(class)-srcs))))
# Call post-processors if they're defined
$(foreach class,$(classes),\
$(if $(value $(class)-postprocess),$(eval $(call $(class)-postprocess,$($(class)-objs)))))
$(eval $(postprocessors))
allsrcs:=$(foreach var, $(addsuffix -srcs,$(classes)), $($(var)))
allobjs:=$(foreach var, $(addsuffix -objs,$(classes)), $($(var)))
@ -228,14 +251,14 @@ alldirs:=$(sort $(abspath $(dir $(allobjs))))
# macro to define template macros that are used by use_template macro
define create_cc_template
# $1 obj class
# $2 source suffix (c, S)
# $2 source suffix (c, S, ld)
# $3 additional compiler flags
# $4 additional dependencies
ifn$(EMPTY)def $(1)-objs_$(2)_template
de$(EMPTY)fine $(1)-objs_$(2)_template
$(obj)/$$(1).$(1).o: src/$$(1).$(2) $(obj)/config.h $(4)
$$(call src-to-obj,$1,$$(1)): $$(1) $$$$(generic-deps) $(4)
@printf " CC $$$$(subst $$$$(obj)/,,$$$$(@))\n"
$(CC_$(1)) -MMD $$$$(CFLAGS_$(1)) $(3) -c -o $$$$@ $$$$<
$(CC_$(1)) -MMD $$$$(CFLAGS_$(1)) -MT $$$$(@) $(3) -c -o $$$$@ $$$$<
en$(EMPTY)def
end$(EMPTY)if
endef
@ -243,16 +266,17 @@ endef
filetypes-of-class=$(subst .,,$(sort $(suffix $($(1)-srcs))))
$(foreach class,$(classes), \
$(foreach type,$(call filetypes-of-class,$(class)), \
$(eval $(class)-$(type)-ccopts += $(generic-$(type)-ccopts) $($(class)-generic-ccopts)) \
$(eval $(call create_cc_template,$(class),$(type),$($(class)-$(type)-ccopts),$($(class)-$(type)-deps)))))
foreach-src=$(foreach file,$($(1)-srcs),$(eval $(call $(1)-objs_$(subst .,,$(suffix $(file)))_template,$(subst src/,,$(basename $(file))))))
foreach-src=$(foreach file,$($(1)-srcs),$(eval $(call $(1)-objs_$(subst .,,$(suffix $(file)))_template,$(file))))
$(eval $(foreach class,$(classes),$(call foreach-src,$(class))))
DEPENDENCIES = $(allobjs:.o=.d)
DEPENDENCIES = $(addsuffix .d,$(basename $(allobjs)))
-include $(DEPENDENCIES)
printall:
@$(foreach class,$(classes),echo $(class)-objs:=$($(class)-objs); )
@$(foreach class,$(classes),echo $(class)-objs=$($(class)-objs); )
@echo alldirs:=$(alldirs)
@echo allsrcs=$(allsrcs)
@echo DEPENDENCIES=$(DEPENDENCIES)

View file

@ -41,7 +41,7 @@ export objgenerated := $(obj)/generated
#######################################################################
# root rule to resolve if in build mode (ie. configuration exists)
real-target: $(obj)/config.h coreboot
real-target: coreboot
coreboot: build-dirs $(obj)/coreboot.rom
#######################################################################
@ -95,17 +95,12 @@ files-in-dir=$(filter-out $(call dir-wildcards,$(call filter-out-dirs,$(1),$(dir
#######################################################################
# reduce command line length by linking the objects of each
# directory into an intermediate file
ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y)
LINK=$(LD_ramstage)
else
LINK=$(CC_ramstage) $(CFLAGS_ramstage)
endif
ramstage-postprocess=$(foreach d,$(sort $(dir $(1))), \
$(eval $(d)ramstage.o: $(call files-in-dir,$(d),$(1)); $$(LINK) -o $$@ -r $$^ ) \
$(eval ramstage-objs:=$(d)ramstage.o $(filter-out $(call files-in-dir,$(d),$(1)),$(ramstage-objs))))
postprocessors += $$(foreach d,$$(sort $$(dir $$(filter %.o %.a,$$(ramstage-objs)))), \
$$(eval $$(d)ramstage.o: $$(call files-in-dir,$$(d),$$(ramstage-objs)); $$$$(call link,ramstage,$$$$(filter %.o %.a,$$$$(^)),-o $$$$(@),-r)) \
$$(eval ramstage-objs:=$$(d)ramstage.o $$(filter-out $$(call files-in-dir,$$(d),$$(filter %.o %.a,$$(ramstage-objs))),$$(ramstage-objs))))
romstage-c-ccopts:=-D__PRE_RAM__
romstage-S-ccopts:=-D__PRE_RAM__
bootblock-generic-ccopts += -D__PRE_RAM__ -D__BOOT_BLOCK__
romstage-generic-ccopts += -D__PRE_RAM__
ifeq ($(CONFIG_TRACE),y)
ramstage-c-ccopts:= -finstrument-functions
endif
@ -117,38 +112,8 @@ ifeq ($(CONFIG_USE_BLOBS),y)
forgetthis:=$(shell git submodule update --init --checkout 3rdparty)
endif
bootblock-c-ccopts:=-D__BOOT_BLOCK__ -D__PRE_RAM__
bootblock-S-ccopts:=-D__BOOT_BLOCK__ -D__PRE_RAM__
smmstub-c-ccopts:=-D__SMM__
smmstub-S-ccopts:=-D__SMM__
smm-c-ccopts:=-D__SMM__
smm-S-ccopts:=-D__SMM__
# SMM TSEG base is dynamic
ifneq ($(CONFIG_SMM_MODULES),y)
ifeq ($(CONFIG_SMM_TSEG),y)
smm-c-ccopts += -fpic
endif
endif
ramstage-c-deps:=$$(OPTION_TABLE_H)
romstage-c-deps:=$$(OPTION_TABLE_H)
verstage-c-deps:=$$(OPTION_TABLE_H)
bootblock-c-deps:=$$(OPTION_TABLE_H)
#######################################################################
# Add handler to compile ACPI's ASL
define ramstage-objs_asl_template
$(obj)/$(1).ramstage.o: src/$(1).asl $(obj)/config.h
@printf " IASL $$(subst $(top)/,,$$(@))\n"
$(CC_ramstage) -x assembler-with-cpp -E -MMD -MT $$(@) -D__ACPI__ -P -include $(src)/include/kconfig.h -I$(obj) -I$(src) -I$(src)/include -I$(src)/arch/$(ARCHDIR-$(ARCH-RAMSTAGE-y))/include -I$(src)/mainboard/$(MAINBOARDDIR) $$< -o $$(basename $$@).asl
cd $$(dir $$@); $(IASL) -p $$(notdir $$@) -tc $$(notdir $$(basename $$@)).asl
mv $$(basename $$@).hex $$(basename $$@).c
$(CC_ramstage) $$(CFLAGS_ramstage) $$(if $$(subst dsdt,,$$(basename $$(notdir $(1)))), -DAmlCode=AmlCode_$$(basename $$(notdir $(1)))) -c -o $$@ $$(basename $$@).c
# keep %.o: %.c rule from catching the temporary .c file after a make clean
mv $$(basename $$@).c $$(basename $$@).hex
endef
# Linker scripts are just preprocessed, not compiled
generic-ld-ccopts += $(PREPROCESS_ONLY)
#######################################################################
# Parse plaintext cmos defaults into binary format
@ -212,7 +177,7 @@ INCLUDES += -Isrc/device/oprom/include
# abspath is a workaround for romcc
INCLUDES += -include $(src)/include/kconfig.h
CFLAGS_common = $(INCLUDES) -pipe -g -nostdinc
CFLAGS_common = -pipe -g -nostdinc
CFLAGS_common += -nostdlib -Wall -Wundef -Wstrict-prototypes -Wmissing-prototypes
CFLAGS_common += -Wwrite-strings -Wredundant-decls -Wno-trigraphs
CFLAGS_common += -Wstrict-aliasing -Wshadow
@ -253,8 +218,7 @@ $(obj)/build.h: .xcompile
printf "#endif\n" >> $(obj)/build.ht
mv $(obj)/build.ht $(obj)/build.h
$(obj)/ldoptions: $(obj)/config.h
awk '/^#define ([^"])* ([^"])*$$/ {gsub("\\r","",$$3); print $$2 " = " $$3 ";";}' $< > $@
generic-deps += $(obj)/build.h
build-dirs:
mkdir -p $(objcbfs) $(objgenerated)
@ -311,18 +275,6 @@ $(objutil)/%.o: $(objutil)/%.c
@printf " HOSTCC $(subst $(objutil)/,,$(@))\n"
$(HOSTCC) -MMD -I$(subst $(objutil)/,util/,$(dir $<)) -I$(dir $<) $(HOSTCFLAGS) -c -o $@ $<
$(obj)/%.ramstage.o $(abspath $(obj))/%.ramstage.o: $(obj)/%.c $(obj)/config.h $(OPTION_TABLE_H)
@printf " CC $(subst $(obj)/,,$(@))\n"
$(CC_ramstage) -MMD $(CFLAGS_ramstage) $(ramstage-c-ccopts) -c -o $@ $<
$(obj)/%.romstage.o $(abspath $(obj))/%.romstage.o: $(obj)/%.c $(obj)/config.h $(OPTION_TABLE_H)
@printf " CC $(subst $(obj)/,,$(@))\n"
$(CC_romstage) -MMD $(CFLAGS_romstage) $(romstage-c-ccopts) -c -o $@ $<
$(obj)/%.bootblock.o $(abspath $(obj))/%.bootblock.o: $(obj)/%.c $(obj)/config.h $(OPTION_TABLE_H)
@printf " CC $(subst $(obj)/,,$(@))\n"
$(CC_bootblock) -MMD $(CFLAGS_bootblock) $(bootblock-c-ccopts) -c -o $@ $<
#######################################################################
# Clean up rules
clean-abuild:

View file

@ -46,38 +46,27 @@ bootblock-y += div0.c
bootblock-$(CONFIG_BOOTBLOCK_CONSOLE) += early_console.c
bootblock-y += id.S
bootblock-y += clock.c
$(obj)/arch/arm/id.bootblock.o: $(obj)/build.h
bootblock-y += stages.c
bootblock-y += eabi_compat.c
bootblock-y += memset.S
bootblock-y += memcpy.S
bootblock-y += memmove.S
$(objcbfs)/bootblock.debug: $(src)/arch/arm/bootblock.ld $(obj)/ldoptions $$(bootblock-objs) $(obj)/config.h
@printf " LINK $(subst $(obj)/,,$(@))\n"
ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y)
$(LD_bootblock) -nostdlib -m armelf_linux_eabi --gc-sections -static -o $@ -L$(obj) $< -T $(src)/arch/arm/bootblock.ld
else
# This is based on the assumption that bootblock and verstage are compatible
# from the linker's perspective.
$(CC_bootblock) $(CFLAGS_bootblock) -nostdlib -Wl,--gc-sections -static -o $@ -L$(obj) -T $(src)/arch/arm/bootblock.ld -Wl,--start-group $(bootblock-objs) -Wl,--end-group
endif
bootblock-y += bootblock.ld
endif
$(objcbfs)/bootblock.debug: $$(bootblock-objs)
@printf " LINK $(subst $(obj)/,,$(@))\n"
$(call link,bootblock,$(filter %.a %.o,$(^)),-o $(@) -L$(obj) -T $(obj)/arch/arm/bootblock.bootblock.ld,--gc-sections)
endif # CONFIG_ARCH_BOOTBLOCK_ARM
###############################################################################
# verification stage
###############################################################################
$(objcbfs)/verstage.debug: $$(verstage-objs) $(src)/arch/arm/verstage.ld $(obj)/ldoptions $$(VB2_LIB)
$(objcbfs)/verstage.debug: $$(verstage-objs) $$(VB2_LIB)
@printf " LINK $(subst $(obj)/,,$(@))\n"
ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y)
$(LD_verstage) -nostdlib --gc-sections -static -o $@ -L$(obj) $(verstage-objs) -T $(src)/arch/arm/verstage.ld
else
$(CC_verstage) $(CFLAGS_verstage) -nostdlib -Wl,--gc-sections -static -o $@ -L$(obj) -T $(src)/arch/arm/verstage.ld -Wl,--start-group $(verstage-objs) $(VB2_LIB) -Wl,--end-group
endif
$(call link,verstage,$(filter %.a %.o,$(^)),-o $(@) -L$(obj) -T $(obj)/arch/arm/verstage.verstage.ld,--gc-sections)
verstage-$(CONFIG_EARLY_CONSOLE) += early_console.c
verstage-y += div0.c
@ -87,6 +76,8 @@ verstage-y += memcpy.S
verstage-y += memmove.S
verstage-y += stages.c
verstage-y += verstage.ld
###############################################################################
# romstage
###############################################################################
@ -108,17 +99,15 @@ rmodules_arm-y += memcpy.S
rmodules_arm-y += memmove.S
rmodules_arm-y += eabi_compat.c
romstage-y += romstage.ld
VBOOT_STUB_DEPS += $(obj)/arch/arm/eabi_compat.rmodules_arm.o
$(objcbfs)/romstage.debug: $$(romstage-objs) $(src)/arch/arm/romstage.ld $(obj)/ldoptions
$(objcbfs)/romstage.debug: $$(romstage-objs)
@printf " LINK $(subst $(obj)/,,$(@))\n"
ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y)
$(LD_romstage) -nostdlib --gc-sections -static -o $@ -L$(obj) $(romstage-objs) -T $(src)/arch/arm/romstage.ld
else
$(CC_romstage) $(CFLAGS_romstage) -nostdlib -Wl,--gc-sections -static -o $@ -L$(obj) -T $(src)/arch/arm/romstage.ld -Wl,--start-group $(romstage-objs) -Wl,--end-group
endif
$(call link,romstage,$(filter %.a %.o,$(^)),-o $(@) -L$(obj) -T $(obj)/arch/arm/romstage.romstage.ld,--gc-sections)
endif
endif # CONFIG_ARCH_ROMSTAGE_ARM
###############################################################################
# ramstage
@ -137,6 +126,8 @@ ramstage-y += memcpy.S
ramstage-y += memmove.S
ramstage-y += clock.c
ramstage-y += ramstage.ld
rmodules_arm-y += memset.S
rmodules_arm-y += memcpy.S
rmodules_arm-y += memmove.S
@ -146,12 +137,8 @@ ramstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/mainboard.c
$(objcbfs)/ramstage.debug: $$(ramstage-objs) $(src)/arch/arm/ramstage.ld $(obj)/ldoptions
$(objcbfs)/ramstage.debug: $$(ramstage-objs)
@printf " CC $(subst $(obj)/,,$(@))\n"
ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y)
$(LD_ramstage) -nostdlib -m armelf_linux_eabi --gc-sections -o $@ --wrap __divdi3 --wrap __udivdi3 --wrap __moddi3 --wrap __umoddi3 --wrap __uidiv --start-group $(ramstage-objs) --end-group -T $(src)/arch/arm/ramstage.ld
else
$(CC_ramstage) $(CFLAGS_ramstage) -nostdlib -Wl,--gc-sections -static -o $@ -L$(obj) -Wl,--start-group $(ramstage-objs) -Wl,--end-group -T $(src)/arch/arm/ramstage.ld
endif
$(call link,ramstage,$(filter %.a %.o,$(^)),-o $(@) -L$(obj) -T $(obj)/arch/arm/ramstage.ramstage.ld,--gc-sections)
endif
endif # CONFIG_ARCH_RAMSTAGE_ARM

View file

@ -21,7 +21,6 @@
/* We use ELF as output format. So that we can debug the code in some form. */
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
INCLUDE ldoptions
PHDRS
{
@ -59,4 +58,4 @@ SECTIONS
*(.note.*)
*(.ARM.*)
}
}
}

View file

@ -20,7 +20,6 @@
*/
/* We use ELF as output format. So that we can debug the code in some form. */
INCLUDE ldoptions
PHDRS
{

View file

@ -19,15 +19,9 @@
* 2005.12 yhlu add ramstage cross the vga font buffer handling
*/
/* We use ELF as output format. So that we can debug the code in some form. */
/*
INCLUDE ldoptions
*/
/* We use ELF as output format. So that we can debug the code in some form. */
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
INCLUDE ldoptions
PHDRS
{

View file

@ -47,8 +47,6 @@ bootblock-y += div0.c
bootblock-$(CONFIG_BOOTBLOCK_CONSOLE) += early_console.c
bootblock-y += id.S
$(obj)/arch/arm64/id.bootblock.o: $(obj)/build.h
bootblock-y += c_entry.c
bootblock-y += stage_entry.S
bootblock-y += stages.c
@ -59,15 +57,13 @@ bootblock-y += ../../lib/memset.c
bootblock-y += ../../lib/memcpy.c
bootblock-y += ../../lib/memmove.c
bootblock-y += bootblock.ld
# Build the bootblock
$(objcbfs)/bootblock.debug: $(src)/arch/arm64/bootblock.ld $(obj)/ldoptions $$(bootblock-objs) $(obj)/config.h
$(objcbfs)/bootblock.debug: $$(bootblock-objs)
@printf " LINK $(subst $(obj)/,,$(@))\n"
ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y)
$(LD_bootblock) -nostdlib -m armelf_linux_eabi --gc-sections -static -o $@ -L$(obj) $< -T $(src)/arch/arm64/bootblock.ld
else
$(CC_bootblock) $(CFLAGS_bootblock) -nostdlib -Wl,--gc-sections -static -o $@ -L$(obj) -T $(src)/arch/arm64/bootblock.ld -Wl,--start-group $(bootblock-objs) -Wl,--end-group
endif
$(call link,bootblock,$(filter %.a %.o,$(^)),-o $(@) -L$(obj) -T $(obj)/arch/arm64/bootblock.bootblock.ld,--gc-sections)
endif # CONFIG_ARCH_BOOTBLOCK_ARM64
@ -89,6 +85,8 @@ romstage-y += ../../lib/memmove.c
romstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
romstage-y += transition.c transition_asm.S
romstage-y += romstage.ld
rmodules_arm64-y += ../../lib/memset.c
rmodules_arm64-y += ../../lib/memcpy.c
rmodules_arm64-y += ../../lib/memmove.c
@ -98,13 +96,9 @@ VBOOT_STUB_DEPS += $(obj)/arch/arm64/eabi_compat.rmodules_arm64.o
# Build the romstage
$(objcbfs)/romstage.debug: $$(romstage-objs) $(src)/arch/arm64/romstage.ld $(obj)/ldoptions
$(objcbfs)/romstage.debug: $$(romstage-objs)
@printf " LINK $(subst $(obj)/,,$(@))\n"
ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y)
$(LD_romstage) -nostdlib --gc-sections -static -o $@ -L$(obj) $(romstage-objs) -T $(src)/arch/arm64/romstage.ld
else
$(CC_romstage) $(CFLAGS_romstage) -nostdlib -Wl,--gc-sections -static -o $@ -L$(obj) -T $(src)/arch/arm64/romstage.ld -Wl,--start-group $(romstage-objs) -Wl,--end-group
endif
$(call link,romstage,$(filter %.a %.o,$(^)),-o $(@) -L$(obj) -T $(obj)/arch/arm64/romstage.romstage.ld,--gc-sections)
endif # CONFIG_ARCH_ROMSTAGE_ARM64
@ -129,6 +123,8 @@ ramstage-y += stage_entry.S
ramstage-$(CONFIG_ARCH_SPINTABLE) += spintable.c spintable_asm.S
ramstage-y += transition.c transition_asm.S
ramstage-y += ramstage.ld
rmodules_arm64-y += ../../lib/memset.c
rmodules_arm64-y += ../../lib/memcpy.c
rmodules_arm64-y += ../../lib/memmove.c
@ -145,12 +141,8 @@ ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/mainboard.c
# Build the ramstage
$(objcbfs)/ramstage.debug: $$(ramstage-objs) $(src)/arch/arm64/ramstage.ld $(obj)/ldoptions
$(objcbfs)/ramstage.debug: $$(ramstage-objs)
@printf " CC $(subst $(obj)/,,$(@))\n"
ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y)
$(LD_ramstage) -nostdlib -m armelf_linux_eabi --gc-sections -o $@ --wrap __divdi3 --wrap __udivdi3 --wrap __moddi3 --wrap __umoddi3 --wrap __uidiv --start-group $(ramstage-objs) --end-group -T $(src)/arch/arm64/ramstage.ld
else
$(CC_ramstage) $(CFLAGS_ramstage) -nostdlib -Wl,--gc-sections -static -o $@ -L$(obj) -Wl,--start-group $(ramstage-objs) -Wl,--end-group -T $(src)/arch/arm64/ramstage.ld
endif
$(call link,ramstage,$(filter %.a %.o,$(^)),-o $(@) -L$(obj) -T $(obj)/arch/arm64/ramstage.ramstage.ld,--gc-sections)
endif # CONFIG_ARCH_RAMSTAGE_ARM64

View file

@ -22,14 +22,14 @@
$(eval $(call create_class_compiler,secmon,arm64))
SECMON_DIR=$(obj)/arch/arm64/armv8/secmon
SECMON_SRC=$(SECMON_DIR)/secmon
SECMON_OBJ=$(SECMON_DIR)/secmon.o
SECMON_BIN=$(SECMON_DIR)/secmon
SECMON_ELF=$(SECMON_DIR)/secmon.elf
SECMON_RMOD=$(SECMON_DIR)/secmon.elf.rmod
SECMON_RAMSTAGE=$(SECMON_DIR)/secmon.ramstage.o
secmon-c-ccopts += -I$(src)/arch/arm64/include/armv8/ -include $(src)/include/kconfig.h -D__SECMON__
secmon-S-ccopts += -I$(src)/arch/arm64/include/armv8/ -include $(src)/include/kconfig.h -D__SECMON__
secmon-generic-ccopts += -D__SECMON__
secmon-c-ccopts += $(armv8_flags)
secmon-S-ccopts += $(armv8_asm_flags)
secmon-y += secmon_init.c
secmon-y += psci.c
@ -39,16 +39,13 @@ secmon-y += ../exception.c
secmon-y += ../../cpu.c
secmon-y += ../../transition_asm.S ../../transition.c
ramstage-srcs += $(SECMON_SRC)
ramstage-objs += $(SECMON_RAMSTAGE)
$(SECMON_OBJ): $$(secmon-objs)
$(CC_secmon) $(LDFLAGS) -nostdlib -r -o $@ $^
$(eval $(call rmodule_link,$(SECMON_ELF), $$$$(secmon-objs), 0,arm64))
$(eval $(call rmodule_link,$(SECMON_ELF), $(SECMON_OBJ), 0,arm64))
$(SECMON_SRC): $(SECMON_RMOD)
$(SECMON_BIN): $(SECMON_RMOD)
$(OBJCOPY_secmon) -O binary $< $@
$(SECMON_RAMSTAGE): $(SECMON_SRC)
$(SECMON_RAMSTAGE): $(SECMON_BIN)
@printf " OBJCOPY $(subst $(obj)/,,$(@))\n"
cd $(dir $@); $(OBJCOPY_secmon) -I binary $(notdir $<) -O elf64-littleaarch64 -B aarch64 $(notdir $@)

View file

@ -21,7 +21,6 @@
/* We use ELF as output format. So that we can debug the code in some form. */
OUTPUT_FORMAT("elf64-littleaarch64", "elf64-littleaarch64", "elf64-littleaarch64")
OUTPUT_ARCH(aarch64)
INCLUDE ldoptions
PHDRS
{

View file

@ -21,7 +21,6 @@
*/
/* We use ELF as output format. So that we can debug the code in some form. */
INCLUDE ldoptions
ENTRY(stage_entry)

View file

@ -19,15 +19,9 @@
* 2005.12 yhlu add ramstage cross the vga font buffer handling
*/
/* We use ELF as output format. So that we can debug the code in some form. */
/*
INCLUDE ldoptions
*/
/* We use ELF as output format. So that we can debug the code in some form. */
OUTPUT_FORMAT("elf64-littleaarch64", "elf64-littleaarch64", "elf64-littleaarch64")
OUTPUT_ARCH(aarch64)
INCLUDE ldoptions
PHDRS
{

View file

@ -35,16 +35,15 @@ endif
ifeq ($(CONFIG_ARCH_BOOTBLOCK_MIPS),y)
bootblock-y += boot.c
bootblock-y += bootblock.S
bootblock-y += bootblock_simple.c
bootblock-$(CONFIG_BOOTBLOCK_CONSOLE) += early_console.c
bootblock-y += stages.c
bootblock-y += ../../lib/memcpy.c
bootblock-y += ../../lib/memmove.c
bootblock-y += ../../lib/memset.c
bootblock_lds = $(src)/arch/mips/bootblock.ld
bootblock_inc += $(src)/arch/mips/bootblock.inc
bootblock_inc += $(objgenerated)/bootblock.inc
bootblock-y += bootblock.ld
# Much of the assembly code is generated by the compiler, and may contain
# terms which the preprocessor will happily go on to replace. For example
@ -52,35 +51,9 @@ bootblock_inc += $(objgenerated)/bootblock.inc
# prevent that.
bootblock-S-ccopts += -undef
$(objgenerated)/bootblock.ld: $$(bootblock_lds) $(obj)/ldoptions
@printf " GEN $(subst $(obj)/,,$(@))\n"
printf '$(foreach ldscript,ldoptions $(bootblock_lds),INCLUDE "$(ldscript)"\n)' > $@
$(objgenerated)/bootblock_inc.S: $$(bootblock_inc)
@printf " GEN $(subst $(obj)/,,$(@))\n"
printf '$(foreach crt0,$(bootblock_inc),#include "$(crt0)"\n)' > $@
$(objgenerated)/bootblock.o: $(objgenerated)/bootblock.s
@printf " CC $(subst $(obj)/,,$(@))\n"
$(CC_bootblock) $(bootblock-S-ccopts) -Wa,-acdlns -c -o $@ $< > $(basename $@).disasm
$(objgenerated)/bootblock.s: $(objgenerated)/bootblock_inc.S $(obj)/config.h $(obj)/build.h
@printf " CC $(subst $(obj)/,,$(@))\n"
$(CC_bootblock) $(bootblock-S-ccopts) -MMD -x assembler-with-cpp -E \
-I$(src)/include -I$(src)/arch/mips/include -I$(obj) \
-include $(obj)/build.h -include $(obj)/config.h -I. \
-I$(src) $< -o $@
$(objgenerated)/bootblock.inc: $(src)/arch/mips/$(subst ",,$(CONFIG_BOOTBLOCK_SOURCE)) $(bootblock_custom) $(obj)/config.h
@printf " CC $(subst $(obj)/,,$(@))\n"
$(CC_bootblock) $(bootblock-c-ccopts) $(CFLAGS_bootblock) -MM \
-MT$(objgenerated)/bootblock.inc \
$< > $(objgenerated)/bootblock.inc.d
$(CC_bootblock) $(bootblock-c-ccopts) -c -S $(CFLAGS_bootblock) -I. $< -o $@
$(objcbfs)/bootblock.debug: $(objgenerated)/bootblock.o $(objgenerated)/bootblock.ld $$(bootblock-objs) $(obj)/config.h
$(objcbfs)/bootblock.debug: $$(bootblock-objs)
@printf " LINK $(subst $(obj)/,,$(@))\n"
$(CC_bootblock) $(CFLAGS_bootblock) -nostdlib -Wl,--gc-sections -nostartfiles -include $(obj)/config.h -static -o $@ -L$(obj) -T $(objgenerated)/bootblock.ld -Wl,--start-group $(objgenerated)/bootblock.o $(bootblock-objs) -Wl,--end-group
$(call link,bootblock,$(filter %.a %.o,$(^)),-o $(@) -L$(obj) -T $(obj)/arch/mips/bootblock.bootblock.ld,--gc-sections)
endif # CONFIG_ARCH_BOOTBLOCK_MIPS
@ -97,17 +70,11 @@ romstage-y += ../../lib/memcpy.c
romstage-y += ../../lib/memmove.c
romstage-y += ../../lib/memset.c
romstage-lds = $(src)/arch/mips/romstage.ld
romstage-y += romstage.ld
$(objcbfs)/romstage.debug: $$(romstage-objs) $(objgenerated)/romstage.ld
$(objcbfs)/romstage.debug: $$(romstage-objs)
@printf " LINK $(subst $(obj)/,,$(@))\n"
$(CC_romstage) -nostdlib -Wl,--gc-sections -nostartfiles -static -o $@ -L$(obj) -T $(objgenerated)/romstage.ld -Wl,--start-group $(romstage-objs) -Wl,--end-group
$(objgenerated)/romstage.ld: $$(romstage-lds) $(obj)/ldoptions
@printf " GEN $(subst $(obj)/,,$(@))\n"
rm -f $@
printf '$(foreach ldscript,ldoptions $(romstage-lds),INCLUDE "$(ldscript:$(obj)/%=%)"\n)' >> $@.tmp
mv $@.tmp $@
$(call link,romstage,$(filter %.a %.o,$(^)),-o $(@) -L$(obj) -T $(obj)/arch/mips/romstage.romstage.ld,--gc-sections)
endif # CONFIG_ARCH_ROMSTAGE_MIPS
@ -124,22 +91,13 @@ ramstage-y += tables.c
ramstage-y += ../../lib/memcpy.c
ramstage-y += ../../lib/memmove.c
ramstage-y += ../../lib/memset.c
ramstage-y += ramstage.ld
ramstage-srcs += $(wildcard src/mainboard/$(MAINBOARDDIR)/mainboard.c)
ramstage-lds = $(src)/arch/mips/ramstage.ld
$(objgenerated)/ramstage.ld: $$(ramstage-lds) $(obj)/ldoptions
@printf " GEN $(subst $(obj)/,,$(@))\n"
rm -f $@
printf '$(foreach ldscript,ldoptions $(ramstage-lds),INCLUDE "$(ldscript:$(obj)/%=%)"\n)' >> $@.tmp
mv $@.tmp $@
$(objcbfs)/ramstage.debug: $(objgenerated)/ramstage.o $(objgenerated)/ramstage.ld
$(objcbfs)/ramstage.debug: $$(ramstage-objs)
@printf " CC $(subst $(obj)/,,$(@))\n"
$(CC_ramstage) -nostdlib -Wl,--gc-sections -nostartfiles -static -o $@ -L$(obj) -T $(objgenerated)/ramstage.ld $<
$(objgenerated)/ramstage.o: $$(ramstage-objs)
@printf " CC $(subst $(obj)/,,$(@))\n"
$(CC_ramstage) $(CFLAGS_ramstage) -nostdlib -r -o $@ -Wl,--start-group $(ramstage-objs) -Wl,--end-group
$(call link,ramstage,$(filter %.a %.o,$(^)),-o $(@) -L$(obj) -T $(obj)/arch/mips/ramstage.ramstage.ld,--gc-sections)
endif # CONFIG_ARCH_RAMSTAGE_MIPS

View file

@ -27,14 +27,31 @@ subdirs-y += boot
subdirs-y += lib
subdirs-y += smp
################################################################################
# i386 specific tools
################################################################################
NVRAMTOOL:=$(objutil)/nvramtool/nvramtool
OPTION_TABLE_H:=
ifeq ($(CONFIG_HAVE_OPTION_TABLE),y)
cbfs-files-y += cmos_layout.bin
cmos_layout.bin-file = $(obj)/cmos_layout.bin
cmos_layout.bin-type = 0x01aa
$(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 $@
OPTION_TABLE_H:=$(obj)/option_table.h
endif
generic-deps += $(OPTION_TABLE_H)
$(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
################################################################################
# X86 specific options
@ -45,6 +62,8 @@ CBFSTOOL_PRE1_OPTS = -m x86 -o $$(( $(CONFIG_ROM_SIZE) - $(CONFIG_CBFS_SIZE) ))
CBFSTOOL_PRE_OPTS = -b $(shell cat $(objcbfs)/base_xip.txt)
endif
LIBGCC_WRAP_LDFLAGS := --wrap __divdi3 --wrap __udivdi3 --wrap __moddi3 --wrap __umoddi3
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))
@ -58,33 +77,20 @@ cbfs-files-$(CONFIG_BOOTSPLASH) += bootsplash.jpg
bootsplash.jpg-file := $(call strip_quotes,$(CONFIG_BOOTSPLASH_FILE))
bootsplash.jpg-type := bootsplash
################################################################################
# i386 specific tools
NVRAMTOOL:=$(objutil)/nvramtool/nvramtool
$(OPTION_TABLE_H): $(NVRAMTOOL) $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout
@printf " OPTION $(subst $(obj)/,,$(@))\n"
$(NVRAMTOOL) -y $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout -H $@
$(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 $@
###############################################################################
# bootblock
###############################################################################
ifeq ($(CONFIG_ARCH_BOOTBLOCK_X86_32),y)
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-srcs += $(src)/arch/x86/init/failover.ld
bootblock-srcs += $(src)/cpu/x86/16bit/entry16.ld
bootblock-srcs += $(src)/cpu/x86/16bit/reset16.ld
bootblock-srcs += $(src)/arch/x86/lib/id.ld
ifeq ($(CONFIG_CPU_INTEL_FIRMWARE_INTERFACE_TABLE),y)
bootblock_lds += $(src)/cpu/intel/fit/fit.lds
bootblock-srcs += $(src)/cpu/intel/fit/fit.ld
endif
# TODO: Why can't this use the real bootblock-y += xxx.S mechanism instead?
bootblock_inc = $(src)/arch/x86/init/prologue.inc
bootblock_inc += $(src)/cpu/x86/16bit/entry16.inc
bootblock_inc += $(src)/cpu/x86/16bit/reset16.inc
@ -101,42 +107,36 @@ endif
bootblock_inc += $(objgenerated)/bootblock.inc
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__
bootblock_romccflags = -mcpu=k7 -msse
else
bootblock_romccflags = -mcpu=i386
endif
bootblock_romccflags += -O2 $(bootblock-c-ccopts) $(bootblock-generic-ccopts)
$(objgenerated)/bootblock.ld: $$(bootblock_lds) $(obj)/ldoptions
@printf " GEN $(subst $(obj)/,,$(@))\n"
printf '$(foreach ldscript,ldoptions $(bootblock_lds),INCLUDE "$(ldscript)"\n)' > $@
$(objgenerated)/bootblock_inc.S: $$(bootblock_inc)
@printf " GEN $(subst $(obj)/,,$(@))\n"
printf '$(foreach crt0,$(bootblock_inc),#include "$(crt0)"\n)' > $@
$(objgenerated)/bootblock.o: $(objgenerated)/bootblock.s
@printf " CC $(subst $(obj)/,,$(@))\n"
$(CC_bootblock) -Wa,-acdlns -c -o $@ $< > $(basename $@).disasm
$(objgenerated)/bootblock.s: $(objgenerated)/bootblock_inc.S $(obj)/config.h $(obj)/build.h
@printf " CC $(subst $(obj)/,,$(@))\n"
$(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 $@
$(objgenerated)/bootblock.inc: $(src)/arch/x86/init/$(subst ",,$(CONFIG_BOOTBLOCK_SOURCE)) $(objutil)/romcc/romcc $(OPTION_TABLE_H) $(obj)/config.h
$(objgenerated)/bootblock.inc: $(src)/arch/x86/init/$(subst ",,$(CONFIG_BOOTBLOCK_SOURCE)) $(objutil)/romcc/romcc $$(generic-deps)
@printf " ROMCC $(subst $(obj)/,,$(@))\n"
$(CC_bootblock) $(INCLUDES) $(INCLUDES_bootblock) -MM -MT$(objgenerated)/bootblock.inc \
$< > $(objgenerated)/bootblock.inc.d
$(ROMCC) -c -S $(bootblock_romccflags) -I. $(INCLUDES) $(INCLUDES_bootblock) $< -o $@
$(objcbfs)/bootblock.debug: $(objgenerated)/bootblock.o $(objgenerated)/bootblock.ld
@printf " LINK $(subst $(obj)/,,$(@))\n"
ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y)
$(LD_bootblock) -m elf_i386 -static -o $@.tmp -L$(obj) $< -T $(objgenerated)/bootblock.ld
else
$(CC_bootblock) $(CFLAGS_bootblock) -nostartfiles -static -o $@ -L$(obj) -T $(objgenerated)/bootblock.ld $<
endif
$(objgenerated)/bootblock.ld: $$(filter %.ld,$$(bootblock-objs))
@printf " GEN $(subst $(obj)/,,$(@))\n"
printf '$(foreach ldscript,$(^),INCLUDE "$(ldscript)"\n)' > $@
endif
$(objgenerated)/bootblock.S: $$(bootblock_inc)
@printf " GEN $(subst $(obj)/,,$(@))\n"
printf '$(foreach inc,$(bootblock_inc),#include "$(inc)"\n)' > $@
bootblock-srcs += $(objgenerated)/bootblock.S
bootblock-S-ccopts += -I. -Wa,-acdlns=$$$$(basename $$$$(@)).disasm
$(objcbfs)/bootblock.debug: $(objgenerated)/bootblock.bootblock.o $(objgenerated)/bootblock.ld
@printf " LINK $(subst $(obj)/,,$(@))\n"
$(call link,bootblock,$(<),-o $(@) -L$(obj) -T $(objgenerated)/bootblock.ld,)
endif #CONFIG_ARCH_BOOTBLOCK_X86_32
###############################################################################
# romstage
@ -145,10 +145,9 @@ endif
ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32),y)
crt0s = $(src)/arch/x86/init/prologue.inc
ldscripts =
ldscripts += $(src)/arch/x86/init/romstage.ld
romstage-srcs += $(src)/arch/x86/init/romstage.ld
crt0s += $(src)/cpu/x86/32bit/entry32.inc
ldscripts += $(src)/cpu/x86/32bit/entry32.lds
romstage-srcs += $(src)/cpu/x86/32bit/entry32.ld
crt0s += $(src)/cpu/x86/fpu_enable.inc
ifeq ($(CONFIG_SSE),y)
@ -171,13 +170,14 @@ endif
ifeq ($(CONFIG_ROMCC),y)
ifeq ($(CONFIG_MMX),y)
ifeq ($(CONFIG_SSE),y)
ROMCCFLAGS := -mcpu=p4 -O2 # MMX, SSE
ROMCCFLAGS = -mcpu=p4 -O2 # MMX, SSE
else
ROMCCFLAGS := -mcpu=p2 -O2 # MMX, !SSE
ROMCCFLAGS = -mcpu=p2 -O2 # MMX, !SSE
endif
else
ROMCCFLAGS := -mcpu=i386 -O2 # !MMX, !SSE
endif
ROMCCFLAGS = -mcpu=i386 -O2 # !MMX, !SSE
endif # CONFIG_MMX
ROMCCFLAGS += $(romstage-c-ccopts) $(romstage-generic-ccopts)
$(objcbfs)/romstage_%.bin: $(objcbfs)/romstage_%.elf
@printf " OBJCOPY $(subst $(obj)/,,$(@))\n"
@ -191,49 +191,39 @@ $(objcbfs)/romstage_%.elf: $(objcbfs)/romstage_%.debug
$(OBJCOPY_romstage) --add-gnu-debuglink=$< $@.tmp
mv $@.tmp $@
$(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc: $(src)/mainboard/$(MAINBOARDDIR)/romstage.c $(objutil)/romcc/romcc $(OPTION_TABLE_H) $(obj)/build.h $(obj)/config.h
$(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc: $(src)/mainboard/$(MAINBOARDDIR)/romstage.c $(objutil)/romcc/romcc $$(generic-deps)
printf " ROMCC romstage.inc\n"
$(ROMCC) -c -S $(ROMCCFLAGS) -D__PRE_RAM__ -I. $(INCLUDES) $(INCLUDES_romstage) $< -o $@
else
$(ROMCC) -c -S $(ROMCCFLAGS) -I. $(INCLUDES) $(INCLUDES_romstage) $< -o $@
else # CONFIG_ROMCC
$(obj)/mainboard/$(MAINBOARDDIR)/romstage.pre.inc: $(src)/mainboard/$(MAINBOARDDIR)/romstage.c $(OPTION_TABLE_H) $(obj)/build.h $(obj)/config.h
$(obj)/mainboard/$(MAINBOARDDIR)/romstage.pre.inc: $(src)/mainboard/$(MAINBOARDDIR)/romstage.c $$(generic-deps)
@printf " CC romstage.inc\n"
$(CC_romstage) -MMD $(CFLAGS_romstage) -D__PRE_RAM__ -I$(src) -I. -I$(obj) -c -S $< -o $@
$(CC_romstage) -MMD $(CFLAGS_romstage) $(romstage-c-ccopts) $(romstage-generic-ccopts) -I$(src) -I. -I$(obj) -c -S $< -o $@
$(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc: $(obj)/mainboard/$(MAINBOARDDIR)/romstage.pre.inc
@printf " POST romstage.inc\n"
sed -e 's/\.rodata/.rom.data/g' -e 's/\^\.text/.section .rom.text/g' \
-e 's/\^\.section \.text/.section .rom.text/g' $^ > $@.tmp
mv $@.tmp $@
endif
endif # CONFIG_ROMCC
romstage-srcs += $(objgenerated)/crt0.s
$(objcbfs)/romstage_null.debug: $$(romstage-objs) $(objgenerated)/romstage_null.ld
$(objcbfs)/romstage_null.debug: $$(romstage-objs) $(LIBGCC_FILE_NAME_romstage) $(objgenerated)/romstage_null.ld
@printf " LINK $(subst $(obj)/,,$(@))\n"
ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y)
$(LD_romstage) -nostdlib -nostartfiles -static -o $@ -L$(obj) --wrap __divdi3 --wrap __udivdi3 --wrap __moddi3 --wrap __umoddi3 --start-group $(romstage-objs) $(LIBGCC_FILE_NAME_romstage) --end-group -T $(objgenerated)/romstage_null.ld
else
$(CC_romstage) $(CFLAGS_romstage) -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) $(LIBGCC_FILE_NAME_romstage) -Wl,--end-group
endif
$(call link,romstage,$(filter %.o %.a,$(^)),-o $(@) -L$(obj) -T $(objgenerated)/romstage_null.ld,$(LIBGCC_WRAP_LDFLAGS))
$(NM_romstage) $@ | grep -q " [DdBb] "; if [ $$? -eq 0 ]; then \
echo "Forbidden global variables in romstage:"; \
$(NM_romstage) $@ | grep " [DdBb] "; test "$(CONFIG_CPU_AMD_AGESA)" = y; \
else true; fi
$(objcbfs)/romstage_xip.debug: $$(romstage-objs) $(objgenerated)/romstage_xip.ld
$(objcbfs)/romstage_xip.debug: $$(romstage-objs) $(LIBGCC_FILE_NAME_romstage) $(objgenerated)/romstage_xip.ld
@printf " LINK $(subst $(obj)/,,$(@))\n"
ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y)
$(LD_romstage) -nostdlib -nostartfiles -static -o $@ -L$(obj) --wrap __divdi3 --wrap __udivdi3 --wrap __moddi3 --wrap __umoddi3 --start-group $(romstage-objs) $(LIBGCC_FILE_NAME_romstage) --end-group -T $(objgenerated)/romstage_xip.ld
else
$(CC_romstage) $(CFLAGS_romstage) -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) $(LIBGCC_FILE_NAME_romstage) -Wl,--end-group
endif
$(call link,romstage,$(filter %.o %.a,$(^)),-o $(@) -L$(obj) -T $(objgenerated)/romstage_xip.ld,$(LIBGCC_WRAP_LDFLAGS))
$(objgenerated)/romstage_null.ld: $$(ldscripts) $(obj)/ldoptions
$(objgenerated)/romstage_null.ld: $$(filter %.ld,$$(romstage-objs))
@printf " GEN $(subst $(obj)/,,$(@))\n"
rm -f $@
printf "ROMSTAGE_BASE = 0x0;\n" > $@.tmp
printf '$(foreach ldscript,ldoptions $(ldscripts),INCLUDE "$(ldscript:$(obj)/%=%)"\n)' >> $@.tmp
printf '$(foreach ldscript,$(^),INCLUDE "$(ldscript)"\n)' >> $@.tmp
mv $@.tmp $@
$(objgenerated)/romstage_xip.ld: $(objgenerated)/romstage_null.ld $(objcbfs)/base_xip.txt
@ -249,19 +239,16 @@ $(objcbfs)/base_xip.txt: $(obj)/coreboot.pre1 $(objcbfs)/romstage_null.bin
|| { echo "The romstage is larger than XIP size. Please expand the CONFIG_XIP_ROM_SIZE" ; exit 1; }
mv $@.tmp $@
$(objgenerated)/crt0.romstage.S: $$(crt0s)
$(objgenerated)/crt0.S: $$(crt0s)
@printf " GEN $(subst $(obj)/,,$(@))\n"
printf '$(foreach crt0,$(crt0s),#include "$(crt0:$(obj)/%=%)"\n)' > $@
printf '$(foreach crt0,$(crt0s),#include "$(crt0)"\n)' > $@
$(objgenerated)/crt0.romstage.o: $(objgenerated)/crt0.s
@printf " CC $(subst $(obj)/,,$(@))\n"
$(CC_romstage) -Wa,-acdlns -c -o $@ $< > $(basename $@).disasm
romstage-srcs += $(objgenerated)/crt0.S
$(objgenerated)/crt0.s: $(objgenerated)/crt0.romstage.S $(obj)/config.h $(obj)/build.h
@printf " CC $(subst $(obj)/,,$(@))\n"
$(CC_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 $@
# Compiling crt0 with -g seems to trigger https://sourceware.org/bugzilla/show_bug.cgi?id=6428
romstage-S-ccopts += -I. -Wa,-acdlns=$$$$(basename $$$$(@)).disasm -g0
endif
endif # CONFIG_ARCH_ROMSTAGE_X86_32
###############################################################################
# ramstage
@ -299,7 +286,7 @@ endif
ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/fadt.c),)
ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/fadt.c
endif
endif
endif # CONFIG_GENERATE_ACPI_TABLES
ifeq ($(CONFIG_HAVE_SMI_HANDLER),y)
ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/smihandler.c),)
smm-srcs += src/mainboard/$(MAINBOARDDIR)/smihandler.c
@ -317,27 +304,45 @@ $(eval $(call rmodule_link,$(objcbfs)/ramstage.debug, $(objgenerated)/ramstage.o
$(objcbfs)/ramstage.elf: $(objcbfs)/ramstage.debug.rmod
cp $< $@
else
else # CONFIG_RELOCATABLE_RAMSTAGE
$(objcbfs)/ramstage.debug: $(objgenerated)/ramstage.o $(src)/arch/x86/ramstage.ld
ramstage-srcs += $(src)/arch/x86/ramstage.ld
$(objcbfs)/ramstage.debug: $(objgenerated)/ramstage.o
@printf " CC $(subst $(obj)/,,$(@))\n"
ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y)
$(LD_ramstage) -m elf_i386 -o $@ -L$(obj) $< -T $(src)/arch/x86/ramstage.ld
else
$(CC_ramstage) $(CFLAGS_ramstage) -nostartfiles -static -o $@ -L$(obj) -T $(src)/arch/x86/ramstage.ld $<
endif
$(call link,ramstage,$(<),-o $(@) -L$(obj) -T $(obj)/arch/x86/ramstage.ramstage.ld,)
endif
endif # CONFIG_RELOCATABLE_RAMSTAGE
$(objgenerated)/ramstage.o: $$(ramstage-objs) $(LIBGCC_FILE_NAME_ramstage)
@printf " CC $(subst $(obj)/,,$(@))\n"
ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y)
$(LD_ramstage) -m elf_i386 -r -o $@ --wrap __divdi3 --wrap __udivdi3 --wrap __moddi3 --wrap __umoddi3 --start-group $(ramstage-objs) $(LIBGCC_FILE_NAME_ramstage) --end-group
else
$(CC_ramstage) $(CFLAGS_ramstage) -r -o $@ -Wl,--wrap,__divdi3 -Wl,--wrap,__udivdi3 -Wl,--wrap,__moddi3 -Wl,--wrap,__umoddi3 -Wl,--start-group $(ramstage-objs) $(LIBGCC_FILE_NAME_ramstage) -Wl,--end-group
endif
$(call link,ramstage,$(filter %.o %.a,$(^)),-o $(@) -L$(obj),-r $(LIBGCC_WRAP_LDFLAGS))
endif # CONFIG_ARCH_ROMSTAGE_X86_32
################################################################################
# ACPI ASL
################################################################################
# Compile ASLs in three steps: src/%.asl -CPP-> obj/%.<class>.asl -IASL-> obj/%.<class>.c -CC-> obj/%.<class>.o
generic-asl-ccopts += $(PREPROCESS_ONLY) -D__ACPI__ -I$(src)/mainboard/$(MAINBOARDDIR)
%.c: %.asl
@printf " IASL $(subst $(top)/,,$(@))\n"
cd $(dir $(<)); $(IASL) -p $(notdir $(<)) -tc $(notdir $(<))
mv $(<:%.asl=%.hex) $(@)
# Change array identifier in generated files for everything but dsdt to avoid conflicts
# (TODO: Shouldn't we just call that one AmlCode_dsdt as well for consistency?)
$(if $(subst dsdt,,$(basename $(basename $(notdir $(<))))),sed -ie 's/AmlCode/AmlCode_$(basename $(basename $(notdir $(<))))/' $(@))
# Prepend function that does equivalent of '<class>-y += <aslfile>.o' for all <aslfile>.asl in <class> to postprocessors
postprocessors := $$(foreach class,$$(classes), \
$$(foreach asl,$$(filter %.asl,$$(call src-to-obj,$$(class),$$($$(class)-srcs))), \
$$(eval ramstage-objs += $$(asl:%.asl=%.o)) \
$$(eval ramstage-srcs += $$(asl:%.asl=%.c)))) \
$(postprocessors)
endif
################################################################################

View file

@ -1,3 +1,4 @@
#include <build.h>
.section ".id", "a", @progbits
.globl __id_start

View file

@ -20,7 +20,6 @@
*/
/* We use ELF as output format. So that we can debug the code in some form. */
INCLUDE ldoptions
ENTRY(_start)

View file

@ -33,8 +33,3 @@ secmon-$(CONFIG_ARCH_USE_SECURE_MONITOR) += vtxprintf.c
secmon-$(CONFIG_ARCH_USE_SECURE_MONITOR) += console.c
secmon-$(CONFIG_ARCH_USE_SECURE_MONITOR) += die.c
secmon-$(CONFIG_ARCH_USE_SECURE_MONITOR) += printk.c
$(obj)/console/console.ramstage.o : $(obj)/build.h
$(obj)/console/console.romstage.o : $(obj)/build.h
$(obj)/console/console.verstage.o : $(obj)/build.h
$(obj)/console/console.bootblock.o : $(obj)/build.h

View file

@ -9,14 +9,11 @@ SIPI_BIN=$(SIPI_ELF:.elf=)
SIPI_DOTO=$(SIPI_ELF:.elf=.o)
ifeq ($(CONFIG_PARALLEL_MP),y)
ramstage-srcs += $(SIPI_BIN)
ramstage-objs += $(SIPI_BIN).ramstage.o
endif
rmodules_$(ARCH-RAMSTAGE-y)-$(CONFIG_PARALLEL_MP) += sipi_vector.S
$(SIPI_DOTO): $(dir $(SIPI_ELF))sipi_vector.rmodules_$(ARCH-RAMSTAGE-y).o
$(CC_ramstage) $(LDFLAGS) -nostdlib -r -o $@ $^
$(eval $(call rmodule_link,$(SIPI_ELF), $(SIPI_ELF:.elf=.o), 0,x86_32))
$(eval $(call rmodule_link,$(SIPI_ELF), $(dir $(SIPI_ELF))sipi_vector.rmodules_$(ARCH-RAMSTAGE-y).o, 0,x86_32))
$(SIPI_BIN): $(SIPI_RMOD)
$(OBJCOPY_ramstage) -O binary $< $@

View file

@ -22,6 +22,9 @@ ramstage-$(CONFIG_BACKUP_DEFAULT_SMM_REGION) += backup_default_smm.c
$(eval $(call create_class_compiler,smm,x86_32))
$(eval $(call create_class_compiler,smmstub,x86_32))
smmstub-generic-ccopts += -D__SMM__
smm-generic-ccopts += -D__SMM__
ifeq ($(CONFIG_SMM_MODULES),y)
smmstub-y += smm_stub.S
@ -30,16 +33,11 @@ smm-y += smm_module_handler.c
ramstage-y += smm_module_loader.c
ramstage-srcs += $(obj)/cpu/x86/smm/smm
ramstage-srcs += $(obj)/cpu/x86/smm/smmstub
ramstage-objs += $(obj)/cpu/x86/smm/smm.ramstage.o
ramstage-objs += $(obj)/cpu/x86/smm/smmstub.ramstage.o
# SMM Stub Module. The stub is used as a trampoline for relocation and normal
# SMM handling.
$(obj)/cpu/x86/smm/smmstub.o: $$(smmstub-objs)
$(CC_smmstub) $(LDFLAGS) -nostdlib -r -o $@ $^
# Link the SMM stub module with a 0-byte heap.
$(eval $(call rmodule_link,$(obj)/cpu/x86/smm/smmstub.elf, $(obj)/cpu/x86/smm/smmstub.o, 0,x86_32))
# SMM Stub Module. The stub is used as a trampoline for relocation and normal SMM handling.
$(eval $(call rmodule_link,$(obj)/cpu/x86/smm/smmstub.elf, $$$$(smmstub-objs), 0,x86_32))
$(obj)/cpu/x86/smm/smmstub: $(obj)/cpu/x86/smm/smmstub.elf.rmod
$(OBJCOPY_smmstub) -O binary $< $@
@ -51,8 +49,8 @@ $(obj)/cpu/x86/smm/smmstub.ramstage.o: $(obj)/cpu/x86/smm/smmstub
# C-based SMM handler.
$(obj)/cpu/x86/smm/smm.o: $$(smm-objs) $(LIBGCC_FILE_NAME_smm)
$(CC_smm) $(LDFLAGS) -nostdlib -r -o $@ -Wl,--wrap,__divdi3 -Wl,--wrap,__udivdi3 -Wl,--wrap,__moddi3 -Wl,--wrap,__umoddi3 -Wl,--start-group $(smm-objs) $(LIBGCC_FILE_NAME_smm) -Wl,--end-group
@printf " LINK $(subst $(obj)/,,$(@))\n"
$(call link,smm,$(filter %.a %.o,$(^)),-o $(@),-r $(LIBGCC_WRAP_LDFLAGS))
$(eval $(call rmodule_link,$(obj)/cpu/x86/smm/smm.elf, $(obj)/cpu/x86/smm/smm.o, $(CONFIG_SMM_MODULE_HEAP_SIZE),x86_32))
@ -67,28 +65,33 @@ else # CONFIG_SMM_MODULES
ramstage-$(CONFIG_HAVE_SMI_HANDLER) += smmrelocate.S
ifeq ($(CONFIG_HAVE_SMI_HANDLER),y)
ramstage-srcs += $(obj)/cpu/x86/smm/smm_wrap
ramstage-objs += $(obj)/cpu/x86/smm/smm_wrap.ramstage.o
endif
# Use TSEG specific entry point and linker script
ifeq ($(CONFIG_SMM_TSEG),y)
smm-y += smmhandler_tseg.S
SMM_LDFLAGS := $(LDFLAGS) -pie
SMM_LDSCRIPT := smm_tseg.ld
smm-c-ccopts += -fpic
SMM_LDFLAGS := -pie
SMM_LDSCRIPT := smm_tseg
else
smm-y += smmhandler.S
SMM_LDFLAGS := $(LDFLAGFS)
SMM_LDSCRIPT := smm.ld
SMM_LDFLAGS :=
SMM_LDSCRIPT := smm
endif
smm-y += smihandler.c
smm-y += smiutil.c
$(obj)/cpu/x86/smm/smm.o: $$(smm-objs) $(LIBGCC_FILE_NAME_smm)
$(CC_smm) $(LDFLAGS) -nostdlib -r -o $@ -Wl,--wrap,__divdi3 -Wl,--wrap,__udivdi3 -Wl,--wrap,__moddi3 -Wl,--wrap,__umoddi3 -Wl,--start-group $(smm-objs) $(LIBGCC_FILE_NAME_smm) -Wl,--end-group
smm-y += $(SMM_LDSCRIPT).ld
$(obj)/cpu/x86/smm/smm_wrap: $(obj)/cpu/x86/smm/smm.o $(src)/cpu/x86/smm/$(SMM_LDSCRIPT) $(obj)/ldoptions
$(CC_smm) $(SMM_LDFLAGS) -nostdlib -nostartfiles -static -o $(obj)/cpu/x86/smm/smm.elf -T $(src)/cpu/x86/smm/$(SMM_LDSCRIPT) $(obj)/cpu/x86/smm/smm.o
$(obj)/cpu/x86/smm/smm.o: $$(smm-objs) $(LIBGCC_FILE_NAME_smm)
@printf " LINK $(subst $(obj)/,,$(@))\n"
$(call link,smm,$(filter %.a %.o,$(^)),-o $(@),-r $(LIBGCC_WRAP_LDFLAGS))
$(obj)/cpu/x86/smm/smm_wrap: $(obj)/cpu/x86/smm/smm.o
@printf " LINK $(subst $(obj)/,,$(@))\n"
$(call link,smm,$(<),-o $(obj)/cpu/x86/smm/smm.elf -T $(obj)/cpu/x86/smm/$(SMM_LDSCRIPT).smm.ld,$(SMM_LDFLAGS))
$(NM_smm) -n $(obj)/cpu/x86/smm/smm.elf | sort > $(obj)/cpu/x86/smm/smm.map
$(OBJCOPY_smm) -O binary $(obj)/cpu/x86/smm/smm.elf $(obj)/cpu/x86/smm/smm

View file

@ -19,8 +19,3 @@ cmos.default-type = 0xaa
smm-y += mc146818.c
smm-y += mc146818rtc.c
$(obj)/drivers/pc80/mc146818rtc.ramstage.o : $(obj)/build.h
$(obj)/drivers/pc80/mc146818.ramstage.o : $(obj)/build.h
$(obj)/drivers/pc80/mc146818rtc.smm.o : $(obj)/build.h
$(obj)/drivers/pc80/mc146818.smm.o : $(obj)/build.h

View file

@ -35,7 +35,8 @@ romstage-y += memchr.c
romstage-y += memcmp.c
$(foreach arch,$(ARCH_SUPPORTED),\
$(eval rmodules_$(ARCH_TO_TOOLCHAIN_$(arch))-y += memcmp.c))
$(eval rmodules_$(ARCH_TO_TOOLCHAIN_$(arch))-y += memcmp.c) \
$(eval rmodules_$(ARCH_TO_TOOLCHAIN_$(arch))-y += rmodule.ld))
verstage-y += delay.c
verstage-y += cbfs.c
@ -122,26 +123,11 @@ smm-$(CONFIG_CONSOLE_SERIAL8250MEM) += uart8250mem.c
smm-$(CONFIG_USBDEBUG) += usbdebug.c
smm-y += gcc.c
$(obj)/lib/version.ramstage.o : $(obj)/build.h
OPTION_TABLE_H:=
ifeq ($(CONFIG_HAVE_OPTION_TABLE),y)
OPTION_TABLE_H:=$(obj)/option_table.h
endif
$(obj)/lib/uart8250mem.smm.o : $(OPTION_TABLE_H)
$(obj)/lib/uart8250.smm.o : $(OPTION_TABLE_H)
ifeq ($(CONFIG_RELOCATABLE_MODULES),y)
ramstage-y += rmodule.c
# Include rmodule.c in romstage if vboot verification is selected.
romstage-$(CONFIG_VBOOT_VERIFY_FIRMWARE) += rmodule.c
RMODULE_LDSCRIPT := $(src)/lib/rmodule.ld
ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y)
RMODULE_LDFLAGS := -nostartfiles -Wl,--emit-relocs -Wl,-z,defs -Wl,-Bsymbolic -Wl,-T,$(RMODULE_LDSCRIPT)
# rmodule_link_rules is a function that should be called with:
# (1) the object name to link
# (2) the dependencies
@ -150,28 +136,8 @@ RMODULE_LDFLAGS := -nostartfiles -Wl,--emit-relocs -Wl,-z,defs -Wl,-Bsymbolic -
# It will create the necessary Make rules to create a rmodule. The resulting
# rmdoule is named $(1).rmod
define rmodule_link
$(strip $(1)): $(strip $(2)) $$(RMODULE_LDSCRIPT) $$(obj)/ldoptions
$$(LD_rmodules_$(4)) -y $$(RMODULE_LDFLAGS) --defsym=__heap_size=$(strip $(3)) -o $$@ --start-group $(strip $(2)) $$(LIBGCC_FILE_NAME_rmodules_$(4)) --end-group
$$(NM_rmodules_$(4)) -n $$@ > $$(basename $$@).map
$(strip $(1)).rmod: $(strip $(1))
$$(RMODTOOL) -i $$^ -o $$@
endef
else
RMODULE_LDFLAGS := -nostartfiles -Wl,--emit-relocs -Wl,-z,defs -Wl,-Bsymbolic -Wl,-T,$(RMODULE_LDSCRIPT)
# rmodule_link_rules is a function that should be called with:
# (1) the object name to link
# (2) the dependencies
# (3) heap size of the relocatable module
# (4) arch for which the rmodules are to be linked
# It will create the necessary Make rules to create a rmodule. The resulting
# rmdoule is named $(1).rmod
define rmodule_link
$(strip $(1)): $(strip $(2)) $$(RMODULE_LDSCRIPT) $$(obj)/ldoptions $$(RMODTOOL)
$$(CC_rmodules_$(4)) $$(CFLAGS_rmodules_$(4)) $$(RMODULE_LDFLAGS) -Wl,--defsym=__heap_size=$(strip $(3)) -o $$@ -Wl,--start-group $(strip $(2)) $$(LIBGCC_FILE_NAME_rmodules_$(4)) -Wl,--end-group
$(strip $(1)): $(strip $(2)) $$(LIBGCC_FILE_NAME_rmodules_$(4)) $(obj)/lib/rmodule.rmodules_$(4).ld $$(RMODTOOL)
$$(call link,rmodules_$(4),$$(filter %.a %.o,$$(^)),-o $$(@) -T $(obj)/lib/rmodule.rmodules_$(4).ld,--emit-relocs -z defs -Bsymbolic --defsym=__heap_size=$(strip $(3)))
$$(NM_rmodules_$(4)) -n $$@ > $$(basename $$@).map
$(strip $(1)).rmod: $(strip $(1))
@ -181,5 +147,3 @@ endef
endif
endif

View file

@ -37,5 +37,3 @@ cbfs-files-$(CONFIG_HAVE_MRC) += mrc.bin
mrc.bin-file := $(call strip_quotes,$(CONFIG_MRC_FILE))
mrc.bin-position := 0xfffa0000
mrc.bin-type := 0xab
$(obj)/northbridge/intel/haswell/acpi.ramstage.o : $(obj)/build.h

View file

@ -42,5 +42,3 @@ ifeq ($(CONFIG_NORTHBRIDGE_INTEL_SANDYBRIDGE),y)
mrc.bin-position := 0xfffe0000
endif
mrc.bin-type := 0xab
$(obj)/northbridge/intel/sandybridge/acpi.ramstage.o : $(obj)/build.h

View file

@ -23,5 +23,6 @@ ramstage-y += vga.c
ramstage-y += lpc.c
ramstage-y += ide.c
bootblock-y += romstrap.ld
chipset_bootblock_inc += $(src)/northbridge/via/vx800/romstrap.inc
chipset_bootblock_lds += $(src)/northbridge/via/vx800/romstrap.lds

View file

@ -20,6 +20,6 @@ ramstage-$(CONFIG_USBDEBUG) += enable_usbdebug.c
smm-$(CONFIG_USBDEBUG) += enable_usbdebug.c
romstage-y += early_smbus.c
chipset_bootblock_inc += $(src)/southbridge/nvidia/ck804/romstrap.inc
chipset_bootblock_lds += $(src)/southbridge/nvidia/ck804/romstrap.lds
bootblock-y += romstrap.ld
chipset_bootblock_inc += $(src)/southbridge/nvidia/ck804/romstrap.inc

View file

@ -90,7 +90,7 @@ static void nic_init(struct device *dev)
/* If that is invalid we will read that from romstrap. */
if (!eeprom_valid) {
unsigned long mac_pos;
mac_pos = 0xffffffd0; /* See romstrap.inc and romstrap.lds. */
mac_pos = 0xffffffd0; /* See romstrap.inc and romstrap.ld. */
mac_l = read32(mac_pos) + nic_index;
mac_h = read32(mac_pos + 4);
}

View file

@ -19,5 +19,6 @@ romstage-$(CONFIG_USBDEBUG) += enable_usbdebug.c
ramstage-$(CONFIG_USBDEBUG) += enable_usbdebug.c
smm-$(CONFIG_USBDEBUG) += enable_usbdebug.c
bootblock-y += romstrap.ld
chipset_bootblock_inc += $(src)/southbridge/nvidia/mcp55/romstrap.inc
chipset_bootblock_lds += $(src)/southbridge/nvidia/mcp55/romstrap.lds

View file

@ -161,7 +161,7 @@ static void nic_init(struct device *dev)
// if that is invalid we will read that from romstrap
if(!eeprom_valid) {
unsigned long mac_pos;
mac_pos = 0xffffffd0; // refer to romstrap.inc and romstrap.lds
mac_pos = 0xffffffd0; // refer to romstrap.inc and romstrap.ld
mac_l = read32(mac_pos) + nic_index; // overflow?
mac_h = read32(mac_pos + 4);

View file

@ -14,5 +14,6 @@ romstage-$(CONFIG_USBDEBUG) += enable_usbdebug.c
ramstage-$(CONFIG_USBDEBUG) += enable_usbdebug.c
smm-$(CONFIG_USBDEBUG) += enable_usbdebug.c
bootblock-y += romstrap.ld
chipset_bootblock_inc += $(src)/southbridge/sis/sis966/romstrap.inc
chipset_bootblock_lds += $(src)/southbridge/sis/sis966/romstrap.lds

View file

@ -8,5 +8,6 @@ ramstage-y += traf_ctrl.c
ramstage-y += error.c
ramstage-y += chrome.c
bootblock-y += romstrap.ld
chipset_bootblock_inc += $(src)/southbridge/via/k8t890/romstrap.inc
chipset_bootblock_lds += $(src)/southbridge/via/k8t890/romstrap.lds

View file

@ -66,7 +66,6 @@ INCLUDES += $(VB_INCLUDES)
VBOOT_STUB_ELF = $(obj)/vendorcode/google/chromeos/vbootstub.elf
VBOOT_STUB = $(VBOOT_STUB_ELF).rmod
VBOOT_STUB_DOTO = $(VBOOT_STUB_ELF:.elf=.o)
# Dependency for the vboot rmodules. Ordering matters.
VBOOT_STUB_DEPS += $(obj)/vendorcode/google/chromeos/vboot_wrapper.rmodules_$(ARCH-ROMSTAGE-y).o
@ -90,19 +89,16 @@ VBOOT_CFLAGS += $(patsubst -I%,-I$(top)/%,$(filter-out -include $(src)/include/k
VBOOT_CFLAGS += -DVBOOT_DEBUG
VBOOT_CFLAGS += $(rmodules_$(ARCH-ROMSTAGE-y)-c-ccopts)
$(VBOOT_STUB_DOTO): $(VBOOT_STUB_DEPS)
$(CC_rmodules_$(ARCH-ROMSTAGE-y)) $(CFLAGS_rmodules_$(ARCH-ROMSTAGE-y)) $(LDFLAGS) -nostdlib -r -o $@ $^
# Link the vbootstub module with a 64KiB-byte heap.
$(eval $(call rmodule_link,$(VBOOT_STUB_ELF), $(VBOOT_STUB_DOTO), 0x10000,$(ARCH-ROMSTAGE-y)))
$(eval $(call rmodule_link,$(VBOOT_STUB_ELF), $(VBOOT_STUB_DEPS), 0x10000,$(ARCH-ROMSTAGE-y)))
# Build vboot library without the default includes from coreboot proper.
$(VB_LIB):
@printf " MAKE $(subst $(obj)/,,$(@))\n"
$(Q)FIRMWARE_ARCH=$(VB_FIRMWARE_ARCH) \
CC="$(CC_romstage)" \
CFLAGS="$(VBOOT_CFLAGS)" \
make -C $(VB_SOURCE) \
CFLAGS="$(VBOOT_CFLAGS)" \
$(MAKE) -C $(VB_SOURCE) \
$(VBOOT_MAKEFLAGS) \
BUILD=$(top)/$(dir $(VB_LIB)) \
V=$(V) \
@ -115,8 +111,7 @@ VB_SOURCE := vboot_reference
INCLUDES += -I$(VB_SOURCE)/firmware/2lib/include
INCLUDES += -I$(VB_SOURCE)/firmware/include
verstage-c-ccopts += -D__PRE_RAM__ -D__VER_STAGE__
verstage-S-ccopts += -D__PRE_RAM__ -D__VER_STAGE__
verstage-generic-ccopts += -D__PRE_RAM__ -D__VER_STAGE__
ifeq ($(CONFIG_RETURN_FROM_VERSTAGE),y)
bootblock-y += verstub.c chromeos.c
@ -134,12 +129,12 @@ VBOOT_CFLAGS += $(verstage-c-ccopts)
VBOOT_CFLAGS += -include $(top)/src/include/kconfig.h -Wno-missing-prototypes
VBOOT_CFLAGS += -DVBOOT_DEBUG
$(VB2_LIB): $(obj)/config.h
$(VB2_LIB): $$(generic-deps)
@printf " MAKE $(subst $(obj)/,,$(@))\n"
$(Q)FIRMWARE_ARCH=$(VB_FIRMWARE_ARCH) \
CC="$(CC_verstage)" \
CFLAGS="$(VBOOT_CFLAGS)" VBOOT2="y" \
make -C $(VB_SOURCE) \
CFLAGS="$(VBOOT_CFLAGS)" VBOOT2="y" \
$(MAKE) -C $(VB_SOURCE) \
BUILD=$(top)/$(dir $(VB2_LIB)) \
V=$(V) \
fwlib2
@ -149,4 +144,4 @@ cbfs-files-y += $(call strip_quotes,$(CONFIG_CBFS_PREFIX))/verstage
fallback/verstage-file = $(VERSTAGE_ELF)
fallback/verstage-type = stage
fallback/verstage-compression = none
endif # CONFIG_VBOOT2_VERIFY_FIRMWARE
endif # CONFIG_VBOOT2_VERIFY_FIRMWARE