summaryrefslogtreecommitdiffstats
path: root/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/kexec-x32.patch
diff options
context:
space:
mode:
authorAndrea Adami <andrea.adami@gmail.com>2018-08-31 17:31:50 +0200
committerKhem Raj <raj.khem@gmail.com>2018-08-31 09:42:01 -0700
commit28d225b58148a3f90fe90ffb6ba9122e824d49e7 (patch)
tree2eeba1afd24eb7370b59a26114c3f177fa65a080 /meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/kexec-x32.patch
parentc56b2fc960eded6969ee5bc2f684f73376ccd260 (diff)
downloadmeta-openembedded-28d225b58148a3f90fe90ffb6ba9122e824d49e7.tar.gz
kexec-tools-klibc: add kexec-x32.patch from oe-core
This is the last patch borrowed from the actual oe-core recipe. Signed-off-by: Andrea Adami <andrea.adami@gmail.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/kexec-x32.patch')
-rw-r--r--meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/kexec-x32.patch88
1 files changed, 88 insertions, 0 deletions
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/kexec-x32.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/kexec-x32.patch
new file mode 100644
index 000000000..26d18eb6f
--- /dev/null
+++ b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/kexec-x32.patch
@@ -0,0 +1,88 @@
1x86_64: Add support to build kexec-tools with x32 ABI
2
3Summary of changes,
4
5configure.ac: Add test for detect x32 ABI.
6purgatory/arch/x86_64/Makefile: Not use mcmodel large when
7 x32 ABI is set.
8kexec/arch/x86_64/kexec-elf-rel-x86_64.c: When x32 ABI is set
9 use ELFCLASS32 instead of ELFCLASS64.
10kexec/kexec-syscall.h: Add correct syscall number for x32 ABI.
11
12Upstream-Status: Submitted
13
14Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
15Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
16
17---
18 configure.ac | 9 +++++++++
19 kexec/arch/x86_64/kexec-elf-rel-x86_64.c | 4 ++++
20 kexec/kexec-syscall.h | 4 ++++
21 purgatory/arch/x86_64/Makefile | 4 +++-
22 4 files changed, 20 insertions(+), 1 deletion(-)
23
24Index: kexec-tools-2.0.10/configure.ac
25===================================================================
26--- kexec-tools-2.0.10.orig/configure.ac
27+++ kexec-tools-2.0.10/configure.ac
28@@ -56,6 +56,15 @@ case $target_cpu in
29 ;;
30 ia64|x86_64|alpha|m68k )
31 ARCH="$target_cpu"
32+
33+ dnl ---Test for x32 ABI in x86_64
34+ if test "x$ARCH" = "xx86_64" ; then
35+ AC_EGREP_CPP(x32_test,
36+ [#if defined(__x86_64__) && defined (__ILP32__)
37+ x32_test
38+ #endif
39+ ], SUBARCH='x32', SUBARCH='64')
40+ fi
41 ;;
42 * )
43 AC_MSG_ERROR([unsupported architecture $target_cpu])
44Index: kexec-tools-2.0.10/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
45===================================================================
46--- kexec-tools-2.0.10.orig/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
47+++ kexec-tools-2.0.10/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
48@@ -8,7 +8,11 @@ int machine_verify_elf_rel(struct mem_eh
49 if (ehdr->ei_data != ELFDATA2LSB) {
50 return 0;
51 }
52+#ifdef __ILP32__
53+ if (ehdr->ei_class != ELFCLASS32) {
54+#else
55 if (ehdr->ei_class != ELFCLASS64) {
56+#endif
57 return 0;
58 }
59 if (ehdr->e_machine != EM_X86_64) {
60Index: kexec-tools-2.0.10/kexec/kexec-syscall.h
61===================================================================
62--- kexec-tools-2.0.10.orig/kexec/kexec-syscall.h
63+++ kexec-tools-2.0.10/kexec/kexec-syscall.h
64@@ -31,8 +31,12 @@
65 #define __NR_kexec_load 268
66 #endif
67 #ifdef __x86_64__
68+#ifdef __ILP32__
69+#define __NR_kexec_load 528
70+#else
71 #define __NR_kexec_load 246
72 #endif
73+#endif
74 #ifdef __s390x__
75 #define __NR_kexec_load 277
76 #endif
77Index: kexec-tools-2.0.10/purgatory/arch/x86_64/Makefile
78===================================================================
79--- kexec-tools-2.0.10.orig/purgatory/arch/x86_64/Makefile
80+++ kexec-tools-2.0.10/purgatory/arch/x86_64/Makefile
81@@ -23,4 +23,6 @@ x86_64_PURGATORY_SRCS += purgatory/arch/
82 x86_64_PURGATORY_SRCS += purgatory/arch/i386/vga.c
83 x86_64_PURGATORY_SRCS += purgatory/arch/i386/pic.c
84
85-x86_64_PURGATORY_EXTRA_CFLAGS = -mcmodel=large
86+ifeq ($(SUBARCH),64)
87+ x86_64_PURGATORY_EXTRA_CFLAGS = -mcmodel=large
88+endif