summaryrefslogtreecommitdiffstats
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'):
151 raise ValueError("{0}: {1}".format(value, os.strerror(errno.ENOENT))) 151 raise ValueError("{0}: {1}".format(value, os.strerror(errno.ENOENT)))
152 152
153 return value 153 return value
154
155def is_x86(arch):
156 """
157 Check whether arch is x86 or x86_64
158 """
159 if arch.startswith('x86_') or re.match('i.*86', arch):
160 return True
161 else:
162 return False
163
164def qemu_use_kvm(kvm, target_arch):
165 """
166 Enable kvm if target_arch == build_arch or both of them are x86 archs.
167 """
168
169 use_kvm = False
170 if kvm and boolean(kvm):
171 build_arch = os.uname()[4]
172 if is_x86(build_arch) and is_x86(target_arch):
173 use_kvm = True
174 elif build_arch == target_arch:
175 use_kvm = True
176 return use_kvm
177