summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel
diff options
context:
space:
mode:
authorMariano Lopez <mariano.lopez@linux.intel.com>2015-04-08 10:04:44 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-04-10 18:10:23 +0100
commit7ab461cc3ed0c1761d095fb423305424d1ed071e (patch)
treeb96e6e80379243a4ac326ff727d4330afe45dab7 /meta/recipes-kernel
parent66b39c841aa5b250d95c233afd2030127466eccd (diff)
downloadpoky-7ab461cc3ed0c1761d095fb423305424d1ed071e.tar.gz
kexec-tools: Add support for build with x32 ABI in x86_64
Add autoconf test for detect when build is x32 ABI this enables to test into purgatory Makefile to avoid use -mcmodel=large flag in CC. Add ELFCLASS read and syscall number into kexec, see patch. [YOCTO #7419] (From OE-Core rev: 7b75430c2e3ffedb9ef4198fabf259b757b9ce5a) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-kernel')
-rw-r--r--meta/recipes-kernel/kexec/kexec-tools/kexec-x32.patch113
-rw-r--r--meta/recipes-kernel/kexec/kexec-tools_2.0.9.bb3
2 files changed, 115 insertions, 1 deletions
diff --git a/meta/recipes-kernel/kexec/kexec-tools/kexec-x32.patch b/meta/recipes-kernel/kexec/kexec-tools/kexec-x32.patch
new file mode 100644
index 0000000000..0bd3264af7
--- /dev/null
+++ b/meta/recipes-kernel/kexec/kexec-tools/kexec-x32.patch
@@ -0,0 +1,113 @@
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
24diff --git a/configure.ac b/configure.ac
25index c410e90..1ecadd5 100644
26--- a/configure.ac
27+++ b/configure.ac
28@@ -52,6 +52,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])
44diff --git a/kexec/arch/x86_64/kexec-elf-rel-x86_64.c b/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
45index c795037..06db7f0 100644
46--- a/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
47+++ b/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
48@@ -8,7 +8,11 @@ int machine_verify_elf_rel(struct mem_ehdr *ehdr)
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) {
60diff --git a/kexec/kexec-syscall.h b/kexec/kexec-syscall.h
61index ce2e20b..cab5535 100644
62--- a/kexec/kexec-syscall.h
63+++ b/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
77diff --git a/purgatory/arch/x86_64/Makefile b/purgatory/arch/x86_64/Makefile
78index 7300937..4af11e4 100644
79--- a/purgatory/arch/x86_64/Makefile
80+++ b/purgatory/arch/x86_64/Makefile
81@@ -23,4 +23,6 @@ x86_64_PURGATORY_SRCS += purgatory/arch/i386/console-x86.c
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
89--
901.8.4.5
91
92diff --git a/configure.ac b/configure.ac
93index 1ecadd5..e0b5f78 100644
94--- a/configure.ac
95+++ b/configure.ac
96@@ -8,6 +8,7 @@ AC_INIT(kexec-tools, 2.0.10.git)
97 AC_CONFIG_AUX_DIR(./config)
98 AC_CONFIG_HEADERS([include/config.h])
99 AC_LANG(C)
100+AC_PROG_CC
101
102 AC_DEFINE_UNQUOTED(PACKAGE_DATE, "`date '+%d %B %Y'`",
103 [Define to the release date of this package])
104@@ -106,9 +107,6 @@ AC_ARG_WITH([booke],
105
106 dnl ---Programs
107 dnl To specify a different compiler, just 'export CC=/path/to/compiler'
108-
109-AC_PROG_CC
110-
111 if test "${build}" != "${host}" ; then
112 AC_CHECK_PROGS(BUILD_CC, [${build_alias}-gcc ${build}-gcc gcc])
113 else
diff --git a/meta/recipes-kernel/kexec/kexec-tools_2.0.9.bb b/meta/recipes-kernel/kexec/kexec-tools_2.0.9.bb
index c0c27279e4..36e4c15364 100644
--- a/meta/recipes-kernel/kexec/kexec-tools_2.0.9.bb
+++ b/meta/recipes-kernel/kexec/kexec-tools_2.0.9.bb
@@ -4,7 +4,8 @@ EXTRA_OECONF = " --with-zlib=yes"
4 4
5SRC_URI += "file://kexec-tools-Refine-kdump-device_tree-sort.patch \ 5SRC_URI += "file://kexec-tools-Refine-kdump-device_tree-sort.patch \
6 file://kexec-aarch64.patch \ 6 file://kexec-aarch64.patch \
7 " 7 file://kexec-x32.patch \
8 "
8 9
9SRC_URI[md5sum] = "4ecb7ab7ad9eb6ce413899bdb07a8426" 10SRC_URI[md5sum] = "4ecb7ab7ad9eb6ce413899bdb07a8426"
10SRC_URI[sha256sum] = "c2c6d204fe0911ebd304c40100163237feca4c5a854a2cca382ee36916a573d8" 11SRC_URI[sha256sum] = "c2c6d204fe0911ebd304c40100163237feca4c5a854a2cca382ee36916a573d8"