summaryrefslogtreecommitdiff
path: root/arch/s390/boot/compressed/Makefile
diff options
context:
space:
mode:
authorVasily Gorbik <gor@linux.vnet.ibm.com>2018-03-05 09:58:00 +0100
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2018-03-18 23:02:07 -0700
commit81796a3c6a4ad3ba0408c807ec14f50e6270ec23 (patch)
treef0906b8ea616d35acf2421c69bb9f25c58b080a5 /arch/s390/boot/compressed/Makefile
parentc7260ca335a09fb186885c80bd6022318c10c541 (diff)
s390/decompressor: trim uncompressed image head during the build
It seems to be suboptimal to compress the entire image, so that we could decompress and throw away the first 68k (0x11000) during the boot process. This patch trims 0x11000 bytes during the build process and adjusts symbols in size.h accordingly. Besides making bzImage smaller, this change would also be a benefit for kaslr. It allows to decompress the kernel right to desired offset, without worrying about dead weight in front of the decompressed image. Signed-off-by: Vasily Gorbik <gor@linux.vnet.ibm.com> Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/boot/compressed/Makefile')
-rw-r--r--arch/s390/boot/compressed/Makefile16
1 files changed, 12 insertions, 4 deletions
diff --git a/arch/s390/boot/compressed/Makefile b/arch/s390/boot/compressed/Makefile
index 26d6a94f40f6..5766f7b9b271 100644
--- a/arch/s390/boot/compressed/Makefile
+++ b/arch/s390/boot/compressed/Makefile
@@ -29,11 +29,16 @@ LDFLAGS_vmlinux := --oformat $(LD_BFD) -e startup -T
$(obj)/vmlinux: $(obj)/vmlinux.lds $(OBJECTS)
$(call if_changed,ld)
-sed-sizes := -e 's/^\([0-9a-fA-F]*\) . \(__bss_start\|_end\)$$/\#define SZ\2 0x\1/p'
+TRIM_HEAD_SIZE := 0x11000
-quiet_cmd_sizes = GEN $@
+sed-sizes := -e 's/^\([0-9a-fA-F]*\) . \(__bss_start\|_end\)$$/\#define SZ\2 (0x\1 - $(TRIM_HEAD_SIZE))/p'
+
+quiet_cmd_sizes = GEN $@
cmd_sizes = $(NM) $< | sed -n $(sed-sizes) > $@
+quiet_cmd_trim_head = TRIM $@
+ cmd_trim_head = tail -c +$$(($(TRIM_HEAD_SIZE) + 1)) $< > $@
+
$(obj)/sizes.h: vmlinux
$(call if_changed,sizes)
@@ -43,10 +48,13 @@ $(obj)/head.o: $(obj)/sizes.h
CFLAGS_misc.o += -I$(objtree)/$(obj)
$(obj)/misc.o: $(obj)/sizes.h
-OBJCOPYFLAGS_vmlinux.bin := -R .comment -S
-$(obj)/vmlinux.bin: vmlinux
+OBJCOPYFLAGS_vmlinux.bin.full := -R .comment -S
+$(obj)/vmlinux.bin.full: vmlinux
$(call if_changed,objcopy)
+$(obj)/vmlinux.bin: $(obj)/vmlinux.bin.full
+ $(call if_changed,trim_head)
+
vmlinux.bin.all-y := $(obj)/vmlinux.bin
suffix-$(CONFIG_KERNEL_GZIP) := gz