[U-Boot] [PATCH v3 7/9] sandbox: Support pre-relocation malloc()

Simon Glass sjg at chromium.org
Fri Jul 11 06:23:31 CEST 2014


Set up and zero global data before board_init_f() is called so that we can
remove the need for CONFIG_SYS_GENERIC_GLOBAL_DATA.

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

Changes in v3: None
Changes in v2: None

 README                   | 4 ++--
 arch/sandbox/cpu/start.c | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/README b/README
index 73abbf0..70beeeb 100644
--- a/README
+++ b/README
@@ -3749,8 +3749,8 @@ 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.
+		Pre-relocation malloc() is only supported on ARM and sandbox
+		at present but is fairly easy to enable for other archs.
 
 - CONFIG_SYS_BOOTM_LEN:
 		Normally compressed uImages are limited to an
diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c
index 5289291..b3d7051 100644
--- a/arch/sandbox/cpu/start.c
+++ b/arch/sandbox/cpu/start.c
@@ -240,6 +240,9 @@ int main(int argc, char *argv[])
 
 	memset(&data, '\0', sizeof(data));
 	gd = &data;
+#ifdef CONFIG_SYS_MALLOC_F_LEN
+	gd->malloc_base = CONFIG_MALLOC_F_ADDR;
+#endif
 
 	/* Do pre- and post-relocation init */
 	board_init_f(0);
-- 
2.0.0.526.g5318336



More information about the U-Boot mailing list