Blob Blame History Raw
From 249821e20306fbafff9094a4e02c82b189ea0676 Mon Sep 17 00:00:00 2001
Message-Id: <249821e20306fbafff9094a4e02c82b189ea0676.1431592766.git.panand@redhat.com>
In-Reply-To: <1fb6841aa15407dbf371589d7abca7bc2d35815c.1431592766.git.panand@redhat.com>
References: <1fb6841aa15407dbf371589d7abca7bc2d35815c.1431592766.git.panand@redhat.com>
From: Pratyush Anand <panand@redhat.com>
Date: Tue, 21 Apr 2015 18:23:38 +0530
Subject: [PATCH 14/17] arm64: kdump: Add support for binary image

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

Signed-off-by: Pratyush Anand <panand@redhat.com>
---
 kexec/arch/arm64/kexec-image-arm64.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/kexec/arch/arm64/kexec-image-arm64.c b/kexec/arch/arm64/kexec-image-arm64.c
index c577b96d5e31..6f8a6590639a 100644
--- a/kexec/arch/arm64/kexec-image-arm64.c
+++ b/kexec/arch/arm64/kexec-image-arm64.c
@@ -10,6 +10,7 @@
 #include <libfdt.h>
 #include <stdlib.h>
 
+#include "crashdump-arm64.h"
 #include "dt-ops.h"
 #include "image-header.h"
 #include "kexec-arm64.h"
@@ -97,13 +98,23 @@ int image_arm64_load(int argc, char **argv, const char *kernel_buf,
 
 	arm64_mem.page_offset = get_kernel_page_offset();
 
-	result = parse_iomem_single("Kernel code\n", &start, NULL);
+	if (info->kexec_flags & KEXEC_ON_CRASH) {
+		result = load_crashdump_segments(info, &header_option);
 
-	if (result) {
-		fprintf(stderr, "kexec: Could not get kernel code address.\n");
-		return -1;
+		if (result) {
+			fprintf(stderr, "kexec: load crashdump segments failed.\n");
+			return -1;
+		}
+		start = crash_reserved_mem.start;
+	} else {
+		result = parse_iomem_single("Kernel code\n", &start, NULL);
+
+		if (result) {
+			fprintf(stderr, "kexec: Could not get kernel code address.\n");
+			return -1;
+		}
+		start -= arm64_mem.text_offset;
 	}
-	start -= arm64_mem.text_offset;
 
 	/* Add kernel */
 	add_segment_phys_virt(info, kernel_buf, kernel_size,
@@ -112,7 +123,8 @@ int image_arm64_load(int argc, char **argv, const char *kernel_buf,
 
 	info->entry = (void *)start + arm64_mem.text_offset;
 
-	result = arm64_load_other_segments(info, (unsigned long)info->entry);
+	result = arm64_load_other_segments(info, (unsigned long)info->entry,
+		header_option);
 
 	if (header_option)
 		free(header_option);
-- 
2.1.0