[U-Boot] [PATCH v2 5/9] arm: Support pre-relocation malloc()

Simon Glass sjg at chromium.org
Tue Jul 8 01:19:24 CEST 2014


Add support for re-relocation malloc() in arm's start-up code.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

Changes in v2: None

 README              | 3 +++
 arch/arm/lib/crt0.S | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/README b/README
index 7450750..46f8f3c 100644
--- a/README
+++ b/README
@@ -3729,6 +3729,9 @@ Configuration Settings:
 		The memory will be freed (or in fact just forgotton) when
 		U-Boot relocates itself.
 
+		Pre-relocation malloc() is only supported on ARM at present
+		but is fairly easy to enable for other archs.
+
 - CONFIG_SYS_BOOTM_LEN:
 		Normally compressed uImages are limited to an
 		uncompressed size of 8 MBytes. If this is not enough,
diff --git a/arch/arm/lib/crt0.S b/arch/arm/lib/crt0.S
index bbf3e41..9e81cd9 100644
--- a/arch/arm/lib/crt0.S
+++ b/arch/arm/lib/crt0.S
@@ -77,6 +77,10 @@ clr_gd:	cmp	r1, r2			/* while not at end of BSS */
 	strlo	r0, [r1]		/* clear 32-bit BSS word */
 	addlo	r1, r1, #4		/* move to next */
 	blo	clr_gd
+#if defined(CONFIG_SYS_MALLOC_F_LEN) && !defined(CONFIG_SPL_BUILD)
+	sub	sp, sp, #CONFIG_SYS_MALLOC_F_LEN
+	str	sp, [r9, #GD_MALLOC_BASE]
+#endif
 	mov	r0, #0
 	bl	board_init_f
 
-- 
2.0.0.526.g5318336



More information about the U-Boot mailing list