summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/testimage.bbclass8
-rw-r--r--meta/lib/oe/types.py24
-rw-r--r--meta/lib/oeqa/targetcontrol.py8
3 files changed, 26 insertions, 14 deletions
diff --git a/meta/classes/testimage.bbclass b/meta/classes/testimage.bbclass
index 11c2ddab98..b3ae54d6a4 100644
--- a/meta/classes/testimage.bbclass
+++ b/meta/classes/testimage.bbclass
@@ -238,13 +238,7 @@ def testimage_main(d):
238 boottime = int(d.getVar("TEST_QEMUBOOT_TIMEOUT")) 238 boottime = int(d.getVar("TEST_QEMUBOOT_TIMEOUT"))
239 239
240 # Get use_kvm 240 # Get use_kvm
241 qemu_use_kvm = d.getVar("QEMU_USE_KVM") 241 kvm = oe.types.qemu_use_kvm(d.getVar('QEMU_USE_KVM'), d.getVar('TARGET_ARCH'))
242 if qemu_use_kvm and \
243 (d.getVar('MACHINE') in qemu_use_kvm.split() or \
244 oe.types.boolean(qemu_use_kvm) and 'x86' in machine):
245 kvm = True
246 else:
247 kvm = False
248 242
249 # TODO: We use the current implementatin of qemu runner because of 243 # TODO: We use the current implementatin of qemu runner because of
250 # time constrains, qemu runner really needs a refactor too. 244 # time constrains, qemu runner really needs a refactor too.
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
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