Explorar el Código

s390/decompressor: support uncompressed kernel

Implement uncompressed kernel support (when "None" is picked in kernel
compression mode list). In that case an actual decompression code is
skipped and control is passed from boot/head.S to startup_continue in
kernel/head64.S. To achieve that uncompressed kernel payload is
conditionally put at 0x100000 in bzImage.

In reality this is very close to classic uncompressed kernel "image",
but the decompressor has its own build and link process,
kernel/head64.S lives at 0x100000 rather than at 0x11000, and .bss
section is reused for both stages.

Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Vasily Gorbik hace 7 años
padre
commit
89b5202e81

+ 1 - 0
arch/s390/Kconfig

@@ -146,6 +146,7 @@ config S390
 	select HAVE_KERNEL_LZ4
 	select HAVE_KERNEL_LZ4
 	select HAVE_KERNEL_LZMA
 	select HAVE_KERNEL_LZMA
 	select HAVE_KERNEL_LZO
 	select HAVE_KERNEL_LZO
+	select HAVE_KERNEL_UNCOMPRESSED
 	select HAVE_KERNEL_XZ
 	select HAVE_KERNEL_XZ
 	select HAVE_KPROBES
 	select HAVE_KPROBES
 	select HAVE_KRETPROBES
 	select HAVE_KRETPROBES

+ 2 - 2
arch/s390/boot/compressed/Makefile

@@ -9,10 +9,10 @@ KCOV_INSTRUMENT := n
 GCOV_PROFILE := n
 GCOV_PROFILE := n
 UBSAN_SANITIZE := n
 UBSAN_SANITIZE := n
 
 
-obj-y	:= head.o misc.o piggy.o
+obj-y	:= $(if $(CONFIG_KERNEL_UNCOMPRESSED),,head.o misc.o) piggy.o
 targets	:= vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2
 targets	:= vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2
 targets += vmlinux.bin.xz vmlinux.bin.lzma vmlinux.bin.lzo vmlinux.bin.lz4
 targets += vmlinux.bin.xz vmlinux.bin.lzma vmlinux.bin.lzo vmlinux.bin.lz4
-targets += vmlinux.scr.lds sizes.h $(obj-y)
+targets += vmlinux.scr.lds $(obj-y) $(if $(CONFIG_KERNEL_UNCOMPRESSED),,sizes.h)
 
 
 KBUILD_AFLAGS := $(KBUILD_AFLAGS_DECOMPRESSOR)
 KBUILD_AFLAGS := $(KBUILD_AFLAGS_DECOMPRESSOR)
 KBUILD_CFLAGS := $(KBUILD_CFLAGS_DECOMPRESSOR)
 KBUILD_CFLAGS := $(KBUILD_CFLAGS_DECOMPRESSOR)

+ 8 - 4
arch/s390/boot/compressed/vmlinux.lds.S

@@ -23,13 +23,10 @@ SECTIONS
 		*(.text.*)
 		*(.text.*)
 		_etext = . ;
 		_etext = . ;
 	}
 	}
-	.rodata.compressed : {
-		*(.rodata.compressed)
-	}
 	.rodata : {
 	.rodata : {
 		_rodata = . ;
 		_rodata = . ;
 		*(.rodata)	 /* read-only data */
 		*(.rodata)	 /* read-only data */
-		*(.rodata.*)
+		EXCLUDE_FILE (*piggy.o) *(.rodata.*)
 		_erodata = . ;
 		_erodata = . ;
 	}
 	}
 	.data :	{
 	.data :	{
@@ -38,6 +35,13 @@ SECTIONS
 		*(.data.*)
 		*(.data.*)
 		_edata = . ;
 		_edata = . ;
 	}
 	}
+	startup_continue = 0x100000;
+#ifdef CONFIG_KERNEL_UNCOMPRESSED
+	. = 0x100000;
+#endif
+	.rodata.compressed : {
+		*(.rodata.compressed)
+	}
 	. = ALIGN(256);
 	. = ALIGN(256);
 	.bss : {
 	.bss : {
 		_bss = . ;
 		_bss = . ;

+ 4 - 0
arch/s390/boot/compressed/vmlinux.scr.lds.S

@@ -2,10 +2,14 @@
 SECTIONS
 SECTIONS
 {
 {
   .rodata.compressed : {
   .rodata.compressed : {
+#ifndef CONFIG_KERNEL_UNCOMPRESSED
 	input_len = .;
 	input_len = .;
 	LONG(input_data_end - input_data) input_data = .;
 	LONG(input_data_end - input_data) input_data = .;
+#endif
 	*(.data)
 	*(.data)
+#ifndef CONFIG_KERNEL_UNCOMPRESSED
 	output_len = . - 4;
 	output_len = . - 4;
 	input_data_end = .;
 	input_data_end = .;
+#endif
 	}
 	}
 }
 }

+ 4 - 0
arch/s390/boot/head.S

@@ -310,7 +310,11 @@ ENTRY(startup_kdump)
 	l	%r15,.Lstack-.LPG0(%r13)
 	l	%r15,.Lstack-.LPG0(%r13)
 	ahi	%r15,-STACK_FRAME_OVERHEAD
 	ahi	%r15,-STACK_FRAME_OVERHEAD
 	brasl	%r14,verify_facilities
 	brasl	%r14,verify_facilities
+#ifdef CONFIG_KERNEL_UNCOMPRESSED
+	jg	startup_continue
+#else
 	jg	startup_decompressor
 	jg	startup_decompressor
+#endif
 
 
 .Lstack:
 .Lstack:
 	.long	0x8000 + (1<<(PAGE_SHIFT+THREAD_SIZE_ORDER))
 	.long	0x8000 + (1<<(PAGE_SHIFT+THREAD_SIZE_ORDER))