ppc64/kdump: Fix ELF header endianess

Backport the following commit from kexec-tools upstream:

commit 45b33eb
Author: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Date:   Fri Jul 25 17:07:49 2014 +0200

    ppc64/kdump: Fix ELF header endianess

    The ELF header created among the loading of the kdump kernel should be
    flagged using the current endianess and not always as big endian.

    Without this patch the data exposed in /proc/vmcore are not readable when
    running in LE mode.

    Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
    Signed-off-by: Simon Horman <horms@verge.net.au>

This is part of the work to enable ppc64le.

Signed-off-by: WANG Chao <chaowang@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
This commit is contained in:
WANG Chao 2014-09-15 12:10:40 +08:00
parent 79449e6612
commit 511ed60630
2 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,36 @@
From 45b33eb2e70cd44f41abf1058a92659cb4315011 Mon Sep 17 00:00:00 2001
From: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Date: Fri, 25 Jul 2014 17:07:49 +0200
Subject: [PATCH] ppc64/kdump: Fix ELF header endianess
The ELF header created among the loading of the kdump kernel should be
flagged using the current endianess and not always as big endian.
Without this patch the data exposed in /proc/vmcore are not readable when
running in LE mode.
Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
kexec/arch/ppc64/crashdump-ppc64.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/kexec/arch/ppc64/crashdump-ppc64.c b/kexec/arch/ppc64/crashdump-ppc64.c
index 00a0e63..6214b83 100644
--- a/kexec/arch/ppc64/crashdump-ppc64.c
+++ b/kexec/arch/ppc64/crashdump-ppc64.c
@@ -38,7 +38,11 @@
static struct crash_elf_info elf_info64 =
{
class: ELFCLASS64,
+#if BYTE_ORDER == LITTLE_ENDIAN
+ data: ELFDATA2LSB,
+#else
data: ELFDATA2MSB,
+#endif
machine: EM_PPC64,
page_offset: PAGE_OFFSET,
lowmem_limit: MAXMEM,
--
1.9.3

View File

@ -69,6 +69,7 @@ Patch101: kexec-tools-2.0.7-Provide-an-option-to-use-new-kexec-system-call.patch
# #
Patch301: kexec-tools-2.0.7-kexec-ppc64-move-to-device-tree-version-17.patch Patch301: kexec-tools-2.0.7-kexec-ppc64-move-to-device-tree-version-17.patch
Patch302: kexec-tools-2.0.7-kexec-ppc64-disabling-exception-handling-when-buildi.patch Patch302: kexec-tools-2.0.7-kexec-ppc64-disabling-exception-handling-when-buildi.patch
Patch303: kexec-tools-2.0.7-ppc64-kdump-Fix-ELF-header-endianess.patch
# #
# Patches 401 through 500 are meant for s390 kexec-tools enablement # Patches 401 through 500 are meant for s390 kexec-tools enablement
@ -132,6 +133,7 @@ tar -z -x -v -f %{SOURCE23}
%patch607 -p1 %patch607 -p1
%patch301 -p1 %patch301 -p1
%patch302 -p1 %patch302 -p1
%patch303 -p1
%ifarch ppc %ifarch ppc
%define archdef ARCH=ppc %define archdef ARCH=ppc