[packages/kexec-tools] - added x32 patch, build also on x32 (without xen for now); release 2

qboosh qboosh at pld-linux.org
Thu Mar 31 16:09:10 CEST 2016


commit ce7373cd8618a281b389c52fb5d681733ecff640
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Thu Mar 31 16:09:06 2016 +0200

    - added x32 patch, build also on x32 (without xen for now); release 2

 kexec-tools-x32.patch | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++
 kexec-tools.spec      | 13 ++++++--
 2 files changed, 101 insertions(+), 3 deletions(-)
---
diff --git a/kexec-tools.spec b/kexec-tools.spec
index f7ae401..1275699 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -4,11 +4,15 @@
 %bcond_with	booke		# [PPC] build for BookE
 %bcond_with	gamecube	# [PPC] build for GameCube
 
+%ifarch x32
+# Xen not (yet?) available
+%undefine	with_xen
+%endif
 Summary:	Tool for starting new kernel without reboot
 Summary(pl.UTF-8):	Narzędzie pozwalające załadować nowe jądro bez konieczności restartu
 Name:		kexec-tools
 Version:	2.0.12
-Release:	1
+Release:	2
 License:	GPL v2
 Group:		Applications/System
 Source0:	https://www.kernel.org/pub/linux/utils/kernel/kexec/%{name}-%{version}.tar.xz
@@ -17,6 +21,8 @@ Source1:	kexec.init
 Source2:	kexec.sysconfig
 Patch0:		%{name}-format.patch
 Patch1:		%{name}-xen.patch
+# from http://patchwork.openembedded.org/patch/90971/raw/
+Patch2:		%{name}-x32.patch
 URL:		https://www.kernel.org/pub/linux/utils/kernel/kexec/
 BuildRequires:	autoconf >= 2.50
 BuildRequires:	rpmbuild(macros) >= 1.228
@@ -27,7 +33,7 @@ BuildRequires:	xz-devel
 BuildRequires:	zlib-devel
 Requires(post,preun):	/sbin/chkconfig
 Requires:	rc-scripts >= 0.4.0.9
-ExclusiveArch:	%{ix86} %{x8664} alpha arm cris ia64 m68k mips ppc ppc64 s390 s390x sh
+ExclusiveArch:	%{ix86} %{x8664} x32 alpha arm cris ia64 m68k mips ppc ppc64 s390 s390x sh
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %define		_sbindir	/sbin
@@ -48,6 +54,7 @@ działać na każdej architekturze.
 %setup -q
 %patch0 -p1
 %patch1 -p1
+%patch2 -p1
 
 %build
 %{__autoconf}
@@ -91,7 +98,7 @@ fi
 %{_mandir}/man8/kdump.8*
 %{_mandir}/man8/kexec.8*
 %{_mandir}/man8/vmcore-dmesg.8*
-%ifarch %{ix86}
+%ifarch %{ix86} x32
 %dir %{_libdir}/kexec-tools
 # what is this anyway, is it needed on other arches?
 %attr(755,root,root) %{_libdir}/kexec-tools/kexec_test
diff --git a/kexec-tools-x32.patch b/kexec-tools-x32.patch
new file mode 100644
index 0000000..6e6bfc0
--- /dev/null
+++ b/kexec-tools-x32.patch
@@ -0,0 +1,91 @@
+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 at linux.intel.com>
+Signed-off-by: Mariano Lopez <mariano.lopez at 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(-)
+
+diff --git a/configure.ac b/configure.ac
+index c410e90..1ecadd5 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -52,6 +52,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])
+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 c795037..06db7f0 100644
+--- a/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
++++ b/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
+@@ -8,7 +8,11 @@ int machine_verify_elf_rel(struct mem_ehdr *ehdr)
+ 	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) {
+diff --git a/kexec/kexec-syscall.h b/kexec/kexec-syscall.h
+index ce2e20b..cab5535 100644
+--- a/kexec/kexec-syscall.h
++++ b/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
+diff --git a/purgatory/arch/x86_64/Makefile b/purgatory/arch/x86_64/Makefile
+index 7300937..4af11e4 100644
+--- a/purgatory/arch/x86_64/Makefile
++++ b/purgatory/arch/x86_64/Makefile
+@@ -23,4 +23,6 @@ x86_64_PURGATORY_SRCS += purgatory/arch/i386/console-x86.c
+ 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
+-- 
+1.8.4.5
+
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/kexec-tools.git/commitdiff/ce7373cd8618a281b389c52fb5d681733ecff640



More information about the pld-cvs-commit mailing list