summaryrefslogtreecommitdiff
path: root/kexec/arch/arm64/kexec-elf-arm64.c
diff options
context:
space:
mode:
authorAKASHI Takahiro <takahiro.akashi@linaro.org>2017-05-17 14:51:47 +0900
committerSimon Horman <horms@verge.net.au>2017-05-22 13:36:18 +0200
commit1591926df5a602ffcbf55e99aa8a96fbebd0bafe (patch)
treeb2258f0d6721c5b1a26e0a5748e380443949b2b8 /kexec/arch/arm64/kexec-elf-arm64.c
parent0bd5219da953639276cd17e067c030ac97feca97 (diff)
arm64: kdump: set up kernel image segment
On arm64, we can use the same kernel image as 1st kernel, but we have to modify the entry point as well as segments' addresses in the kernel's elf header in order to load them into correct places. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Tested-by: David Woodhouse <dwmw@amazon.co.uk> Tested-by: Pratyush Anand <panand@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'kexec/arch/arm64/kexec-elf-arm64.c')
-rw-r--r--kexec/arch/arm64/kexec-elf-arm64.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/kexec/arch/arm64/kexec-elf-arm64.c b/kexec/arch/arm64/kexec-elf-arm64.c
index 900c693..a961147 100644
--- a/kexec/arch/arm64/kexec-elf-arm64.c
+++ b/kexec/arch/arm64/kexec-elf-arm64.c
@@ -9,6 +9,7 @@
#include <stdlib.h>
#include <linux/elf.h>
+#include "crashdump-arm64.h"
#include "kexec-arm64.h"
#include "kexec-elf.h"
#include "kexec-syscall.h"
@@ -105,7 +106,8 @@ int elf_arm64_load(int argc, char **argv, const char *kernel_buf,
}
arm64_mem.vp_offset = _ALIGN_DOWN(ehdr.e_entry, MiB(2));
- arm64_mem.vp_offset -= kernel_segment - get_phys_offset();
+ if (!(info->kexec_flags & KEXEC_ON_CRASH))
+ arm64_mem.vp_offset -= kernel_segment - get_phys_offset();
dbgprintf("%s: kernel_segment: %016lx\n", __func__, kernel_segment);
dbgprintf("%s: text_offset: %016lx\n", __func__,
@@ -130,6 +132,13 @@ int elf_arm64_load(int argc, char **argv, const char *kernel_buf,
}
/* load the kernel */
+ if (info->kexec_flags & KEXEC_ON_CRASH)
+ /*
+ * offset addresses in elf header in order to load
+ * vmlinux (elf_exec) into crash kernel's memory
+ */
+ fixup_elf_addrs(&ehdr);
+
result = elf_exec_load(&ehdr, info);
if (result) {