[U-Boot] [PATCH v2 07/19] WIP: powerpc: ppc4xx: Somehow BSS is not cleared in RAMBOOT case

Simon Glass sjg at chromium.org
Sat Feb 7 19:51:40 CET 2015


From: Stefan Roese <sr at denx.de>

(NOT TO APPLY)

I'm really not sure why this doesn't work in the RAMBOOT case. But BSS
is not cleared and because of this booting crashed / hangs at some
stage later. Something with the GOT calculation / handling is incorrect.

To get this going for now, just clear the BSS again in the C code.

Signed-off-by: Stefan Roese <sr at denx.de>
Signed-off-by: Simon Glass <sjg at chromium.org>
---

Changes in v2: None

 arch/powerpc/lib/board.c | 3 +++
 common/board_r.c         | 8 +++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c
index 91645d3..47654fa 100644
--- a/arch/powerpc/lib/board.c
+++ b/arch/powerpc/lib/board.c
@@ -108,6 +108,7 @@ DECLARE_GLOBAL_DATA_PTR;
 extern ulong __init_end;
 extern ulong __bss_end;
 ulong monitor_flash_len;
+extern ulong __bss_start;
 
 #if defined(CONFIG_CMD_BEDBUG)
 #include <bedbug/type.h>
@@ -590,6 +591,8 @@ void board_init_r(gd_t *id, ulong dest_addr)
 	/* The Malloc area is immediately below the monitor copy in DRAM */
 	malloc_start = dest_addr - TOTAL_MALLOC_LEN;
 
+	memset(&__bss_start, 0, &__bss_end - &__bss_start);
+
 #if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
 	/*
 	 * The gd->arch.cpu pointer is set to an address in flash before
diff --git a/common/board_r.c b/common/board_r.c
index 68a9448..6900374 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -1,4 +1,4 @@
-/*
+	/*
  * Copyright (c) 2011 The Chromium OS Authors.
  * (C) Copyright 2002-2006
  * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
@@ -870,6 +870,12 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
 	gd = new_gd;
 #endif
 
+#ifdef CONFIG_GLACIER
+	ulong bss_start = (ulong)&__bss_start;
+	ulong bss_end = (ulong)&__bss_end;
+	memset((void *)bss_start, 0, bss_end - bss_start);
+#endif
+
 #ifdef CONFIG_NEEDS_MANUAL_RELOC
 	for (i = 0; i < ARRAY_SIZE(init_sequence_r); i++)
 		init_sequence_r[i] += gd->reloc_off;
-- 
2.2.0.rc0.207.ga3a616c



More information about the U-Boot mailing list