public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v4 2/9] x86: Allow excluding reset vector code from u-boot
@ 2012-11-26  6:12 Simon Glass
  2012-11-26  6:12 ` [U-Boot] [PATCH v4 8/9] x86: Remove coreboot start16 code Simon Glass
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Simon Glass @ 2012-11-26  6:12 UTC (permalink / raw)
  To: u-boot

From: Gabe Black <gabeblack@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@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
---
Changes in v4:
- Use CONFIG_SYS_X86_RESET_VECTOR instead CONFIG_NO_RESET_CODE
- Add note about CONFIG_SYS_X86_RESET_VECTOR to README

Changes in v3:
- Fix incorrect repeated line in Makefile

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

 Makefile                   |    8 +++-----
 README                     |    4 ++++
 arch/x86/cpu/Makefile      |    5 +++--
 arch/x86/cpu/u-boot.lds    |    3 +++
 include/configs/coreboot.h |    2 ++
 include/configs/eNET.h     |    3 +++
 6 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index 1a17be9..dcd3a0c 100644
--- a/Makefile
+++ b/Makefile
@@ -230,10 +230,8 @@ endif
 # U-Boot objects....order is important (i.e. start must be first)
 
 OBJS  = $(CPUDIR)/start.o
-ifeq ($(CPU),x86)
-OBJS += $(CPUDIR)/start16.o
-OBJS += $(CPUDIR)/resetvec.o
-endif
+OBJS-$(CONFIG_SYS_X86_RESET_VECTOR) += $(CPUDIR)/start16.o
+OBJS-$(CONFIG_SYS_X86_RESET_VECTOR) += $(CPUDIR)/resetvec.o
 ifeq ($(CPU),ppc4xx)
 OBJS += $(CPUDIR)/resetvec.o
 endif
@@ -241,7 +239,7 @@ ifeq ($(CPU),mpc85xx)
 OBJS += $(CPUDIR)/resetvec.o
 endif
 
-OBJS := $(addprefix $(obj),$(OBJS))
+OBJS := $(addprefix $(obj),$(OBJS) $(OBJS-y))
 
 HAVE_VENDOR_COMMON_LIB = $(if $(wildcard board/$(VENDOR)/common/Makefile),y,n)
 
diff --git a/README b/README
index 2dc0984..8cb7d07 100644
--- a/README
+++ b/README
@@ -3621,6 +3621,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.
 
+- CONFIG_SYS_X86_RESET_VECTOR
+		If defined, the x86 reset vector code is included. When
+		running from Coreboot this is not needed.
+
 Freescale QE/FMAN Firmware Support:
 -----------------------------------
 
diff --git a/arch/x86/cpu/Makefile b/arch/x86/cpu/Makefile
index 7f1fc18..b0c350c 100644
--- a/arch/x86/cpu/Makefile
+++ b/arch/x86/cpu/Makefile
@@ -28,12 +28,13 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(CPU).o
 
-START	= start.o start16.o resetvec.o
+START-y	= start.o
+START-$(CONFIG_SYS_X86_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))
-START	:= $(addprefix $(obj),$(START))
+START	:= $(addprefix $(obj),$(START-y))
 
 all:	$(obj).depend $(START) $(LIB)
 
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
 }
diff --git a/include/configs/coreboot.h b/include/configs/coreboot.h
index cc95e2b..699c65f 100644
--- a/include/configs/coreboot.h
+++ b/include/configs/coreboot.h
@@ -38,6 +38,8 @@
 #undef CONFIG_SHOW_BOOT_PROGRESS
 #define CONFIG_LAST_STAGE_INIT
 
+/* Define this for now, will be removed in a later patch */
+#define CONFIG_SYS_X86_RESET_VECTOR
 
 /*-----------------------------------------------------------------------
  * Watchdog Configuration
diff --git a/include/configs/eNET.h b/include/configs/eNET.h
index 4b1c219..bf8ba19 100644
--- a/include/configs/eNET.h
+++ b/include/configs/eNET.h
@@ -38,6 +38,9 @@
 #define CONFIG_SHOW_BOOT_PROGRESS
 #define CONFIG_LAST_STAGE_INIT
 
+/* Not running from Coreboot, so we need the reset vector code */
+#define CONFIG_SYS_X86_RESET_VECTOR
+
 /*-----------------------------------------------------------------------
  * Watchdog Configuration
  * NOTE: If CONFIG_HW_WATCHDOG is NOT defined, the watchdog jumper on the
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-11-26 19:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-26  6:12 [U-Boot] [PATCH v4 2/9] x86: Allow excluding reset vector code from u-boot Simon Glass
2012-11-26  6:12 ` [U-Boot] [PATCH v4 8/9] x86: Remove coreboot start16 code Simon Glass
2012-11-26  6:12 ` [U-Boot] [PATCH v4 9/9] x86: coreboot: Enable LPC TPM Simon Glass
2012-11-26 19:34   ` Marek Vasut
2012-11-26  6:53 ` [U-Boot] [PATCH v4 2/9] x86: Allow excluding reset vector code from u-boot Wolfgang Denk
2012-11-26  7:10   ` Simon Glass
2012-11-26  9:31     ` Wolfgang Denk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox