[U-Boot] [PATCH 2/3] init_func: Add x86 support

Graeme Russ graeme.russ at gmail.com
Sun Apr 22 17:23:07 CEST 2012


Signed-off-by: Graeme Russ <graeme.russ at gmail.com>
---
 arch/x86/cpu/u-boot.lds |   23 +++++++++++++++++++++++
 arch/x86/lib/board.c    |   10 +++-------
 2 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/arch/x86/cpu/u-boot.lds b/arch/x86/cpu/u-boot.lds
index fe28030..b88fd57 100644
--- a/arch/x86/cpu/u-boot.lds
+++ b/arch/x86/cpu/u-boot.lds
@@ -28,6 +28,27 @@ ENTRY(_start)
 
 SECTIONS
 {
+#ifdef MAKE_INIT_LDS
+	.initfuncs : { KEEP(*(.initfuncs*)) }
+
+	/DISCARD/ : { *(.text*) }
+	/DISCARD/ : { *(.debug*) }
+	/DISCARD/ : { *(.u_boot_cmd*) }
+	/DISCARD/ : { *(.rodata*) }
+	/DISCARD/ : { *(.data*) }
+	/DISCARD/ : { *(.dynsym*) }
+	/DISCARD/ : { *(.hash*) }
+	/DISCARD/ : { *(.bss*) }
+	/DISCARD/ : { *(.bss) }
+	/DISCARD/ : { *(.rel.dyn*) }
+	/DISCARD/ : { *(.rel.dyn) }
+	/DISCARD/ : { *(.dynstr*) }
+	/DISCARD/ : { *(.dynamic*) }
+	/DISCARD/ : { *(.plt*) }
+	/DISCARD/ : { *(.interp*) }
+	/DISCARD/ : { *(.gnu*) }
+	/DISCARD/ : { *(.comment*) }
+#else
 	. = CONFIG_SYS_TEXT_BASE;	/* Location of bootcode in flash */
 	__text_start = .;
 	.text  : { *(.text*); }
@@ -72,6 +93,7 @@ SECTIONS
 	/DISCARD/ : { *(.plt*) }
 	/DISCARD/ : { *(.interp*) }
 	/DISCARD/ : { *(.gnu*) }
+	/DISCARD/ : { *(.initfuncs*) }
 
 	/* 16bit realmode trampoline code */
 	.realmode REALMODE_BASE : AT ( LOADADDR(.rel.dyn) + SIZEOF(.rel.dyn) ) { KEEP(*(.realmode)) }
@@ -94,4 +116,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/arch/x86/lib/board.c b/arch/x86/lib/board.c
index 5f0b62c..5789581 100644
--- a/arch/x86/lib/board.c
+++ b/arch/x86/lib/board.c
@@ -32,6 +32,7 @@
  */
 
 #include <common.h>
+#include <init_func.h>
 #include <watchdog.h>
 #include <stdio_dev.h>
 #include <asm/u-boot-x86.h>
@@ -77,13 +78,7 @@
  *      - All remaining initialisation
  */
 
-/*
- * The requirements for any new initalization function is simple: it is
- * a function with no parameters which returns an integer return code,
- * where 0 means "continue" and != 0 means "fatal error, hang the system"
- */
-typedef int (init_fnc_t) (void);
-
+#ifndef CONFIG_INIT_FUNC
 /*
  * init_sequence_f is the list of init functions which are run when U-Boot
  * is executing from Flash with a limited 'C' environment. The following
@@ -206,6 +201,7 @@ init_fnc_t *init_sequence_r[] = {
 #endif
 	NULL,
 };
+#endif
 
 static void do_init_loop(init_fnc_t **init_fnc_ptr)
 {
-- 
1.7.7.6



More information about the U-Boot mailing list