Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 805bc0bc authored by Gerald Schaefer's avatar Gerald Schaefer Committed by Martin Schwidefsky
Browse files

s390/kernel: build a relocatable kernel



This patch adds support for building a relocatable kernel with -fPIE.
The kernel will be relocated to 0 early in the boot process.

Signed-off-by: default avatarGerald Schaefer <gerald.schaefer@de.ibm.com>
Reviewed-by: default avatarPhilipp Rudo <prudo@linux.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 833b441e
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -624,6 +624,19 @@ config EXPOLINE_FULL

endchoice

config RELOCATABLE
	bool "Build a relocatable kernel"
	select MODULE_REL_CRCS if MODVERSIONS
	default y
	help
	  This builds a kernel image that retains relocation information
	  so it can be loaded at an arbitrary address.
	  The kernel is linked as a position-independent executable (PIE)
	  and contains dynamic relocations which are processed early in the
	  bootup process.
	  The relocations make the kernel image about 15% larger (compressed
	  10%), but are discarded at runtime.

endmenu

menu "Memory setup"
+4 −0
Original line number Diff line number Diff line
@@ -16,6 +16,10 @@ KBUILD_AFLAGS_MODULE += -fPIC
KBUILD_CFLAGS_MODULE += -fPIC
KBUILD_AFLAGS	+= -m64
KBUILD_CFLAGS	+= -m64
ifeq ($(CONFIG_RELOCATABLE),y)
KBUILD_CFLAGS	+= -fPIE
LDFLAGS_vmlinux	:= -pie
endif
aflags_dwarf	:= -Wa,-gdwarf-2
KBUILD_AFLAGS_DECOMPRESSOR := -m64 -D__ASSEMBLY__
KBUILD_AFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),$(aflags_dwarf))
+1 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ obj-y := head.o als.o startup.o mem_detect.o ipl_parm.o ipl_report.o
obj-y	+= string.o ebcdic.o sclp_early_core.o mem.o ipl_vmparm.o cmdline.o
obj-y	+= ctype.o
obj-$(CONFIG_PROTECTED_VIRTUALIZATION_GUEST)	+= uv.o
obj-$(CONFIG_RELOCATABLE)	+= machine_kexec_reloc.o
targets	:= bzImage startup.a section_cmp.boot.data section_cmp.boot.preserved.data $(obj-y)
subdir-	:= compressed

+3 −0
Original line number Diff line number Diff line
@@ -19,6 +19,9 @@ struct vmlinux_info {
	unsigned long bootdata_size;
	unsigned long bootdata_preserved_off;
	unsigned long bootdata_preserved_size;
	unsigned long dynsym_start;
	unsigned long rela_dyn_start;
	unsigned long rela_dyn_end;
};

extern char _vmlinux_info[];
+2 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
#include "../kernel/machine_kexec_reloc.c"
Loading