summaryrefslogtreecommitdiffstats
path: root/external/poky/meta/recipes-kernel/kexec/kexec-tools
diff options
context:
space:
mode:
authorToshikazuOhiwa <toshikazu_ohiwa@mail.toyota.co.jp>2020-03-30 09:24:26 +0900
committerToshikazuOhiwa <toshikazu_ohiwa@mail.toyota.co.jp>2020-03-30 09:24:26 +0900
commit5b80bfd7bffd4c20d80b7c70a7130529e9a755dd (patch)
treeb4bb18dcd1487dbf1ea8127e5671b7bb2eded033 /external/poky/meta/recipes-kernel/kexec/kexec-tools
parent706ad73eb02caf8532deaf5d38995bd258725cb8 (diff)
agl-basesystem
Diffstat (limited to 'external/poky/meta/recipes-kernel/kexec/kexec-tools')
-rw-r--r--external/poky/meta/recipes-kernel/kexec/kexec-tools/0001-Disable-PIE-during-link.patch31
-rw-r--r--external/poky/meta/recipes-kernel/kexec/kexec-tools/0001-kexec-fix-for-Unhandled-rela-relocation-R_X86_64_PLT.patch41
-rw-r--r--external/poky/meta/recipes-kernel/kexec/kexec-tools/0001-purgatory-Pass-r-directly-to-linker.patch32
-rw-r--r--external/poky/meta/recipes-kernel/kexec/kexec-tools/0002-powerpc-change-the-memory-size-limit.patch35
-rw-r--r--external/poky/meta/recipes-kernel/kexec/kexec-tools/0010-kexec-ARM-Fix-add_buffer_phys_virt-align-issue.patch52
-rwxr-xr-xexternal/poky/meta/recipes-kernel/kexec/kexec-tools/kdump145
-rw-r--r--external/poky/meta/recipes-kernel/kexec/kexec-tools/kdump.conf14
-rw-r--r--external/poky/meta/recipes-kernel/kexec/kexec-tools/kdump.service14
-rw-r--r--external/poky/meta/recipes-kernel/kexec/kexec-tools/kexec-x32.patch88
9 files changed, 452 insertions, 0 deletions
diff --git a/external/poky/meta/recipes-kernel/kexec/kexec-tools/0001-Disable-PIE-during-link.patch b/external/poky/meta/recipes-kernel/kexec/kexec-tools/0001-Disable-PIE-during-link.patch
new file mode 100644
index 00000000..3f2f85e3
--- /dev/null
+++ b/external/poky/meta/recipes-kernel/kexec/kexec-tools/0001-Disable-PIE-during-link.patch
@@ -0,0 +1,31 @@
+From ea7be6d71b85880e8e8a2c8a4f49a696c5f31ae4 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 10 Jun 2017 11:18:49 -0700
+Subject: [PATCH] Disable PIE during link
+
+We have explcitly disabled PIE during compile so we
+just need to match it with linker flags
+
+Upstream-Status: Pending
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ purgatory/Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/purgatory/Makefile b/purgatory/Makefile
+index 564bdb7..a08e41f 100644
+--- a/purgatory/Makefile
++++ b/purgatory/Makefile
+@@ -59,7 +59,7 @@ $(PURGATORY): CPPFLAGS=$($(ARCH)_PURGATORY_EXTRA_CFLAGS) \
+ -Iinclude \
+ -I$(shell $(CC) -print-file-name=include)
+ $(PURGATORY): LDFLAGS=$($(ARCH)_PURGATORY_EXTRA_CFLAGS)\
+- -Wl,--no-undefined -nostartfiles -nostdlib \
++ -Wl,--no-undefined -no-pie -nostartfiles -nostdlib \
+ -nodefaultlibs -e purgatory_start -Wl,-r \
+ -Wl,-Map=$(PURGATORY_MAP)
+
+--
+2.13.1
+
diff --git a/external/poky/meta/recipes-kernel/kexec/kexec-tools/0001-kexec-fix-for-Unhandled-rela-relocation-R_X86_64_PLT.patch b/external/poky/meta/recipes-kernel/kexec/kexec-tools/0001-kexec-fix-for-Unhandled-rela-relocation-R_X86_64_PLT.patch
new file mode 100644
index 00000000..e0cced55
--- /dev/null
+++ b/external/poky/meta/recipes-kernel/kexec/kexec-tools/0001-kexec-fix-for-Unhandled-rela-relocation-R_X86_64_PLT.patch
@@ -0,0 +1,41 @@
+From b9de21ef51a7ceab7122a707c188602eae22c4ee Mon Sep 17 00:00:00 2001
+From: Chris Clayton <chris2553@googlemail.com>
+Date: Mon, 20 Aug 2018 12:00:31 +0100
+Subject: [PATCH] kexec: fix for "Unhandled rela relocation: R_X86_64_PLT32" error
+
+In response to a change in binutils, commit b21ebf2fb4c
+(x86: Treat R_X86_64_PLT32 as R_X86_64_PC32) was applied to
+the linux kernel during the 4.16 development cycle and has
+since been backported to earlier stable kernel series. The
+change results in the failure message in $SUBJECT when
+rebooting via kexec.
+
+Fix this by replicating the change in kexec.
+
+Upstream-Status: Backport[https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?id=b9de21ef51a7ceab7122a707c188602eae22c4ee]
+
+Signed-off-by: Chris Clayton <chris2553@googlemail.com>
+Acked-by: Baoquan He <bhe@redhat.com>
+Tested-by: Bhupesh Sharma <bhsharma@redhat.com>
+Acked-by: Bhupesh Sharma <bhsharma@redhat.com>
+Signed-off-by: Simon Horman <horms@verge.net.au>
+Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
+---
+ kexec/arch/x86_64/kexec-elf-rel-x86_64.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/kexec/arch/x86_64/kexec-elf-rel-x86_64.c b/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
+index 7fdde73..db85b44 100644
+--- a/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
++++ b/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
+@@ -79,6 +79,7 @@ void machine_apply_elf_rel(struct mem_ehdr *UNUSED(ehdr),
+ goto overflow;
+ break;
+ case R_X86_64_PC32:
++ case R_X86_64_PLT32:
+ *(uint32_t *)location = value - address;
+ break;
+ default:
+--
+2.7.4
+
diff --git a/external/poky/meta/recipes-kernel/kexec/kexec-tools/0001-purgatory-Pass-r-directly-to-linker.patch b/external/poky/meta/recipes-kernel/kexec/kexec-tools/0001-purgatory-Pass-r-directly-to-linker.patch
new file mode 100644
index 00000000..bfd077da
--- /dev/null
+++ b/external/poky/meta/recipes-kernel/kexec/kexec-tools/0001-purgatory-Pass-r-directly-to-linker.patch
@@ -0,0 +1,32 @@
+From a1135b3170963ba956f2364c1283864c35541295 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 7 Sep 2015 07:59:45 +0000
+Subject: [PATCH] purgatory: Pass -r directly to linker
+
+This helps compiling with clang since -r is not a known option for clang
+where as gcc knows how to deal with it and passes it down to linker
+unfiltered
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ purgatory/Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/purgatory/Makefile b/purgatory/Makefile
+index 2b5c061..b251353 100644
+--- a/purgatory/Makefile
++++ b/purgatory/Makefile
+@@ -61,7 +61,7 @@ $(PURGATORY): CPPFLAGS=$($(ARCH)_PURGATORY_EXTRA_CFLAGS) \
+ -I$(shell $(CC) -print-file-name=include)
+ $(PURGATORY): LDFLAGS=$($(ARCH)_PURGATORY_EXTRA_CFLAGS)\
+ -Wl,--no-undefined -nostartfiles -nostdlib \
+- -nodefaultlibs -e purgatory_start -r \
++ -nodefaultlibs -e purgatory_start -Wl,-r \
+ -Wl,-Map=$(PURGATORY_MAP)
+
+ $(PURGATORY): $(PURGATORY_OBJS)
+--
+2.5.1
+
diff --git a/external/poky/meta/recipes-kernel/kexec/kexec-tools/0002-powerpc-change-the-memory-size-limit.patch b/external/poky/meta/recipes-kernel/kexec/kexec-tools/0002-powerpc-change-the-memory-size-limit.patch
new file mode 100644
index 00000000..dc97d930
--- /dev/null
+++ b/external/poky/meta/recipes-kernel/kexec/kexec-tools/0002-powerpc-change-the-memory-size-limit.patch
@@ -0,0 +1,35 @@
+From b19b68eab567aa534cf8dec79fe18e3dc0e14043 Mon Sep 17 00:00:00 2001
+From: Quanyang Wang <quanyang.wang@windriver.com>
+Date: Tue, 16 Jun 2015 12:59:57 +0800
+Subject: [PATCH] powerpc: change the memory size limit
+
+When run "kexec" in powerpc board, the kexec has a limit that
+the kernel text and bss size must be less than 24M. But now
+some kernel size exceed the limit. So we need to change the limit,
+else will get the error log as below:
+
+my_load:669: do
+Could not find a free area of memory of 0x12400 bytes...
+Could not find a free area of memory of 0x13000 bytes...
+locate_hole failed
+
+Upstream-Status: Pending
+
+Signed-off-by: Quanyang Wang <quanyang.wang@windriver.com>
+---
+ kexec/arch/ppc/kexec-ppc.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+Index: kexec-tools-2.0.10/kexec/arch/ppc/kexec-ppc.h
+===================================================================
+--- kexec-tools-2.0.10.orig/kexec/arch/ppc/kexec-ppc.h
++++ kexec-tools-2.0.10/kexec/arch/ppc/kexec-ppc.h
+@@ -42,7 +42,7 @@ void dol_ppc_usage(void);
+ * During inital setup the kernel does not map the whole memory but a part of
+ * it. On Book-E that is 64MiB, 601 24MiB or 256MiB (if possible).
+ */
+-#define KERNEL_ACCESS_TOP (24 * 1024 * 1024)
++#define KERNEL_ACCESS_TOP (36 * 1024 * 1024)
+
+ /* boot block version 17 as defined by the linux kernel */
+ struct bootblock {
diff --git a/external/poky/meta/recipes-kernel/kexec/kexec-tools/0010-kexec-ARM-Fix-add_buffer_phys_virt-align-issue.patch b/external/poky/meta/recipes-kernel/kexec/kexec-tools/0010-kexec-ARM-Fix-add_buffer_phys_virt-align-issue.patch
new file mode 100644
index 00000000..6c6c66d8
--- /dev/null
+++ b/external/poky/meta/recipes-kernel/kexec/kexec-tools/0010-kexec-ARM-Fix-add_buffer_phys_virt-align-issue.patch
@@ -0,0 +1,52 @@
+From 78e497fb69950665e639cfab8f4fb50cc404a1eb Mon Sep 17 00:00:00 2001
+From: Haiqing Bai <Haiqing.Bai@windriver.com>
+Date: Mon, 9 Jan 2017 15:26:29 +0800
+Subject: [PATCH] kexec: ARM: Fix add_buffer_phys_virt() align issue
+
+When "CONFIG_ARM_LPAE" is enabled,3 level page table
+is used by MMU, the "SECTION_SIZE" is defined with
+(1 << 21), but 'add_buffer_phys_virt()' hardcode this
+to (1 << 20).
+
+Upstream-Status: Pending
+
+Suggested-By:fredrik.markstrom@gmail.com
+Signed-off-by: Haiqing Bai <Haiqing.Bai@windriver.com>
+---
+ kexec/arch/arm/crashdump-arm.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/kexec/arch/arm/crashdump-arm.c b/kexec/arch/arm/crashdump-arm.c
+index 245c21a..12139c3 100644
+--- a/kexec/arch/arm/crashdump-arm.c
++++ b/kexec/arch/arm/crashdump-arm.c
+@@ -240,6 +240,7 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline)
+ void *buf;
+ int err;
+ int last_ranges;
++ unsigned short align_bit_shift = 20;
+
+ /*
+ * First fetch all the memory (RAM) ranges that we are going to pass to
+@@ -281,6 +282,7 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline)
+
+ /* for support LPAE enabled kernel*/
+ elf_info.class = ELFCLASS64;
++ align_bit_shift = 21;
+
+ err = crash_create_elf64_headers(info, &elf_info,
+ usablemem_rgns.ranges,
+@@ -302,8 +304,9 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline)
+ * 1MB) so that available memory passed in kernel command line will be
+ * aligned to 1MB. This is because kernel create_mapping() wants memory
+ * regions to be aligned to SECTION_SIZE.
++ * The SECTION_SIZE of LPAE kernel is '1UL << 21' defined in pgtable-3level.h
+ */
+- elfcorehdr = add_buffer_phys_virt(info, buf, bufsz, bufsz, 1 << 20,
++ elfcorehdr = add_buffer_phys_virt(info, buf, bufsz, bufsz, 1 << align_bit_shift,
+ crash_kernel_mem.start,
+ crash_kernel_mem.end, -1, 0);
+
+--
+1.9.1
+
diff --git a/external/poky/meta/recipes-kernel/kexec/kexec-tools/kdump b/external/poky/meta/recipes-kernel/kexec/kexec-tools/kdump
new file mode 100755
index 00000000..69e3cafe
--- /dev/null
+++ b/external/poky/meta/recipes-kernel/kexec/kexec-tools/kdump
@@ -0,0 +1,145 @@
+#! /bin/sh
+#
+# kdump
+#
+# Description: The kdump script provides the support:
+# 1. Load a kdump kernel image into memory;
+# 2. Copy away vmcore when system panic.
+#
+
+#default
+KEXEC=/usr/sbin/kexec
+KEXEC_ARGS="-p"
+
+MAKEDUMPFILE=/usr/bin/makedumpfile
+MAKEDUMPFILE_ARGS="-E -d 1"
+
+LOGGER="logger -p info -t kdump"
+
+if [ -f /etc/sysconfig/kdump.conf ]; then
+ . /etc/sysconfig/kdump.conf
+else
+ echo "no /etc/sysconfig/kdump.conf"
+ exit 1;
+fi
+
+do_check()
+{
+ #check makedumpfile
+ if [ ! -e ${MAKEDUMPFILE} -o ! -x ${MAKEDUMPFILE} ] ;then
+ echo "No makedumpfile found."
+ exit 0
+ fi
+
+ #check kexec
+ if [ ! -e ${KEXEC} -o ! -x ${KEXEC} ] ;then
+ echo "No kexec found."
+ exit 0
+ fi
+
+ #check whether kdump kernel image exists on the system
+ if [ -z "${KDUMP_KIMAGE}" -o ! -f "${KDUMP_KIMAGE}" ]; then
+ echo "No kdump kernel image found."
+ exit 0
+ fi
+
+ if [ "${KDUMP_CMDLINE}"x = "x" ] ; then
+ echo "KDUMP_CMDLINE is not configured"
+ exit 0
+ fi
+}
+
+do_save_vmcore()
+{
+ if [ ${KDUMP_VMCORE_PATH}x = x ]; then
+ KDUMP_VMCORE_PATH="/var/crash/`date +"%Y-%m-%d"`"
+ fi
+
+ mkdir -p ${KDUMP_VMCORE_PATH}
+ echo "Saving a vmcore to ${KDUMP_VMCORE_PATH}."
+
+ ${MAKEDUMPFILE} ${MAKEDUMPFILE_ARGS} /proc/vmcore ${KDUMP_VMCORE_PATH}/vmcore-"`date +"%H:%M:%S"`"
+# cp --sparse=always /proc/vmcore ${KDUMP_VMCORE_PATH}/vmcore-"`date +"%H:%M:%S"`"
+ rc=$?
+ if [ ${rc} == 0 ]; then
+ ${LOGGER} "Saved a vmcore to ${KDUMP_VMCORE_PATH}."
+ else
+ ${LOGGER} "Failed to save vmcore!"
+ fi
+ return ${rc}
+}
+
+do_start()
+{
+ #check file
+ do_check
+
+ #check whether the running kernel supports kdump.
+ if [ ! -e /sys/kernel/kexec_crash_loaded ]; then
+ echo "Kdump isn't supported on the running kernel!!!"
+ ${LOGGER} "Kdump isn't supported on the running kernel!!!"
+ return 1
+ fi
+
+ #check whether kdump kernel image has been loaded
+ rc=`cat /sys/kernel/kexec_crash_loaded`
+ if [ ${rc} != 0 ]; then
+ echo "Kdump is already running.";
+ ${LOGGER} "Kdump is already running."
+ return 0
+ fi
+
+ #check the running kernel cmdline option,insure "crashkernel=" always set.
+ grep -q crashkernel= /proc/cmdline
+ if [ $? != 0 ]; then
+ echo "Kdump isn't supported on the running kernel,please check boot option!!!"
+ ${LOGGER} "Kdump isn't supported on the running kernel,please check boot option!!!"
+ return 1
+ fi
+
+ #Load the kdump kernel image
+ ${KEXEC} ${KEXEC_ARGS} "${KDUMP_KIMAGE}" --append="${KDUMP_CMDLINE}"
+ if [ $? != 0 ]; then
+ echo "Failed to load kdump kernel!"
+ ${LOGGER} "Failed to load kdump kernel!"
+ return 1
+ fi
+
+ echo "Kdump started up."
+ ${LOGGER} "Kdump started up."
+}
+
+do_stop()
+{
+ ${KEXEC} -p -u 2>/dev/null
+ if [ $? == 0 ]; then
+ echo "Kdump has been stopped."
+ ${LOGGER} "Kdump has been stopped."
+ else
+ echo "Failed to stop kdump!"
+ ${LOGGER} "Failed to stop kdump!"
+ fi
+}
+
+case "$1" in
+ start)
+ if [ -s /proc/vmcore ]; then
+ do_save_vmcore
+ reboot
+ else
+ do_start
+ fi
+ ;;
+ restart)
+ do_stop
+ do_start
+ ;;
+ stop)
+ do_stop
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|restart}"
+ exit 1
+esac
+
+exit $?
diff --git a/external/poky/meta/recipes-kernel/kexec/kexec-tools/kdump.conf b/external/poky/meta/recipes-kernel/kexec/kexec-tools/kdump.conf
new file mode 100644
index 00000000..38190d20
--- /dev/null
+++ b/external/poky/meta/recipes-kernel/kexec/kexec-tools/kdump.conf
@@ -0,0 +1,14 @@
+#the kdump kernel version string.
+#KDUMP_KVER="`uname -r`"
+
+#this will be passed to the kdump kernel as kdump kernel command line
+#KDUMP_CMDLINE="`cat /proc/cmdline`"
+
+#the kernel image for kdump
+#KDUMP_KIMAGE="/boot/bzImage-${KDUMP_KVER}"
+
+#Where to save the vmcore
+#KDUMP_VMCORE_PATH="/var/crash/`date +"%Y-%m-%d"`"
+
+#the arguments to makedumpfile
+MAKEDUMPFILE_ARGS="--dump-dmesg -x /boot/vmlinux-`uname -r`"
diff --git a/external/poky/meta/recipes-kernel/kexec/kexec-tools/kdump.service b/external/poky/meta/recipes-kernel/kexec/kexec-tools/kdump.service
new file mode 100644
index 00000000..b4a2c061
--- /dev/null
+++ b/external/poky/meta/recipes-kernel/kexec/kexec-tools/kdump.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Reboot and dump vmcore via kexec
+DefaultDependencies=no
+Requires=sysinit.target
+After=sysinit.target
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=@LIBEXECDIR@/kdump-helper start
+ExecStop=@LIBEXECDIR@/kdump-helper stop
+
+[Install]
+WantedBy=multi-user.target
diff --git a/external/poky/meta/recipes-kernel/kexec/kexec-tools/kexec-x32.patch b/external/poky/meta/recipes-kernel/kexec/kexec-tools/kexec-x32.patch
new file mode 100644
index 00000000..26d18eb6
--- /dev/null
+++ b/external/poky/meta/recipes-kernel/kexec/kexec-tools/kexec-x32.patch
@@ -0,0 +1,88 @@
+x86_64: Add support to build kexec-tools with x32 ABI
+
+Summary of changes,
+
+configure.ac: Add test for detect x32 ABI.
+purgatory/arch/x86_64/Makefile: Not use mcmodel large when
+ x32 ABI is set.
+kexec/arch/x86_64/kexec-elf-rel-x86_64.c: When x32 ABI is set
+ use ELFCLASS32 instead of ELFCLASS64.
+kexec/kexec-syscall.h: Add correct syscall number for x32 ABI.
+
+Upstream-Status: Submitted
+
+Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
+Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
+
+---
+ configure.ac | 9 +++++++++
+ kexec/arch/x86_64/kexec-elf-rel-x86_64.c | 4 ++++
+ kexec/kexec-syscall.h | 4 ++++
+ purgatory/arch/x86_64/Makefile | 4 +++-
+ 4 files changed, 20 insertions(+), 1 deletion(-)
+
+Index: kexec-tools-2.0.10/configure.ac
+===================================================================
+--- kexec-tools-2.0.10.orig/configure.ac
++++ kexec-tools-2.0.10/configure.ac
+@@ -56,6 +56,15 @@ case $target_cpu in
+ ;;
+ ia64|x86_64|alpha|m68k )
+ ARCH="$target_cpu"
++
++ dnl ---Test for x32 ABI in x86_64
++ if test "x$ARCH" = "xx86_64" ; then
++ AC_EGREP_CPP(x32_test,
++ [#if defined(__x86_64__) && defined (__ILP32__)
++ x32_test
++ #endif
++ ], SUBARCH='x32', SUBARCH='64')
++ fi
+ ;;
+ * )
+ AC_MSG_ERROR([unsupported architecture $target_cpu])
+Index: kexec-tools-2.0.10/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
+===================================================================
+--- kexec-tools-2.0.10.orig/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
++++ kexec-tools-2.0.10/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
+@@ -8,7 +8,11 @@ int machine_verify_elf_rel(struct mem_eh
+ if (ehdr->ei_data != ELFDATA2LSB) {
+ return 0;
+ }
++#ifdef __ILP32__
++ if (ehdr->ei_class != ELFCLASS32) {
++#else
+ if (ehdr->ei_class != ELFCLASS64) {
++#endif
+ return 0;
+ }
+ if (ehdr->e_machine != EM_X86_64) {
+Index: kexec-tools-2.0.10/kexec/kexec-syscall.h
+===================================================================
+--- kexec-tools-2.0.10.orig/kexec/kexec-syscall.h
++++ kexec-tools-2.0.10/kexec/kexec-syscall.h
+@@ -31,8 +31,12 @@
+ #define __NR_kexec_load 268
+ #endif
+ #ifdef __x86_64__
++#ifdef __ILP32__
++#define __NR_kexec_load 528
++#else
+ #define __NR_kexec_load 246
+ #endif
++#endif
+ #ifdef __s390x__
+ #define __NR_kexec_load 277
+ #endif
+Index: kexec-tools-2.0.10/purgatory/arch/x86_64/Makefile
+===================================================================
+--- kexec-tools-2.0.10.orig/purgatory/arch/x86_64/Makefile
++++ kexec-tools-2.0.10/purgatory/arch/x86_64/Makefile
+@@ -23,4 +23,6 @@ x86_64_PURGATORY_SRCS += purgatory/arch/
+ x86_64_PURGATORY_SRCS += purgatory/arch/i386/vga.c
+ x86_64_PURGATORY_SRCS += purgatory/arch/i386/pic.c
+
+-x86_64_PURGATORY_EXTRA_CFLAGS = -mcmodel=large
++ifeq ($(SUBARCH),64)
++ x86_64_PURGATORY_EXTRA_CFLAGS = -mcmodel=large
++endif