mirror of
https://github.com/torvalds/linux.git
synced 2024-11-15 00:21:59 +00:00
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>
45 lines
670 B
Plaintext
45 lines
670 B
Plaintext
OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
|
|
OUTPUT_ARCH(i386:x86-64)
|
|
ENTRY(startup_64)
|
|
SECTIONS
|
|
{
|
|
/* Be careful parts of head.S assume startup_32 is at
|
|
* address 0.
|
|
*/
|
|
. = 0;
|
|
.text : {
|
|
_head = . ;
|
|
*(.text.head)
|
|
_ehead = . ;
|
|
*(.text.compressed)
|
|
_text = .; /* Text */
|
|
*(.text)
|
|
*(.text.*)
|
|
_etext = . ;
|
|
}
|
|
.rodata : {
|
|
_rodata = . ;
|
|
*(.rodata) /* read-only data */
|
|
*(.rodata.*)
|
|
_erodata = . ;
|
|
}
|
|
.data : {
|
|
_data = . ;
|
|
*(.data)
|
|
*(.data.*)
|
|
_edata = . ;
|
|
}
|
|
.bss : {
|
|
_bss = . ;
|
|
*(.bss)
|
|
*(.bss.*)
|
|
*(COMMON)
|
|
. = ALIGN(8);
|
|
_end = . ;
|
|
. = ALIGN(4096);
|
|
pgtable = . ;
|
|
. = . + 4096 * 6;
|
|
_heap = .;
|
|
}
|
|
}
|