[xen] build a 64-bit hypervisor on ix86

myoung myoung at fedoraproject.org
Sat Jul 20 12:17:24 UTC 2013


commit c67a8f8610b1513e1cd6db7bea80cadc3cdff2da
Author: Michael Young <m.a.young at durham.ac.uk>
Date:   Sat Jul 20 13:14:21 2013 +0100

    build a 64-bit hypervisor on ix86

 xen.64.bit.hyp.on.ix86.patch |   36 ++++++++++++++++++++++++++++++++++++
 xen.spec                     |   34 ++++++++++++++++++++++++++++------
 2 files changed, 64 insertions(+), 6 deletions(-)
---
diff --git a/xen.64.bit.hyp.on.ix86.patch b/xen.64.bit.hyp.on.ix86.patch
new file mode 100644
index 0000000..101130d
--- /dev/null
+++ b/xen.64.bit.hyp.on.ix86.patch
@@ -0,0 +1,36 @@
+--- xen-4.3.0/xen/Makefile.orig	2013-07-19 21:34:24.226148328 +0100
++++ xen-4.3.0/xen/Makefile	2013-07-19 21:46:54.603767317 +0100
+@@ -15,6 +15,9 @@
+ EFI_MOUNTPOINT ?= /boot/efi
+ EFI_VENDOR=fedora
+ LD_EFI ?= $(LD)
++ifeq ($(XEN_TARGET_ARCH),x86_32)
++CFLAGS := $(shell echo $(CFLAGS) | sed -e 's/-m[a-z0-9=]* //g')
++endif
+ 
+ .PHONY: default
+ default: build
+@@ -25,9 +28,9 @@
+ .PHONY: build install uninstall clean distclean cscope TAGS tags MAP gtags
+ build install uninstall debug clean distclean cscope TAGS tags MAP gtags::
+ ifneq ($(XEN_TARGET_ARCH),x86_32)
+-	$(MAKE) -f Rules.mk _$@
++	$(MAKE) CCX=$(CC) -f Rules.mk _$@
+ else
+-	echo "*** Xen x86/32 target no longer supported!"
++	$(MAKE) CCX=/usr/bin/x86_64-linux-gnu-gcc XEN_TARGET_ARCH=x86_64 -f Rules.mk _$@
+ endif
+ 
+ .PHONY: _build
+@@ -99,9 +102,9 @@
+ 	$(MAKE) -f $(BASEDIR)/Rules.mk include/xen/compile.h
+ 	[ -e include/asm ] || ln -sf asm-$(TARGET_ARCH) include/asm
+ 	$(MAKE) -f $(BASEDIR)/Rules.mk -C include
+-	$(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) asm-offsets.s
++	$(MAKE) CC=$(CCX) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) asm-offsets.s
+ 	$(MAKE) -f $(BASEDIR)/Rules.mk include/asm-$(TARGET_ARCH)/asm-offsets.h
+-	$(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) $(TARGET)
++	$(MAKE) CC=$(CCX) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) $(TARGET)
+ 
+ # drivers/char/console.o contains static banner/compile info. Blow it away.
+ # Don't refresh these files during e.g., 'sudo make install'
diff --git a/xen.spec b/xen.spec
index e03119a..108dd0b 100644
--- a/xen.spec
+++ b/xen.spec
@@ -7,10 +7,21 @@
 # or required packages are missing
 %define with_xsm  %{?_without_xsm: 0} %{?!_without_xsm: 1}
 %define build_xsm %(test -x %{_bindir}/checkpolicy && test -x %{_bindir}/m4 && echo %{with_xsm} || echo 0)
-# no point in trying to build xsm on ix86
-%ifarch %{ix86}
+# cross compile 64-bit hypervisor on ix86 unless rpmbuild was run
+#	with --without crosshyp
+%define build_crosshyp %{?_without_crosshyp: 0} %{?!_without_crosshyp: 1}
+%ifnarch %{ix86}
+%define build_crosshyp 0
+%define build_hyp 1
+%else
+%if %build_crosshyp
+%define build_hyp 1
+%else
+%define build_hyp 0
+# no point in trying to build xsm on ix86 without a hypervisor
 %define build_xsm 0
 %endif
+%endif
 # build an efi boot image (where supported) unless rpmbuild was run with
 # --without efi
 %define build_efi %{?_without_efi: 0} %{?!_without_efi: 1}
@@ -35,7 +46,7 @@
 Summary: Xen is a virtual machine monitor
 Name:    xen
 Version: 4.3.0
-Release: 1%{?dist}
+Release: 2%{?dist}
 Group:   Development/Libraries
 License: GPLv2+ and LGPLv2+ and BSD
 URL:     http://xen.org/
@@ -85,6 +96,7 @@ Patch17: xen.fedora.efi.build.patch
 Patch18: xen.fedora19.buildfix.patch
 Patch19: xen.pygrubtitlefix.patch
 Patch20: xen.xsm.enable.patch
+Patch21: xen.64.bit.hyp.on.ix86.patch
 
 Patch100: xen-configure-xend.patch
 
@@ -126,6 +138,10 @@ BuildRequires: yajl-devel wget
 # xsm policy file needs needs checkpolicy and m4
 BuildRequires: checkpolicy m4
 %endif
+%if %build_crosshyp
+# cross compiler for building 64-bit hypervisor on ix86
+BuildRequires: gcc-x86_64-linux-gnu
+%endif
 Requires: bridge-utils
 Requires: python-lxml
 Requires: udev >= 059
@@ -258,6 +274,9 @@ manage Xen virtual machines.
 %if %build_xsm
 %patch20 -p1
 %endif
+%if %build_crosshyp
+%patch21 -p1
+%endif
 
 %patch100 -p1
 
@@ -318,7 +337,7 @@ rm -rf %{buildroot}/usr/*-xen-elf
 # hypervisor symlinks
 rm -rf %{buildroot}/boot/xen-4.0.gz
 rm -rf %{buildroot}/boot/xen-4.gz
-%ifarch %{ix86}
+%if !%build_hyp
 rm -rf %{buildroot}/boot
 %endif
 
@@ -506,7 +525,7 @@ fi
 %post libs -p /sbin/ldconfig
 %postun libs -p /sbin/ldconfig
 
-%ifarch x86_64
+%if %build_hyp
 %post hypervisor
 if [ $1 == 1 -a -f /sbin/grub2-mkconfig -a -f /boot/grub2/grub.cfg ]; then
   /sbin/grub2-mkconfig -o /boot/grub2/grub.cfg
@@ -718,7 +737,7 @@ rm -rf %{buildroot}
 %dir %attr(0700,root,root) %{_localstatedir}/log/xen/console
 
 %files hypervisor
-%ifnarch %{ix86}
+%if %build_hyp
 %defattr(-,root,root)
 /boot/xen-syms-*
 /boot/xen-*.gz
@@ -770,6 +789,9 @@ rm -rf %{buildroot}
 %endif
 
 %changelog
+* Sat Jul 20 2013 Michael Young <m.a.young at durham.ac.uk> - 4.3.0-2
+- build a 64-bit hypervisor on ix86
+
 * Tue Jul 16 2013 Michael Young <m.a.young at durham.ac.uk> - 4.3.0-1
 - update to xen-4.3.0
 - rebase xen.use.fedora.ipxe.patch


More information about the scm-commits mailing list