aee378209e
Fix Bug 925630 - kexec-tools: support for arm64 https://bugzilla.redhat.com/show_bug.cgi?id=925630 involves three things: 1. back porting upstream code to enable the function of kexec-tools on arm64 patchset backported from upstream: commit abdfe97736f89d9bc73662b9134604b0229a599e commit 522df5f7217fda01ece3f6ac3e9987b0320c2bb0 commit 217bcc00c9309416a6c6cd0584196559d28a9259 2. fix the arm related building issue by using autoreconf in spec file 3. patches to fix the issue of higher version gcc used by koji (not upstrem yet, and the corresponding fix in kernel side is in other package) kexec-tools-2.0.13-arm64-Add-support-for-additional-relocations-in-the-kexec-purgatory-code.patch kexec-tools-2.0.13-arm64-Add-support-of-R_AARCH64_PREL32-relocation-in-.patch [panand: apply patches in 3 of above paragraph] Signed-off-by: Pingfan Liu <piliu@redhat.com> Acked-by: Dave Young <dyoung@redhat.com> Acked-by: Pratyush Anand <panand@redhat.com>
97 lines
2.9 KiB
Diff
97 lines
2.9 KiB
Diff
From abdfe97736f89d9bc73662b9134604b0229a599e Mon Sep 17 00:00:00 2001
|
|
From: Pratyush Anand <panand@redhat.com>
|
|
Date: Wed, 21 Sep 2016 18:14:25 +0000
|
|
Subject: [PATCH 3/3] arm64: Add support for binary image files
|
|
|
|
Signed-off-by: Pratyush Anand <panand@redhat.com>
|
|
[Reworked and cleaned up]
|
|
Signed-off-by: Geoff Levand <geoff@infradead.org>
|
|
Tested-By: Pratyush Anand <panand@redhat.com>
|
|
Tested-By: Matthias Brugger <mbrugger@suse.com>
|
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
---
|
|
kexec/arch/arm64/kexec-image-arm64.c | 49 ++++++++++++++++++++++++++++++++----
|
|
1 file changed, 44 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/kexec/arch/arm64/kexec-image-arm64.c b/kexec/arch/arm64/kexec-image-arm64.c
|
|
index 42d2ea7..960ed96 100644
|
|
--- a/kexec/arch/arm64/kexec-image-arm64.c
|
|
+++ b/kexec/arch/arm64/kexec-image-arm64.c
|
|
@@ -3,7 +3,9 @@
|
|
*/
|
|
|
|
#define _GNU_SOURCE
|
|
+
|
|
#include "kexec-arm64.h"
|
|
+#include <limits.h>
|
|
|
|
int image_arm64_probe(const char *kernel_buf, off_t kernel_size)
|
|
{
|
|
@@ -21,14 +23,53 @@ int image_arm64_probe(const char *kernel_buf, off_t kernel_size)
|
|
return -1;
|
|
}
|
|
|
|
- fprintf(stderr, "kexec: ARM64 binary image files are currently NOT SUPPORTED.\n");
|
|
- return -1;
|
|
+ return 0;
|
|
}
|
|
|
|
int image_arm64_load(int argc, char **argv, const char *kernel_buf,
|
|
off_t kernel_size, struct kexec_info *info)
|
|
{
|
|
- return -1;
|
|
+ const struct arm64_image_header *header;
|
|
+ unsigned long kernel_segment;
|
|
+ int result;
|
|
+
|
|
+ header = (const struct arm64_image_header *)(kernel_buf);
|
|
+
|
|
+ if (arm64_process_image_header(header))
|
|
+ return -1;
|
|
+
|
|
+ kernel_segment = arm64_locate_kernel_segment(info);
|
|
+
|
|
+ if (kernel_segment == ULONG_MAX) {
|
|
+ dbgprintf("%s: Kernel segment is not allocated\n", __func__);
|
|
+ result = -EFAILED;
|
|
+ goto exit;
|
|
+ }
|
|
+
|
|
+ dbgprintf("%s: kernel_segment: %016lx\n", __func__, kernel_segment);
|
|
+ dbgprintf("%s: text_offset: %016lx\n", __func__,
|
|
+ arm64_mem.text_offset);
|
|
+ dbgprintf("%s: image_size: %016lx\n", __func__,
|
|
+ arm64_mem.image_size);
|
|
+ dbgprintf("%s: phys_offset: %016lx\n", __func__,
|
|
+ arm64_mem.phys_offset);
|
|
+ dbgprintf("%s: vp_offset: %016lx\n", __func__,
|
|
+ arm64_mem.vp_offset);
|
|
+ dbgprintf("%s: PE format: %s\n", __func__,
|
|
+ (arm64_header_check_pe_sig(header) ? "yes" : "no"));
|
|
+
|
|
+ /* load the kernel */
|
|
+ add_segment_phys_virt(info, kernel_buf, kernel_size,
|
|
+ kernel_segment + arm64_mem.text_offset,
|
|
+ arm64_mem.image_size, 0);
|
|
+
|
|
+ result = arm64_load_other_segments(info, kernel_segment
|
|
+ + arm64_mem.text_offset);
|
|
+
|
|
+exit:
|
|
+ if (result)
|
|
+ fprintf(stderr, "kexec: load failed.\n");
|
|
+ return result;
|
|
}
|
|
|
|
void image_arm64_usage(void)
|
|
@@ -36,6 +77,4 @@ void image_arm64_usage(void)
|
|
printf(
|
|
" An ARM64 binary image, compressed or not, big or little endian.\n"
|
|
" Typically an Image, Image.gz or Image.lzma file.\n\n");
|
|
- printf(
|
|
-" ARM64 binary image files are currently NOT SUPPORTED.\n\n");
|
|
}
|
|
--
|
|
2.9.3
|
|
|