1ab60e0f72
This patch modifies the x86_64 kernel so that it can be loaded and run at any 2M aligned address, below 512G. The technique used is to compile the decompressor with -fPIC and modify it so the decompressor is fully relocatable. For the main kernel the page tables are modified so the kernel remains at the same virtual address. In addition a variable phys_base is kept that holds the physical address the kernel is loaded at. __pa_symbol is modified to add that when we take the address of a kernel symbol. When loaded with a normal bootloader the decompressor will decompress the kernel to 2M and it will run there. This both ensures the relocation code is always working, and makes it easier to use 2M pages for the kernel and the cpu. AK: changed to not make RELOCATABLE default in Kconfig Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: Vivek Goyal <vgoyal@in.ibm.com> Signed-off-by: Andi Kleen <ak@suse.de>
32 lines
921 B
Makefile
32 lines
921 B
Makefile
#
|
|
# linux/arch/x86_64/boot/compressed/Makefile
|
|
#
|
|
# create a compressed vmlinux image from the original vmlinux
|
|
#
|
|
# Note all the files here are compiled/linked as 32bit executables.
|
|
#
|
|
|
|
targets := vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o piggy.o
|
|
EXTRA_AFLAGS := -traditional
|
|
|
|
# cannot use EXTRA_CFLAGS because base CFLAGS contains -mkernel which conflicts with
|
|
# -m32
|
|
CFLAGS := -m64 -D__KERNEL__ -Iinclude -O2 -fno-strict-aliasing -fPIC -mcmodel=small -fno-builtin
|
|
LDFLAGS := -m elf_x86_64
|
|
|
|
LDFLAGS_vmlinux := -T
|
|
$(obj)/vmlinux: $(src)/vmlinux.lds $(obj)/head.o $(obj)/misc.o $(obj)/piggy.o FORCE
|
|
$(call if_changed,ld)
|
|
@:
|
|
|
|
$(obj)/vmlinux.bin: vmlinux FORCE
|
|
$(call if_changed,objcopy)
|
|
|
|
$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
|
|
$(call if_changed,gzip)
|
|
|
|
LDFLAGS_piggy.o := -r --format binary --oformat elf64-x86-64 -T
|
|
|
|
$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.gz FORCE
|
|
$(call if_changed,ld)
|