[U-Boot] [RFC] [PATCH V2] arm: arm926ejs: use ELF relocations

Heiko Schocher hs at denx.de
Tue Oct 5 11:25:16 CEST 2010


Hello Albert,

Albert Aribaud wrote:
> HISTORY:
> 
> V1	Initial patch
> V2	Rebased on latest mainline master
> 
> This patch is *not* a submission for master!
> 
> It is a proof of concept of ELF relocations for ARM, hastily done
> in a day's work time for people on the list to try and to comment.
> All comments are welcome, as several suggestions have been made
> today on the list that I did not have time to incorporate, such as
> rewriting the elf table fixup code in C.

Following patch works on the tx25 with booting from nand:

remark !!!! :

--- a/arch/arm/cpu/arm926ejs/start.S
+++ b/arch/arm/cpu/arm926ejs/start.S
@@ -266,7 +266,7 @@ fixnext:
 	str	r1, [r0]
 	add	r2, r2, #8	/* each rel.dyn entry is 8 bytes */
 	cmp	r2, r3
-	ble	fixloop
+	bne	fixloop

Must be discussed/changed, because this fixes just a bug. For this board
my last entry in __rel_dyn_start is filled with 00000000, which results
in crashing code ...

here now the patch, based on actaul mainline code and your patch:

diff --git a/arch/arm/cpu/arm926ejs/start.S b/arch/arm/cpu/arm926ejs/start.S
index 5a7ae7e..cf3a59f 100644
--- a/arch/arm/cpu/arm926ejs/start.S
+++ b/arch/arm/cpu/arm926ejs/start.S
@@ -266,7 +266,7 @@ fixnext:
 	str	r1, [r0]
 	add	r2, r2, #8	/* each rel.dyn entry is 8 bytes */
 	cmp	r2, r3
-	ble	fixloop
+	bne	fixloop
 #endif
 #endif	/* #ifndef CONFIG_SKIP_RELOCATE_UBOOT */

@@ -297,8 +297,9 @@ clbss_l:str	r2, [r0]		/* clear loop...		    */
 	ldr     r0, _nand_boot_ofs
 	adr	r1, _start
 	add	pc, r0, r1
-_nand_boot_ofs
-	: .word nand_boot - _start
+
+_nand_boot_ofs:
+	.word nand_boot - _start
 #else
 	ldr	r0, _board_init_r_ofs
 	adr	r1, _start
diff --git a/board/karo/tx25/config.mk b/board/karo/tx25/config.mk
index 51ca1ab..8be6466 100644
--- a/board/karo/tx25/config.mk
+++ b/board/karo/tx25/config.mk
@@ -1,5 +1,5 @@
 ifdef CONFIG_NAND_SPL
 TEXT_BASE = 0x810c0000
 else
-TEXT_BASE = 0x81fc0000
+TEXT_BASE = 0x81200000
 endif
diff --git a/include/configs/tx25.h b/include/configs/tx25.h
index c798570..2be3699 100644
--- a/include/configs/tx25.h
+++ b/include/configs/tx25.h
@@ -41,7 +41,7 @@
 #define CONFIG_SYS_NAND_U_BOOT_OFFS	0x800
 #define CONFIG_SYS_NAND_U_BOOT_SIZE	0x30000

-#define CONFIG_SYS_NAND_U_BOOT_DST      (0x81fc0000)
+#define CONFIG_SYS_NAND_U_BOOT_DST      (0x81200000)
 #define CONFIG_SYS_NAND_U_BOOT_START    CONFIG_SYS_NAND_U_BOOT_DST

 #define CONFIG_SYS_NAND_PAGE_SIZE	2048
@@ -178,6 +178,7 @@

 /* additions for new relocation code, must added to all boards */
 #undef CONFIG_SYS_ARM_WITHOUT_RELOC /* This board is tested with relocation support */
+#define CONFIG_RELOC_FIXUP_WORKS
 #define CONFIG_SYS_SDRAM_BASE		PHYS_SDRAM_1
 #define CONFIG_SYS_INIT_SP_ADDR		(CONFIG_SYS_SDRAM_BASE + 0x1000 - /* Fix this */ \
 					CONFIG_SYS_GBL_DATA_SIZE)
diff --git a/nand_spl/board/karo/tx25/u-boot.lds b/nand_spl/board/karo/tx25/u-boot.lds
index c572557..36d716b 100644
--- a/nand_spl/board/karo/tx25/u-boot.lds
+++ b/nand_spl/board/karo/tx25/u-boot.lds
@@ -53,6 +53,14 @@ SECTIONS
 		*(.data.rel.ro)
 	}

+	. = ALIGN(4);
+	__rel_dyn_start = .;
+	.rel.dyn : { *(.rel.dyn) }
+	__rel_dyn_end = .;
+
+	__dynsym_start = .;
+	.dynsym : { *(.dynsym) }
+
 	__got_start = .;
 	. = ALIGN(4);
 	.got : { *(.got) }


-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany


More information about the U-Boot mailing list