aboutsummaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/types.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oe/types.py')
-rw-r--r--meta/lib/oe/types.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/meta/lib/oe/types.py b/meta/lib/oe/types.py
index 4ae58acfac..a830462336 100644
--- a/meta/lib/oe/types.py
+++ b/meta/lib/oe/types.py
@@ -151,3 +151,27 @@ def path(value, relativeto='', normalize='true', mustexist='false'):
raise ValueError("{0}: {1}".format(value, os.strerror(errno.ENOENT)))
return value
+
+def is_x86(arch):
+ """
+ Check whether arch is x86 or x86_64
+ """
+ if arch.startswith('x86_') or re.match('i.*86', arch):
+ return True
+ else:
+ return False
+
+def qemu_use_kvm(kvm, target_arch):
+ """
+ Enable kvm if target_arch == build_arch or both of them are x86 archs.
+ """
+
+ use_kvm = False
+ if kvm and boolean(kvm):
+ build_arch = os.uname()[4]
+ if is_x86(build_arch) and is_x86(target_arch):
+ use_kvm = True
+ elif build_arch == target_arch:
+ use_kvm = True
+ return use_kvm
+