[PATCH v2 1/5] arm: decompressor: set malloc pool size for the decompressor
From: Åukasz Stelmach
Date: Tue Jun 02 2020 - 12:17:44 EST
Move the definition of malloc pool size of the decompressor to
a single place. This value will be exposed later for kexec_file loader.
Signed-off-by: Åukasz Stelmach <l.stelmach@xxxxxxxxxxx>
---
arch/arm/boot/compressed/Makefile | 7 +++++--
arch/arm/boot/compressed/head.S | 6 ++++--
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index 9c11e7490292..c4195651e371 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -7,7 +7,9 @@
OBJS =
-AFLAGS_head.o += -DTEXT_OFFSET=$(TEXT_OFFSET)
+MALLOC_SIZE =0x10000
+
+AFLAGS_head.o += -DTEXT_OFFSET=$(TEXT_OFFSET) -DMALLOC_SIZE=$(MALLOC_SIZE)
HEAD = head.o
OBJS += misc.o decompress.o
ifeq ($(CONFIG_DEBUG_UNCOMPRESS),y)
@@ -68,7 +70,8 @@ ZTEXTADDR := 0
ZBSSADDR := ALIGN(8)
endif
-CPPFLAGS_vmlinux.lds := -DTEXT_START="$(ZTEXTADDR)" -DBSS_START="$(ZBSSADDR)"
+CPPFLAGS_vmlinux.lds := -DTEXT_START="$(ZTEXTADDR)" -DBSS_START="$(ZBSSADDR)" \
+ -DMALLOC_SIZE="$(MALLOC_SIZE)"
compress-$(CONFIG_KERNEL_GZIP) = gzip
compress-$(CONFIG_KERNEL_LZO) = lzo
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index e8e1c866e413..55758264e776 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -309,7 +309,8 @@ restart: adr r0, LC0
#ifndef CONFIG_ZBOOT_ROM
/* malloc space is above the relocated stack (64k max) */
add sp, sp, r0
- add r10, sp, #0x10000
+ mov r10, #MALLOC_SIZE
+ add r10, r10, sp
#else
/*
* With ZBOOT_ROM the bss/stack is non relocatable,
@@ -623,7 +624,8 @@ not_relocated: mov r0, #0
*/
mov r0, r4
mov r1, sp @ malloc space above stack
- add r2, sp, #0x10000 @ 64k max
+ mov r2, #MALLOC_SIZE @ 64k max
+ add r2, r2, sp
mov r3, r7
bl decompress_kernel
--
2.26.2