Make board_init_f under nand_boot.c a weak function
PATCH v3 2/3 Make board_init_f under nand_boot.c a weak function
Enable board_init_f to be overridden with a board specific function.
---
Changes since V2:
* Fix the checkpatch warnings
nand_spl/nand_boot.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-)
nand_spl/nand_boot.c +5 -3
@@ -222,11 +222,13 @@ static int nand_load(struct mtd_info *mtd, unsigned int offs, }#if defined(CONFIG_ARM ) && !defined(CONFIG_SYS_ARM_WITHOUT_RELOC ) -void board_init_f (ulong bootflag) +void __board_init_f (ulong bootflag) { -relocate_code (CONFIG_SYS_TEXT_BASE -TOTAL_MALLOC_LEN ,NULL , -CONFIG_SYS_TEXT_BASE ); +relocate_code (CONFIG_SYS_TEXT_BASE -TOTAL_MALLOC_LEN ,NULL , +CONFIG_SYS_TEXT_BASE ); } +void board_init_f (ulong bootflag)__attribute__((weak, +alias ("__board_init_f" )));#endif /*
Signature · 1 line
1.7.0.4
PATCH v3 2/3 Make board_init_f under nand_boot.c a weak function
Quoted 23 lines · On Tue, 26 Oct 2010 23:27:44 +0530 Sughosh Ganu <[email protected]> wrote:
Enable
board_init_fto be overridden with a board specific function.Signed-off-by Sughosh Ganu <[email protected]>---
Changes since V2:
* Fix the checkpatch warningsnand_spl/nand_boot.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-)nand_spl/nand_boot.c +1
-1@@ -222,11 +222,13 @@ static int nand_load(struct mtd_info *mtd, unsigned int offs, }#if defined(CONFIG_ARM ) && !defined(CONFIG_SYS_ARM_WITHOUT_RELOC ) -void board_init_f (ulong bootflag) +void __board_init_f (ulong bootflag) {
nand_spl/nand_boot.c static int nand_load(struct mtd_info *mtd, unsigned int offs, · line 234
Quoted 10 lines
nand_spl/nand_boot.c +4
-2-relocate_code (CONFIG_SYS_TEXT_BASE -TOTAL_MALLOC_LEN ,NULL , - CONFIG_SYS_TEXT_BASE); +relocate_code (CONFIG_SYS_TEXT_BASE -TOTAL_MALLOC_LEN ,NULL , + CONFIG_SYS_TEXT_BASE); } +void board_init_f (ulong bootflag)__attribute__((weak, +alias ("__board_init_f" )));#endif /*
ACK for now, but given space constraints we probably don't want to carry around __board_init_f just to have it be overridden (will an overridden weak alias allow the function to be optimized away by the linker if function-sections/gc-sections is used?)
Eventually all boards should just provide their own board_init_f, which could just consist of a call to a common board init helper function. Or possibly a preprocessor define could be used to indicate that the common function should be used.
-Scott
PATCH v3 2/3 Make board_init_f under nand_boot.c a weak function
hi Scott,
Quoted 17 lines · Scott Wood
Quoted 14 lines · On Tue, 26 Oct 2010 23:27:44 +0530 Sughosh Ganu <[email protected]> wrote:
#if
defined(CONFIG_ARM)&& !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)nand_spl/nand_boot.c +5
-3-void board_init_f (ulong bootflag) +void __board_init_f (ulong bootflag) { -relocate_code (CONFIG_SYS_TEXT_BASE -TOTAL_MALLOC_LEN ,NULL , -CONFIG_SYS_TEXT_BASE ); +relocate_code (CONFIG_SYS_TEXT_BASE -TOTAL_MALLOC_LEN ,NULL , +CONFIG_SYS_TEXT_BASE ); } +void board_init_f (ulong bootflag)__attribute__((weak, +alias ("__board_init_f" )));#endif
Quoted 6 lines
Quoted 1 line
/*
Eventually all boards should just provide their own
board_init_f, which could just consist of a call to a common board init helper function. Or possibly a preprocessor define could be used to indicate that the common function should be used.
I had prososed that in my previous mail. I see that smdk6400 is the only arm board using this. I think we can make this change to move the board_init_f to the respective board directory right away. The change should not impact any other boards. If fine with you, i will respin my patch accordingly.
-sughosh