[U-Boot] [PATCH v3 2/9] x86: Allow excluding reset vector code from u-boot

Simon Glass sjg at chromium.org
Tue Nov 6 22:46:18 CET 2012


From: Gabe Black <gabeblack at chromium.org>

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 at chromium.org>
Signed-off-by: Simon Glass <sjg at chromium.org>
---
Changes in v3:
- Fix incorrect repeated line in Makefile

Changes in v2:
- Put CONFIG_NO_RESET_CODE into Makefile instead of source files

 Makefile                |    6 ++++--
 arch/x86/cpu/Makefile   |    5 ++++-
 arch/x86/cpu/u-boot.lds |    3 +++
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 9dc89f9..e963bf2 100644
--- a/Makefile
+++ b/Makefile
@@ -231,8 +231,10 @@ endif
 
 OBJS  = $(CPUDIR)/start.o
 ifeq ($(CPU),x86)
-OBJS += $(CPUDIR)/start16.o
-OBJS += $(CPUDIR)/resetvec.o
+	ifneq ($(CONFIG_NO_RESET_CODE),y)
+		OBJS += $(CPUDIR)/start16.o
+		OBJS += $(CPUDIR)/resetvec.o
+	endif
 endif
 ifeq ($(CPU),ppc4xx)
 OBJS += $(CPUDIR)/resetvec.o
diff --git a/arch/x86/cpu/Makefile b/arch/x86/cpu/Makefile
index 7f1fc18..1eb70a7 100644
--- a/arch/x86/cpu/Makefile
+++ b/arch/x86/cpu/Makefile
@@ -28,7 +28,10 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(CPU).o
 
-START	= start.o start16.o resetvec.o
+START	= start.o
+ifneq ($(CONFIG_NO_RESET_CODE),y)
+START	+= resetvec.o start16.o
+endif
 COBJS	= interrupts.o cpu.o
 
 SRCS	:= $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
diff --git a/arch/x86/cpu/u-boot.lds b/arch/x86/cpu/u-boot.lds
index a1ecefa..e20bb02 100644
--- a/arch/x86/cpu/u-boot.lds
+++ b/arch/x86/cpu/u-boot.lds
@@ -86,6 +86,8 @@ SECTIONS
 	__bios_start = LOADADDR(.bios);
 	__bios_size = SIZEOF(.bios);
 
+#ifndef CONFIG_NO_RESET_CODE
+
 	/*
 	 * 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)); }
+#endif
 }
-- 
1.7.7.3



More information about the U-Boot mailing list