summaryrefslogtreecommitdiff
path: root/arch/s390/boot/compressed/misc.c
diff options
context:
space:
mode:
authorVasily Gorbik <gor@linux.ibm.com>2018-07-19 16:51:25 +0200
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2018-10-09 11:21:02 +0200
commit369f91c374514f9491d52fec12f7ee9ef6d44b23 (patch)
tree5a505c3f47a36b8e71247278c9f95d844764d5e3 /arch/s390/boot/compressed/misc.c
parent8f75582a2fb6e2c5afc5252b6d6932f61a79c939 (diff)
s390/decompressor: rework uncompressed image info collection
The kernel decompressor has to know several bits of information about uncompressed image. Currently this info is collected by running "nm" on uncompressed vmlinux + "sed" and producing sizes.h file. This method worked well, but it has several disadvantages. Obscure symbols name pattern matching is fragile. Adding new values makes pattern even longer. Logic is spread across code and make file. Limited ability to adjust symbols values (currently magic lma value of 0x100000 is always subtracted). Apart from that same pieces of information (and more) would be needed for early memory detection and features like KASLR outside of boot/compressed/ folder where sizes.h is generated. To overcome limitations new "struct vmlinux_info" has been introduced to include values needed for the decompressor and the rest of the boot code. The only static instance of vmlinux_info is produced during vmlinux link step by filling in struct fields by the linker (like it is done with input_data in boot/compressed/vmlinux.scr.lds.S). This way individual values could be adjusted with all the knowledge linker has and arithmetic it supports. Later .vmlinux.info section (which contains struct vmlinux_info) is transplanted into the decompressor image and dropped from uncompressed image altogether. While doing that replace "compressed/vmlinux.scr.lds.S" linker script (whose purpose is to rename .data section in piggy.o to .rodata.compressed) with plain objcopy command. And simplify decompressor's linker script. Reviewed-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/boot/compressed/misc.c')
-rw-r--r--arch/s390/boot/compressed/misc.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/arch/s390/boot/compressed/misc.c b/arch/s390/boot/compressed/misc.c
index 321f6151ded9..8b35af625aff 100644
--- a/arch/s390/boot/compressed/misc.c
+++ b/arch/s390/boot/compressed/misc.c
@@ -11,7 +11,6 @@
#include <asm/page.h>
#include <asm/sclp.h>
#include <asm/ipl.h>
-#include "sizes.h"
#include "decompressor.h"
/*
@@ -26,10 +25,10 @@
#define memzero(s, n) memset((s), 0, (n))
/* Symbols defined by linker scripts */
-extern char input_data[];
-extern int input_len;
extern char _end[];
extern char _bss[], _ebss[];
+extern unsigned char _compressed_start[];
+extern unsigned char _compressed_end[];
static void error(char *m);
@@ -83,12 +82,12 @@ static void error(char *x)
asm volatile("lpsw %0" : : "Q" (psw));
}
-void *decompress_kernel(unsigned long *uncompressed_size)
+void *decompress_kernel(void)
{
void *output, *kernel_end;
output = (void *) ALIGN((unsigned long) _end + HEAP_SIZE, PAGE_SIZE);
- kernel_end = output + SZ__bss_start;
+ kernel_end = output + vmlinux.image_size;
#ifdef CONFIG_BLK_DEV_INITRD
/*
@@ -111,9 +110,7 @@ void *decompress_kernel(unsigned long *uncompressed_size)
free_mem_ptr = (unsigned long) _end;
free_mem_end_ptr = free_mem_ptr + HEAP_SIZE;
- __decompress(input_data, input_len, NULL, NULL, output, 0, NULL, error);
- if (uncompressed_size)
- *uncompressed_size = SZ__bss_start;
+ __decompress(_compressed_start, _compressed_end - _compressed_start,
+ NULL, NULL, output, 0, NULL, error);
return output;
}
-