From patchwork Sun Apr 22 15:23:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [U-Boot,2/3] init_func: Add x86 support Date: Sun, 22 Apr 2012 05:23:07 -0000 From: Graeme Russ X-Patchwork-Id: 154287 Message-Id: <1335108188-21875-3-git-send-email-graeme.russ@gmail.com> To: u-boot@lists.denx.de Signed-off-by: Graeme Russ --- 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 +#include #include #include #include @@ -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) {