From: Pratyush Anand <[email protected]>

This patch adds support to use binary image ie arch/arm64/boot/Image
with kdump.

Signed-off-by: Pratyush Anand <[email protected]>
[[email protected]: a bit reworked]
Signed-off-by: AKASHI Takahiro <[email protected]>
---
 kexec/arch/arm64/kexec-image-arm64.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/kexec/arch/arm64/kexec-image-arm64.c 
b/kexec/arch/arm64/kexec-image-arm64.c
index cad7c73..fe1e145 100644
--- a/kexec/arch/arm64/kexec-image-arm64.c
+++ b/kexec/arch/arm64/kexec-image-arm64.c
@@ -6,7 +6,9 @@
 
 #include <errno.h>
 
+#include "crashdump-arm64.h"
 #include "kexec-arm64.h"
+#include "kexec-syscall.h"
 
 int image_arm64_probe(const char *kernel_buf, off_t kernel_size)
 {
@@ -32,6 +34,7 @@ int image_arm64_load(int argc, char **argv, const char 
*kernel_buf,
 {
        const struct arm64_image_header *h;
        unsigned long image_base;
+       int result;
 
        h = (const struct arm64_image_header *)(kernel_buf);
 
@@ -47,8 +50,19 @@ int image_arm64_load(int argc, char **argv, const char 
*kernel_buf,
        dbgprintf("%s: PE format:     %s\n", __func__,
                (arm64_header_check_pe_sig(h) ? "yes" : "no"));
 
-       image_base = get_phys_offset() + arm64_mem.text_offset;
-       
+       if (info->kexec_flags & KEXEC_ON_CRASH) {
+               result = load_crashdump_segments(info);
+
+               if (result) {
+                       fprintf(stderr,
+                               "kexec: load crashdump segments failed.\n");
+                       return -1;
+               }
+               image_base = crash_reserved_mem.start + arm64_mem.text_offset;
+       } else {
+               image_base = get_phys_offset() + arm64_mem.text_offset;
+       }
+
        add_segment_phys_virt(info, kernel_buf, kernel_size, image_base,
                arm64_mem.image_size, 0);
 
-- 
2.9.0


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

Reply via email to