aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-kernel/jailhouse/jailhouse-arch.inc
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-kernel/jailhouse/jailhouse-arch.inc')
-rw-r--r--recipes-kernel/jailhouse/jailhouse-arch.inc20
1 files changed, 20 insertions, 0 deletions
diff --git a/recipes-kernel/jailhouse/jailhouse-arch.inc b/recipes-kernel/jailhouse/jailhouse-arch.inc
new file mode 100644
index 00000000..e06ec231
--- /dev/null
+++ b/recipes-kernel/jailhouse/jailhouse-arch.inc
@@ -0,0 +1,20 @@
+# Set jailhouse architecture JH_ARCH variable
+#
+# return value must match one of architectures supported by jailhouse
+#
+valid_jh_archs = "x86 arm"
+
+def map_jh_arch(a, d):
+ import re
+
+ valid_jh_archs = d.getVar('valid_jh_archs', True).split()
+
+ if re.match('(i.86|athlon|x86.64)$', a): return 'x86'
+ elif re.match('armeb$', a): return 'arm'
+ elif re.match('aarch64$', a): return 'arm64'
+ elif re.match('aarch64_be$', a): return 'arm64'
+ elif a in valid_jh_archs: return a
+ else:
+ bb.error("cannot map '%s' to a jailhouse supported architecture" % a)
+
+export JH_ARCH = "${@map_jh_arch(d.getVar('TARGET_ARCH', True), d)}"