diff options
author | Robert Yang <liezhi.yang@windriver.com> | 2019-01-04 15:15:43 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-02-25 22:27:45 +0000 |
commit | 122d638e2296fc1654e116229a2432e04b1a6e01 (patch) | |
tree | b7720b1671037a4c6d2f811005d21bfa60deca28 /meta/lib | |
parent | 71bcf6c051f559fd9910b5037f4728ae0c10c773 (diff) | |
download | poky-122d638e2296fc1654e116229a2432e04b1a6e01.tar.gz |
oeqa: Fix for QEMU_USE_KVM
Fixed:
MACHINE = "qemux86"
QEMU_USE_KVM = "qemux86"
IMAGE_CLASSES += "testimage"
$ oe-selftest -r runqemu.RunqemuTests.test_boot_rootfs
[snip]
File "/buildarea1/lyang1/poky/meta/lib/oe/types.py", line 122, in boolean
raise ValueError("Invalid boolean value '%s'" % value)
ValueError: Invalid boolean value 'qemux86'
Now QEMU_USE_KVM can only be boolean, can not contain MACHINE any more, kvm
will be enabled if target_arch == build_arch or both of them are x86 archs.
(From OE-Core rev: 7c1a8a624cad8d967635c6cb5f99cf655bde3d44)
(From OE-Core rev: de1b80f7f7b787f6b5b62c576ca6c62d2440031c)
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oe/types.py | 24 | ||||
-rw-r--r-- | meta/lib/oeqa/targetcontrol.py | 8 |
2 files changed, 25 insertions, 7 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 | |||
155 | def 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 | |||
164 | def 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 |