[meta-virtualization] [PATCH 02/14] xen: Add Build and Target architecture mapping

Nathan Rossi nathan.rossi at xilinx.com
Mon Feb 16 00:34:24 PST 2015


* Setup the XEN_TARGET_ARCH and XEN_COMPILE_ARCH based on the running
  environments TARGET_ARCH and BUILD_ARCH

Signed-off-by: Nathan Rossi <nathan.rossi at xilinx.com>
---
 recipes-extended/xen/xen-arch.inc | 18 ++++++++++++++++++
 recipes-extended/xen/xen.inc      |  8 +++++---
 2 files changed, 23 insertions(+), 3 deletions(-)
 create mode 100644 recipes-extended/xen/xen-arch.inc

diff --git a/recipes-extended/xen/xen-arch.inc b/recipes-extended/xen/xen-arch.inc
new file mode 100644
index 0000000..bcf9f54
--- /dev/null
+++ b/recipes-extended/xen/xen-arch.inc
@@ -0,0 +1,18 @@
+
+valid_xen_archs = " \
+        x86_64 x86_32 \
+        arm32 arm64 \
+        "
+
+def map_xen_arch(a, d):
+    import re
+    valid_archs = d.getVar('valid_xen_archs').split()
+
+    if   re.match("i.86", a):        return "x86_32"
+    elif re.match("x86.64", a):      return "x86_64"
+    elif re.match("arm.*", a):       return "arm32"
+    elif re.match("aarch64.*", a):   return "arm64"
+    elif a in valid_archs:           return a
+    else:
+        bb.error("cannot map '%s' to a xen architecture" % a)
+
diff --git a/recipes-extended/xen/xen.inc b/recipes-extended/xen/xen.inc
index ed902b2..9ab8351 100644
--- a/recipes-extended/xen/xen.inc
+++ b/recipes-extended/xen/xen.inc
@@ -10,6 +10,8 @@ COMPATIBLE_HOST = '(x86_64.*).*-linux'
 
 inherit autotools-brokensep gettext setuptools update-rc.d
 
+require xen-arch.inc
+
 PACKAGECONFIG ??= " \
     sdl \
     "
@@ -618,9 +620,9 @@ export HOST_SYS
 export STAGING_INCDIR
 export STAGING_LIBDIR
 
-# specify xen hypervisor to target x86_64 (x86_32 not supported)
-export XEN_TARGET_ARCH="x86_64"
-export XEN_COMPILE_ARCH="x86_64"
+# specify xen hypervisor to build/target
+export XEN_TARGET_ARCH = "${@map_xen_arch(d.getVar('TARGET_ARCH', True), d)}"
+export XEN_COMPILE_ARCH = "${@map_xen_arch(d.getVar('BUILD_ARCH', True), d)}"
 
 # hardcoded as Linux, as the only compatible hosts are Linux.
 export XEN_OS = "Linux"
-- 
2.1.1



More information about the meta-virtualization mailing list