Squashed 'import-layers/meta-virtualization/' content from commit c4a1711

Change-Id: I42132e4f0aef12ec265e74d95f489a6409e22f46
git-subtree-dir: import-layers/meta-virtualization
git-subtree-split: c4a1711dd31659b027c70c07e4ef6da98591ac95
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/import-layers/meta-virtualization/recipes-extended/xen/xen-arch.inc b/import-layers/meta-virtualization/recipes-extended/xen/xen-arch.inc
new file mode 100644
index 0000000..844d47d
--- /dev/null
+++ b/import-layers/meta-virtualization/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', True).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:
+        return "INVALID"
+