diff options
Diffstat (limited to 'meta/lib/oe')
-rw-r--r-- | meta/lib/oe/types.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/meta/lib/oe/types.py b/meta/lib/oe/types.py index f4017130df..1eebba5a38 100644 --- a/meta/lib/oe/types.py +++ b/meta/lib/oe/types.py | |||
@@ -156,3 +156,27 @@ def path(value, relativeto='', normalize='true', mustexist='false'): | |||
156 | raise ValueError("{0}: {1}".format(value, os.strerror(errno.ENOENT))) | 156 | raise ValueError("{0}: {1}".format(value, os.strerror(errno.ENOENT))) |
157 | 157 | ||
158 | return value | 158 | return value |
159 | |||
160 | def is_x86(arch): | ||
161 | """ | ||
162 | Check whether arch is x86 or x86_64 | ||
163 | """ | ||
164 | if arch.startswith('x86_') or re.match('i.*86', arch): | ||
165 | return True | ||
166 | else: | ||
167 | return False | ||
168 | |||
169 | def qemu_use_kvm(kvm, target_arch): | ||
170 | """ | ||
171 | Enable kvm if target_arch == build_arch or both of them are x86 archs. | ||
172 | """ | ||
173 | |||
174 | use_kvm = False | ||
175 | if kvm and boolean(kvm): | ||
176 | build_arch = os.uname()[4] | ||
177 | if is_x86(build_arch) and is_x86(target_arch): | ||
178 | use_kvm = True | ||
179 | elif build_arch == target_arch: | ||
180 | use_kvm = True | ||
181 | return use_kvm | ||
182 | |||