Re: [PATCH 3/5] arm: decompressor: define a new zImage tag

From: Russell King - ARM Linux admin
Date: Mon Jun 01 2020 - 10:55:24 EST


On Mon, Jun 01, 2020 at 04:27:52PM +0200, Åukasz Stelmach wrote:
> Add DCSZ tag which holds dynamic memory (stack, bss, malloc pool)
> requirements of the decompressor code.

Why do we need to know the stack and BSS size, when the userspace
kexec tool doesn't need to know this to perform the same function.

>
> Signed-off-by: Åukasz Stelmach <l.stelmach@xxxxxxxxxxx>
> ---
> arch/arm/boot/compressed/vmlinux.lds.S | 9 ++++++++-
> arch/arm/include/asm/image.h | 13 +++++++++++++
> 2 files changed, 21 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/boot/compressed/vmlinux.lds.S b/arch/arm/boot/compressed/vmlinux.lds.S
> index 308e9cd6a897..dcfdb3209c90 100644
> --- a/arch/arm/boot/compressed/vmlinux.lds.S
> +++ b/arch/arm/boot/compressed/vmlinux.lds.S
> @@ -39,6 +39,11 @@ SECTIONS
> LONG(ARM_ZIMAGE_MAGIC3)
> LONG(ZIMAGE_MAGIC(__piggy_size_addr - _start))
> LONG(ZIMAGE_MAGIC(_kernel_bss_size))
> + LONG(ZIMAGE_MAGIC(5))
> + LONG(ARM_ZIMAGE_MAGIC4)
> + LONG(ZIMAGE_MAGIC(_end - __bss_start))
> + LONG(ZIMAGE_MAGIC(_stack_end - _stack_start))
> + LONG(ZIMAGE_MAGIC(_malloc_size))
> LONG(0)
> _table_end = .;
> }
> @@ -108,10 +113,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 d5c18a0f6a34..624438740f23 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__
>
> @@ -43,6 +44,18 @@ struct arm_zimage_tag {
> } u;
> };
>
> +struct arm_zimage_tag_dc {
> + struct tag_header hdr;
> + union {
> +#define ZIMAGE_TAG_DECOMP_SIZE ARM_ZIMAGE_MAGIC4
> + struct zimage_decomp_size {
> + __le32 bss_size;
> + __le32 stack_size;
> + __le32 malloc_size;
> + } decomp_size;
> + } u;
> +};
> +
> #endif /* __ASSEMBLY__ */
>
> #endif /* __ASM_IMAGE_H */
> --
> 2.26.2
>
>

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC for 0.8m (est. 1762m) line in suburbia: sync at 13.1Mbps down 424kbps up