[U-Boot] [PATCH 3/4] x86: Force the lib_sysinfo structure to be in the .data section

Gabe Black gabeblack at chromium.org
Wed Nov 30 07:07:54 CET 2011


Otherwise it ends up in the .bss section. U-boot assumes that it doesn't
need to copy it over during relocation, and instead fills that whole
section with zeroes. If we really were booting from ROM that would be
appropriate, but we need some information from the coreboot tables (memory
size) before then and have to fill that structure before relocation. We
skirt u-boot's assumption by putting this in .data where it assumes there
is still read only but non-zero data.

Signed-off-by: Gabe Black <gabeblack at chromium.org>
---
 arch/x86/cpu/coreboot/sysinfo.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/arch/x86/cpu/coreboot/sysinfo.c b/arch/x86/cpu/coreboot/sysinfo.c
index 464f8a1..e74fe0a 100644
--- a/arch/x86/cpu/coreboot/sysinfo.c
+++ b/arch/x86/cpu/coreboot/sysinfo.c
@@ -30,4 +30,10 @@
 
 #include <asm/ic/coreboot/sysinfo.h>
 
-struct sysinfo_t lib_sysinfo;
+/*
+ * This needs to be in the .data section so that it's copied over during
+ * relocation. By default it's put in the .bss section which is simply filled
+ * with zeroes when transitioning from "ROM", which is really RAM, to other
+ * RAM.
+ */
+struct sysinfo_t lib_sysinfo __attribute__((section(".data")));
-- 
1.7.3.1



More information about the U-Boot mailing list