[PATCH v3 2/4] arm: decompressor: define a new zImage tag

From: Łukasz Stelmach
Date: Wed Sep 30 2020 - 14:39:40 EST


Add DCSZ tag which holds dynamic memory (stack, bss, malloc pool)
requirements of the decompressor code.

Signed-off-by: Łukasz Stelmach <l.stelmach@xxxxxxxxxxx>
---
arch/arm/boot/compressed/vmlinux.lds.S | 9 ++++++++-
arch/arm/include/asm/image.h | 3 +++
2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/compressed/vmlinux.lds.S b/arch/arm/boot/compressed/vmlinux.lds.S
index a6b151112ac5..3e7443b52f5b 100644
--- a/arch/arm/boot/compressed/vmlinux.lds.S
+++ b/arch/arm/boot/compressed/vmlinux.lds.S
@@ -43,6 +43,11 @@ SECTIONS
LONG(ZIMAGE_MAGIC(_kernel_bss_size))
LONG(ZIMAGE_MAGIC(TEXT_OFFSET))
LONG(ZIMAGE_MAGIC(MALLOC_SIZE))
+ LONG(ZIMAGE_MAGIC(3))
+ LONG(ARM_ZIMAGE_MAGIC4)
+ LONG(ZIMAGE_MAGIC((_end - __bss_start) +
+ (_stack_end - _stack_start) +
+ MALLOC_SIZE))
LONG(0)
_table_end = .;
}
@@ -117,10 +122,12 @@ SECTIONS
. = BSS_START;
__bss_start = .;
.bss : { *(.bss) }
+ . = ALIGN(8); /* the stack must be 64-bit aligned and adjoin bss */
_end = .;

- . = ALIGN(8); /* the stack must be 64-bit aligned */
+ _stack_start = .;
.stack : { *(.stack) }
+ _stack_end = .;

PROVIDE(__pecoff_data_size = ALIGN(512) - ADDR(.data));
PROVIDE(__pecoff_end = ALIGN(512));
diff --git a/arch/arm/include/asm/image.h b/arch/arm/include/asm/image.h
index 8150b9490e86..8be6dbc69fbb 100644
--- a/arch/arm/include/asm/image.h
+++ b/arch/arm/include/asm/image.h
@@ -15,6 +15,7 @@
#define ARM_ZIMAGE_MAGIC1 ZIMAGE_MAGIC(0x016f2818)
#define ARM_ZIMAGE_MAGIC2 (0x45454545)
#define ARM_ZIMAGE_MAGIC3 ZIMAGE_MAGIC(0x5a534c4b)
+#define ARM_ZIMAGE_MAGIC4 ZIMAGE_MAGIC(0x5a534344)

#ifndef __ASSEMBLY__

@@ -42,6 +43,8 @@ struct arm_zimage_tag {
__le32 text_offset;
__le32 malloc_size;
} krnl_size;
+#define ZIMAGE_TAG_ZIMAGE_MEM ARM_ZIMAGE_MAGIC4
+ __le32 zimage_mem;
} u;
};

--
2.26.2