diff -Nru kexec-tools-2.0.6/debian/changelog kexec-tools-2.0.6/debian/changelog --- kexec-tools-2.0.6/debian/changelog 2014-04-16 09:29:52.000000000 -0500 +++ kexec-tools-2.0.6/debian/changelog 2014-10-01 11:57:28.000000000 -0500 @@ -1,3 +1,13 @@ +kexec-tools (1:2.0.6-0ubuntu3) utopic; urgency=medium + + * Add the following patches to enable kexec-tools on ppc64el (LP: #1364427): + - ppc64-purgatory-Device-tree-values-should-be-read-st.patch + - kexec-ppc64-move-to-device-tree-version-17.patch + - kexec-ppc64-disabling-exception-handling-when-buildi.patch + - ppc64-kdump-Fix-ELF-header-endianess.patch + + -- Chris J Arges Wed, 01 Oct 2014 11:26:17 -0500 + kexec-tools (1:2.0.6-0ubuntu2) trusty; urgency=medium * endianess-initrd.patch: Fix endian issues with initrd base and size. diff -Nru kexec-tools-2.0.6/debian/patches/kexec-ppc64-disabling-exception-handling-when-buildi.patch kexec-tools-2.0.6/debian/patches/kexec-ppc64-disabling-exception-handling-when-buildi.patch --- kexec-tools-2.0.6/debian/patches/kexec-ppc64-disabling-exception-handling-when-buildi.patch 1969-12-31 18:00:00.000000000 -0600 +++ kexec-tools-2.0.6/debian/patches/kexec-ppc64-disabling-exception-handling-when-buildi.patch 2014-10-01 11:24:16.000000000 -0500 @@ -0,0 +1,39 @@ +From 479c7fa85a9146ff2de43fb8572228cf2698ed5d Mon Sep 17 00:00:00 2001 +From: Laurent Dufour +Date: Tue, 22 Jul 2014 18:22:28 +0200 +Subject: [PATCH 4/5] kexec/ppc64: disabling exception handling when building + the purgatory + +Some Linux distributions would like to turn on the GCC exception handling +by default. As this option introduces symbols in the built code that are +defined in a separate shared library, this is not a good idea to have such +an option activated when building the purgatory. + +This patch forces the exception handling to be turned off when building the +purgatory on ppc64 BE and LE. + +Signed-off-by: Laurent Dufour +Signed-off-by: Simon Horman +(cherry picked from commit 335bad77fb0750f3961aa8df47c83a522d212b08) +Signed-off-by: Chris J Arges +--- + purgatory/arch/ppc64/Makefile | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/purgatory/arch/ppc64/Makefile b/purgatory/arch/ppc64/Makefile +index 712e2b1..6c58fa2 100644 +--- a/purgatory/arch/ppc64/Makefile ++++ b/purgatory/arch/ppc64/Makefile +@@ -9,7 +9,8 @@ ppc64_PURGATORY_SRCS += purgatory/arch/ppc64/console-ppc64.c + ppc64_PURGATORY_SRCS += purgatory/arch/ppc64/crashdump_backup.c + ppc64_PURGATORY_SRCS += purgatory/arch/ppc64/misc.S + +-ppc64_PURGATORY_EXTRA_CFLAGS += -m64 -msoft-float -fno-stack-protector ++ppc64_PURGATORY_EXTRA_CFLAGS += -m64 -msoft-float -fno-stack-protector \ ++ -fno-exceptions + ppc64_PURGATORY_EXTRA_ASFLAGS += -m64 + ifeq ($(SUBARCH),BE) + ppc64_PURGATORY_EXTRA_LDFLAGS += -melf64ppc +-- +1.9.1 + diff -Nru kexec-tools-2.0.6/debian/patches/kexec-ppc64-move-to-device-tree-version-17.patch kexec-tools-2.0.6/debian/patches/kexec-ppc64-move-to-device-tree-version-17.patch --- kexec-tools-2.0.6/debian/patches/kexec-ppc64-move-to-device-tree-version-17.patch 1969-12-31 18:00:00.000000000 -0600 +++ kexec-tools-2.0.6/debian/patches/kexec-ppc64-move-to-device-tree-version-17.patch 2014-10-01 11:24:16.000000000 -0500 @@ -0,0 +1,44 @@ +From 62f10b7cc42cfaa72e8959a27af984b837b4b923 Mon Sep 17 00:00:00 2001 +From: Laurent Dufour +Date: Mon, 16 Jun 2014 14:42:43 +0200 +Subject: [PATCH 2/5] kexec/ppc64: move to device tree version 17 + +Kernel commit e6a6928c3ea1d0195ed75a091e345696b916c09b changed the way the +device tree is processed in the kernel. Now version 2 is no more supported. + +This patch move the version of the device tree generated in ppc64 +environment from 2 to 17, allowing to kexec kernel 3.16. + +In addition, automates the define of NEED_STRUCTURE_BLOCK_EXTRA_PAD which +should not be set for DT version 16 and above. + +Signed-off-by: Laurent Dufour +Signed-off-by: Simon Horman +(cherry picked from commit 2ca220389d212249cc842d49084c95e524fb299b) +Signed-off-by: Chris J Arges +--- + kexec/arch/ppc64/kexec-ppc64.h | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/kexec/arch/ppc64/kexec-ppc64.h b/kexec/arch/ppc64/kexec-ppc64.h +index 9a0aecf..89ee942 100644 +--- a/kexec/arch/ppc64/kexec-ppc64.h ++++ b/kexec/arch/ppc64/kexec-ppc64.h +@@ -6,9 +6,11 @@ + #define CORE_TYPE_ELF32 1 + #define CORE_TYPE_ELF64 2 + +-#define BOOT_BLOCK_VERSION 2 +-#define BOOT_BLOCK_LAST_COMP_VERSION 2 +-#define NEED_STRUCTURE_BLOCK_EXTRA_PAD ++#define BOOT_BLOCK_VERSION 17 ++#define BOOT_BLOCK_LAST_COMP_VERSION 17 ++#if (BOOT_BLOCK_VERSION < 16) ++# define NEED_STRUCTURE_BLOCK_EXTRA_PAD ++#endif + #define HAVE_DYNAMIC_MEMORY + #define NEED_RESERVE_DTB + +-- +1.9.1 + diff -Nru kexec-tools-2.0.6/debian/patches/ppc64-kdump-Fix-ELF-header-endianess.patch kexec-tools-2.0.6/debian/patches/ppc64-kdump-Fix-ELF-header-endianess.patch --- kexec-tools-2.0.6/debian/patches/ppc64-kdump-Fix-ELF-header-endianess.patch 1969-12-31 18:00:00.000000000 -0600 +++ kexec-tools-2.0.6/debian/patches/ppc64-kdump-Fix-ELF-header-endianess.patch 2014-10-01 11:24:16.000000000 -0500 @@ -0,0 +1,38 @@ +From b4afaf1c5ac69cae4c7049c6288c100c65e798d4 Mon Sep 17 00:00:00 2001 +From: Laurent Dufour +Date: Fri, 25 Jul 2014 17:07:49 +0200 +Subject: [PATCH 5/5] 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 +Signed-off-by: Simon Horman +(cherry picked from commit 45b33eb2e70cd44f41abf1058a92659cb4315011) +Signed-off-by: Chris J Arges +--- + 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 c0d575d..cc6556b 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.1 + diff -Nru kexec-tools-2.0.6/debian/patches/ppc64-purgatory-Device-tree-values-should-be-read-st.patch kexec-tools-2.0.6/debian/patches/ppc64-purgatory-Device-tree-values-should-be-read-st.patch --- kexec-tools-2.0.6/debian/patches/ppc64-purgatory-Device-tree-values-should-be-read-st.patch 1969-12-31 18:00:00.000000000 -0600 +++ kexec-tools-2.0.6/debian/patches/ppc64-purgatory-Device-tree-values-should-be-read-st.patch 2014-10-01 11:24:16.000000000 -0500 @@ -0,0 +1,51 @@ +From 39de99619ef301eadfe2c0d0395f8083a2f8f42f Mon Sep 17 00:00:00 2001 +From: Laurent Dufour +Date: Mon, 28 Apr 2014 12:26:50 +0200 +Subject: [PATCH 1/5] ppc64/purgatory: Device tree values should be read/stored + in Big Endian + +The purgatory code reads the device tree's version and stores if needed the +currently running CPU number. These 2 values are stored in Big Endian +format in the device tree and should be byte swapped when running in Little +Endian mode. + +Without this fix, when running in SMP environment, kexec or kdump kernel may +fail booting with the following message : +Failed to identify boot CPU + +Signed-off-by: Laurent Dufour +Signed-off-by: Simon Horman +(cherry picked from commit 90853885a859e42b0ff6935199bf6fceda1c6a87) +Signed-off-by: Chris J Arges +--- + purgatory/arch/ppc64/v2wrap.S | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/purgatory/arch/ppc64/v2wrap.S b/purgatory/arch/ppc64/v2wrap.S +index 6fc62e3..dc5034f 100644 +--- a/purgatory/arch/ppc64/v2wrap.S ++++ b/purgatory/arch/ppc64/v2wrap.S +@@ -90,10 +90,20 @@ master: + LOADADDR(16, dt_offset) + ld 3,0(16) # load device-tree address + mr 16,3 # save dt address in reg16 ++#ifdef __BIG_ENDIAN__ + lwz 6,20(3) # fetch version number ++#else ++ li 4,20 ++ lwbrx 6,3,4 # fetch BE version number ++#endif + cmpwi 0,6,2 # v2 ? + blt 80f ++#ifdef __BIG_ENDIAN__ + stw 17,28(3) # save my cpu number as boot_cpu_phys ++#else ++ li 4,28 ++ stwbrx 17,3,4 # Store my cpu as BE value ++#endif + 80: + LOADADDR(6,opal_base) # For OPAL early debug + ld 8,0(6) # load the OPAL base address in r8 +-- +1.9.1 + diff -Nru kexec-tools-2.0.6/debian/patches/series kexec-tools-2.0.6/debian/patches/series --- kexec-tools-2.0.6/debian/patches/series 2014-04-16 09:26:19.000000000 -0500 +++ kexec-tools-2.0.6/debian/patches/series 2014-10-01 11:25:51.000000000 -0500 @@ -7,3 +7,7 @@ format-security.patch endianess-initrd.patch stack-protection.patch +ppc64-purgatory-Device-tree-values-should-be-read-st.patch +kexec-ppc64-move-to-device-tree-version-17.patch +kexec-ppc64-disabling-exception-handling-when-buildi.patch +ppc64-kdump-Fix-ELF-header-endianess.patch