diff options
-rw-r--r-- | meta/classes/testimage.bbclass | 8 | ||||
-rw-r--r-- | meta/lib/oe/types.py | 24 | ||||
-rw-r--r-- | meta/lib/oeqa/targetcontrol.py | 8 |
3 files changed, 26 insertions, 14 deletions
diff --git a/meta/classes/testimage.bbclass b/meta/classes/testimage.bbclass index 3c2209af91..73cd375dcb 100644 --- a/meta/classes/testimage.bbclass +++ b/meta/classes/testimage.bbclass | |||
@@ -231,13 +231,7 @@ def testimage_main(d): | |||
231 | boottime = int(d.getVar("TEST_QEMUBOOT_TIMEOUT")) | 231 | boottime = int(d.getVar("TEST_QEMUBOOT_TIMEOUT")) |
232 | 232 | ||
233 | # Get use_kvm | 233 | # Get use_kvm |
234 | qemu_use_kvm = d.getVar("QEMU_USE_KVM") | 234 | kvm = oe.types.qemu_use_kvm(d.getVar('QEMU_USE_KVM'), d.getVar('TARGET_ARCH')) |
235 | if qemu_use_kvm and \ | ||
236 | (d.getVar('MACHINE') in qemu_use_kvm.split() or \ | ||
237 | oe.types.boolean(qemu_use_kvm) and 'x86' in machine): | ||
238 | kvm = True | ||
239 | else: | ||
240 | kvm = False | ||
241 | 235 | ||
242 | slirp = False | 236 | slirp = False |
243 | if d.getVar("QEMU_USE_SLIRP"): | 237 | if d.getVar("QEMU_USE_SLIRP"): |
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 | |||
diff --git a/meta/lib/oeqa/targetcontrol.py b/meta/lib/oeqa/targetcontrol.py index 02ea1c037c..97d67adbde 100644 --- a/meta/lib/oeqa/targetcontrol.py +++ b/meta/lib/oeqa/targetcontrol.py | |||
@@ -107,13 +107,7 @@ class QemuTarget(BaseTarget): | |||
107 | dump_target_cmds = d.getVar("testimage_dump_target") | 107 | dump_target_cmds = d.getVar("testimage_dump_target") |
108 | dump_host_cmds = d.getVar("testimage_dump_host") | 108 | dump_host_cmds = d.getVar("testimage_dump_host") |
109 | dump_dir = d.getVar("TESTIMAGE_DUMP_DIR") | 109 | dump_dir = d.getVar("TESTIMAGE_DUMP_DIR") |
110 | qemu_use_kvm = d.getVar("QEMU_USE_KVM") | 110 | use_kvm = oe.types.qemu_use_kvm(d.getVar('QEMU_USE_KVM'), d.getVar('TARGET_ARCH')) |
111 | if qemu_use_kvm and \ | ||
112 | (oe.types.boolean(qemu_use_kvm) and "x86" in d.getVar("MACHINE") or \ | ||
113 | d.getVar("MACHINE") in qemu_use_kvm.split()): | ||
114 | use_kvm = True | ||
115 | else: | ||
116 | use_kvm = False | ||
117 | 111 | ||
118 | # Log QemuRunner log output to a file | 112 | # Log QemuRunner log output to a file |
119 | import oe.path | 113 | import oe.path |