[coreboot-gerrit] Patch set updated for coreboot: libpayload: Move base address, stack and heap size to Kconfig

Stefan Reinauer (stefan.reinauer@coreboot.org) gerrit at coreboot.org
Sun Mar 13 02:16:35 CET 2016


Stefan Reinauer (stefan.reinauer at coreboot.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14074

-gerrit

commit a285357ece8e20db651885669d29c3e37afc0413
Author: Stefan Reinauer <stefan.reinauer at coreboot.org>
Date:   Sat Mar 12 16:18:17 2016 -0800

    libpayload: Move base address, stack and heap size to Kconfig
    
    This will allow more payloads to use the standard linker script
    instead of implementing their own.
    
    Change-Id: Ie60120769829f427ceb722109d85859b61dbde31
    Signed-off-by: Stefan Reinauer <stefan.reinauer at coreboot.org>
---
 payloads/libpayload/Kconfig                        | 29 ++++++++++++++++++++++
 payloads/libpayload/arch/arm/libpayload.ldscript   | 11 +++-----
 payloads/libpayload/arch/arm64/libpayload.ldscript | 13 +++-------
 payloads/libpayload/arch/mips/libpayload.ldscript  | 10 +++-----
 payloads/libpayload/arch/x86/libpayload.ldscript   | 11 +++-----
 payloads/libpayload/bin/lpgcc                      |  4 +++
 6 files changed, 46 insertions(+), 32 deletions(-)

diff --git a/payloads/libpayload/Kconfig b/payloads/libpayload/Kconfig
index 3c579e6..be68859 100644
--- a/payloads/libpayload/Kconfig
+++ b/payloads/libpayload/Kconfig
@@ -119,6 +119,35 @@ config MULTIBOOT
 	depends on ARCH_X86
 	default y
 
+config HEAP_SIZE
+	int "Heap size"
+	default 131072
+	help
+	  This is the heap size (malloc'able size) available
+	  to the payload.
+
+	  If unsure, set to 131072 (128K)
+
+config STACK_SIZE
+	int "Stack size"
+	default 16384
+	help
+	  This is the stack size available to the payload.
+
+	  If unsure, set to 16384 (16K)
+
+config BASE_ADDRESS
+	hex "Base address"
+	default 0x04000000 if ARCH_ARM
+	default 0x80100000 if ARCH_ARM64
+	default 0x00000000 if ARCH_MIPS
+	default 0x00100000 if ARCH_X86
+	help
+	  This is the base address for the payload.
+
+	  If unsure, set to 0x00100000 on x86, 0x00000000 on MIPS,
+	  0x04000000 on ARM or 0x80100000 on ARM64.
+
 endmenu
 
 menu "Standard Libraries"
diff --git a/payloads/libpayload/arch/arm/libpayload.ldscript b/payloads/libpayload/arch/arm/libpayload.ldscript
index 5f65bd7..492bd0c 100644
--- a/payloads/libpayload/arch/arm/libpayload.ldscript
+++ b/payloads/libpayload/arch/arm/libpayload.ldscript
@@ -28,19 +28,14 @@
  * SUCH DAMAGE.
  */
 
-BASE_ADDRESS = 0x4000000;
-
 OUTPUT_FORMAT("elf32-littlearm","elf32-littlearm", "elf32-littlearm")
 OUTPUT_ARCH(arm)
 
 ENTRY(_entry)
 
-HEAP_SIZE = 2*64*1024;
-STACK_SIZE = 16384;
-
 SECTIONS
 {
-	. = BASE_ADDRESS;
+	. = CONFIG_LP_BASE_ADDRESS;
 
 	. = ALIGN(16);
 	_start = .;
@@ -74,12 +69,12 @@ SECTIONS
 
 		. = ALIGN(16);
 		_heap = .;
-		. += HEAP_SIZE;
+		. += CONFIG_LP_HEAP_SIZE;
 		. = ALIGN(16);
 		_eheap = .;
 
 		_estack = .;
-		. += STACK_SIZE;
+		. += CONFIG_LP_STACK_SIZE;
 		. = ALIGN(16);
 		_stack = .;
 	}
diff --git a/payloads/libpayload/arch/arm64/libpayload.ldscript b/payloads/libpayload/arch/arm64/libpayload.ldscript
index 1b4395f..0cb88cf 100644
--- a/payloads/libpayload/arch/arm64/libpayload.ldscript
+++ b/payloads/libpayload/arch/arm64/libpayload.ldscript
@@ -28,19 +28,14 @@
  * SUCH DAMAGE.
  */
 
-BASE_ADDRESS = 0x80100000;
-
 OUTPUT_FORMAT("elf64-littleaarch64","elf64-littleaarch64", "elf64-littleaarch64")
 OUTPUT_ARCH(arm64)
 
 ENTRY(_entry)
 
-HEAP_SIZE = 2*64*1024;
-STACK_SIZE = 16384;
-
 SECTIONS
 {
-	. = BASE_ADDRESS;
+	. = CONFIG_LP_BASE_ADDRESS;
 
 	. = ALIGN(16);
 	_start = .;
@@ -74,17 +69,17 @@ SECTIONS
 
 		. = ALIGN(16);
 		_heap = .;
-		. += HEAP_SIZE;
+		. += CONFIG_LP_HEAP_SIZE;
 		. = ALIGN(16);
 		_eheap = .;
 
 		_estack = .;
-		. += STACK_SIZE;
+		. += CONFIG_LP_STACK_SIZE;
 		. = ALIGN(16);
 		_stack = .;
 
 		_exc_estack = .;
-		. += STACK_SIZE;
+		. += CONFIG_LP_STACK_SIZE;
 		. = ALIGN(16);
 		_exc_stack = .;
 	}
diff --git a/payloads/libpayload/arch/mips/libpayload.ldscript b/payloads/libpayload/arch/mips/libpayload.ldscript
index 28a7412..351c225 100644
--- a/payloads/libpayload/arch/mips/libpayload.ldscript
+++ b/payloads/libpayload/arch/mips/libpayload.ldscript
@@ -20,15 +20,11 @@
 
 OUTPUT_ARCH(mips)
 
-BASE_ADDRESS = 0x00000000;
 ENTRY(_entry)
 
-HEAP_SIZE = 2*64*1024;
-STACK_SIZE = 16*1024;
-
 SECTIONS
 {
-	. = BASE_ADDRESS;
+	. = CONFIG_LP_BASE_ADDRESS;
 
 	. = ALIGN(16);
 	_start = .;
@@ -68,12 +64,12 @@ SECTIONS
 
 		. = ALIGN(16);
 		_heap = .;
-		. += HEAP_SIZE;
+		. += CONFIG_LP_HEAP_SIZE;
 		. = ALIGN(16);
 		_eheap = .;
 
 		_estack = .;
-		. += STACK_SIZE;
+		. += CONFIG_LP_STACK_SIZE;
 		. = ALIGN(16);
 		_stack = .;
 	}
diff --git a/payloads/libpayload/arch/x86/libpayload.ldscript b/payloads/libpayload/arch/x86/libpayload.ldscript
index 3e7d4cc..bcb2165 100644
--- a/payloads/libpayload/arch/x86/libpayload.ldscript
+++ b/payloads/libpayload/arch/x86/libpayload.ldscript
@@ -27,19 +27,14 @@
  * SUCH DAMAGE.
  */
 
-BASE_ADDRESS = 0x100000;
-
 OUTPUT_FORMAT(elf32-i386)
 OUTPUT_ARCH(i386)
 
 ENTRY(_entry)
 
-HEAP_SIZE = 2*64*1024;
-STACK_SIZE = 16384;
-
 SECTIONS
 {
-	. = BASE_ADDRESS;
+	. = CONFIG_LP_BASE_ADDRESS;
 
 	. = ALIGN(16);
 	_start = .;
@@ -73,12 +68,12 @@ SECTIONS
 
 		. = ALIGN(16);
 		_heap = .;
-		. += HEAP_SIZE;
+		. += CONFIG_LP_HEAP_SIZE;
 		. = ALIGN(16);
 		_eheap = .;
 
 		_estack = .;
-		. += STACK_SIZE;
+		. += CONFIG_LP_STACK_SIZE;
 		. = ALIGN(16);
 		_stack = .;
 	}
diff --git a/payloads/libpayload/bin/lpgcc b/payloads/libpayload/bin/lpgcc
index 0974d03..7511300 100755
--- a/payloads/libpayload/bin/lpgcc
+++ b/payloads/libpayload/bin/lpgcc
@@ -187,6 +187,10 @@ else
             _LDFLAGS+=" -Wl,--fix-cortex-a53-843419"
     fi
 
+    _LDFLAGS="$_LDFLAGS -Wl,--defsym=CONFIG_LP_BASE_ADDRESS=$CONFIG_LP_BASE_ADDRESS"
+    _LDFLAGS="$_LDFLAGS -Wl,--defsym=CONFIG_LP_HEAP_SIZE=$CONFIG_LP_HEAP_SIZE"
+    _LDFLAGS="$_LDFLAGS -Wl,--defsym=CONFIG_LP_STACK_SIZE=$CONFIG_LP_STACK_SIZE"
+
     if [ $DEBUGME -eq 1 ]; then
 	echo "$DEFAULT_CC $_LDFLAGS $HEAD_O $CMDLINE $_CFLAGS -lpayload $_LIBGCC"
     fi



More information about the coreboot-gerrit mailing list