]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
x86: Allow excluding reset vector code from u-boot
authorGabe Black <gabeblack@chromium.org>
Tue, 27 Nov 2012 21:08:06 +0000 (21:08 +0000)
committerSimon Glass <sjg@chromium.org>
Wed, 28 Nov 2012 19:40:03 +0000 (11:40 -0800)
When running from coreboot we don't want this code.

This version works by ifdef-ing out all of the code that would go
into those sections and all the code that refers to it. The sections are
then empty, and the linker will either leave them empty for the loader
to ignore or remove them entirely.

Signed-off-by: Gabe Black <gabeblack@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
Makefile
README
arch/x86/cpu/Makefile
arch/x86/cpu/u-boot.lds

index c01afc9f6f964500b30e3697af4563cfbb56ce49..19ac8f5b8add59b2a08ffadc7f7f2429b63504d7 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -231,8 +231,8 @@ endif
 
 OBJS  = $(CPUDIR)/start.o
 ifeq ($(CPU),x86)
 
 OBJS  = $(CPUDIR)/start.o
 ifeq ($(CPU),x86)
-OBJS += $(CPUDIR)/start16.o
-OBJS += $(CPUDIR)/resetvec.o
+RESET_OBJS-$(CONFIG_X86_NO_RESET_VECTOR) += $(CPUDIR)/start16.o
+RESET_OBJS-$(CONFIG_X86_NO_RESET_VECTOR) += $(CPUDIR)/resetvec.o
 endif
 ifeq ($(CPU),ppc4xx)
 OBJS += $(CPUDIR)/resetvec.o
 endif
 ifeq ($(CPU),ppc4xx)
 OBJS += $(CPUDIR)/resetvec.o
@@ -241,7 +241,7 @@ ifeq ($(CPU),mpc85xx)
 OBJS += $(CPUDIR)/resetvec.o
 endif
 
 OBJS += $(CPUDIR)/resetvec.o
 endif
 
-OBJS := $(addprefix $(obj),$(OBJS))
+OBJS := $(addprefix $(obj),$(OBJS) $(RESET_OBJS-))
 
 HAVE_VENDOR_COMMON_LIB = $(if $(wildcard board/$(VENDOR)/common/Makefile),y,n)
 
 
 HAVE_VENDOR_COMMON_LIB = $(if $(wildcard board/$(VENDOR)/common/Makefile),y,n)
 
diff --git a/README b/README
index 67ff03a1207facee92719d4f6035d81fa9924b35..b9a36856d923d985cb159f91263f171eb56bf24f 100644 (file)
--- a/README
+++ b/README
@@ -3664,6 +3664,10 @@ Low Level (hardware related) configuration options:
                be used if available. These functions may be faster under some
                conditions but may increase the binary size.
 
                be used if available. These functions may be faster under some
                conditions but may increase the binary size.
 
+- CONFIG_X86_NO_RESET_VECTOR
+               If defined, the x86 reset vector code is excluded. You will need
+               to do this when U-Boot is running from Coreboot.
+
 Freescale QE/FMAN Firmware Support:
 -----------------------------------
 
 Freescale QE/FMAN Firmware Support:
 -----------------------------------
 
index 7f1fc188cb796b1c5a13b87f098e49b9edea21b8..be27dd9e2b56332300495a5763a40d96c9d98eb1 100644 (file)
@@ -28,12 +28,13 @@ include $(TOPDIR)/config.mk
 
 LIB    = $(obj)lib$(CPU).o
 
 
 LIB    = $(obj)lib$(CPU).o
 
-START  = start.o start16.o resetvec.o
+START-y        = start.o
+RESET_OBJS-$(CONFIG_X86_NO_RESET_VECTOR) += resetvec.o start16.o
 COBJS  = interrupts.o cpu.o
 
 SRCS   := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(SOBJS) $(COBJS))
 COBJS  = interrupts.o cpu.o
 
 SRCS   := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(SOBJS) $(COBJS))
-START  := $(addprefix $(obj),$(START))
+START  := $(addprefix $(obj),$(START-y) $(RESET_OBJS-))
 
 all:   $(obj).depend $(START) $(LIB)
 
 
 all:   $(obj).depend $(START) $(LIB)
 
index a1ecefafc64326bce747cfab1138c545651a35a8..0c6f0e31d8365309f0c6e19bb5cb04a9a423fdee 100644 (file)
@@ -86,6 +86,8 @@ SECTIONS
        __bios_start = LOADADDR(.bios);
        __bios_size = SIZEOF(.bios);
 
        __bios_start = LOADADDR(.bios);
        __bios_size = SIZEOF(.bios);
 
+#ifndef CONFIG_X86_NO_RESET_VECTOR
+
        /*
         * The following expressions place the 16-bit Real-Mode code and
         * Reset Vector at the end of the Flash ROM
        /*
         * The following expressions place the 16-bit Real-Mode code and
         * Reset Vector at the end of the Flash ROM
@@ -95,4 +97,5 @@ SECTIONS
 
        . = RESET_VEC_LOC;
        .resetvec : AT (CONFIG_SYS_TEXT_BASE + (CONFIG_SYS_MONITOR_LEN - RESET_SEG_SIZE + RESET_VEC_LOC)) { KEEP(*(.resetvec)); }
 
        . = RESET_VEC_LOC;
        .resetvec : AT (CONFIG_SYS_TEXT_BASE + (CONFIG_SYS_MONITOR_LEN - RESET_SEG_SIZE + RESET_VEC_LOC)) { KEEP(*(.resetvec)); }
+#endif
 }
 }