@@ -28,12 +28,11 @@ KBUILD_CFLAGS := $(filter-out -march=loongson3a, $(KBUILD_CFLAGS)) -march=mips64
endif
KBUILD_CFLAGS := $(KBUILD_CFLAGS) -D__KERNEL__ -D__DISABLE_EXPORTS \
- -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) -D"VMLINUX_LOAD_ADDRESS_ULL=$(VMLINUX_LOAD_ADDRESS)ull"
-
-KBUILD_AFLAGS := $(KBUILD_AFLAGS) -D__ASSEMBLY__ \
- -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) \
+ -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) -D"VMLINUX_LOAD_ADDRESS_ULL=$(VMLINUX_LOAD_ADDRESS)ull" \
-DKERNEL_ENTRY=$(VMLINUX_ENTRY_ADDRESS)
+KBUILD_AFLAGS := $(KBUILD_AFLAGS) -D__ASSEMBLY__ -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE)
+
# Prevents link failures: __sanitizer_cov_trace_pc() is not linked in.
KCOV_INSTRUMENT := n
GCOV_PROFILE := n
@@ -85,9 +85,11 @@ void __stack_chk_fail(void)
error("stack-protector: Kernel stack is corrupted\n");
}
-void decompress_kernel(unsigned long boot_heap_start)
+unsigned long decompress_kernel(unsigned long boot_heap_start)
{
unsigned long zimage_start, zimage_size;
+ unsigned long offset = 0x8000000;
+ unsigned long long load_address = VMLINUX_LOAD_ADDRESS_ULL + offset;
zimage_start = (unsigned long)(&__image_begin);
zimage_size = (unsigned long)(&__image_end) -
@@ -105,12 +107,12 @@ void decompress_kernel(unsigned long boot_heap_start)
/* Display standard Linux/MIPS boot prompt */
puts("Uncompressing Linux at load address ");
- puthex(VMLINUX_LOAD_ADDRESS_ULL);
+ puthex(load_address);
puts("\n");
/* Decompress the kernel with according algorithm */
__decompress((char *)zimage_start, zimage_size, 0, 0,
- (void *)VMLINUX_LOAD_ADDRESS_ULL, 0, 0, error);
+ (void *)load_address, 0, 0, error);
if (IS_ENABLED(CONFIG_MIPS_RAW_APPENDED_DTB) &&
fdt_magic((void *)&__appended_dtb) == FDT_MAGIC) {
@@ -125,14 +127,16 @@ void decompress_kernel(unsigned long boot_heap_start)
image_size = ALIGN(image_size, STRUCT_ALIGNMENT);
puts("Copy device tree to address ");
- puthex(VMLINUX_LOAD_ADDRESS_ULL + image_size);
+ puthex(load_address + image_size);
puts("\n");
/* copy dtb to where the booted kernel will expect it */
- memcpy((void *)VMLINUX_LOAD_ADDRESS_ULL + image_size,
+ memcpy((void *)load_address + image_size,
__appended_dtb, dtb_size);
}
/* FIXME: should we flush cache here? */
puts("Now, booting the kernel...\n");
+
+ return (KERNEL_ENTRY + offset);
}
@@ -40,8 +40,7 @@
move a1, s1
move a2, s2
move a3, s3
- PTR_LI t9, KERNEL_ENTRY
- jalr t9
+ jalr v0
3:
b 3b