summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2019-09-30 17:56:00 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-10-01 10:48:59 +0100
commitb58c50811b5151fb7f9980cb99c32df4eebd0b88 (patch)
tree20d89942cc3c3304e1a1f97c29ee21a2d49e5712 /scripts
parent40e28b6b9a9e07ed83723e0cea956266d7499c7c (diff)
downloadpoky-b58c50811b5151fb7f9980cb99c32df4eebd0b88.tar.gz
runqemu: Add support for kvm on aarch64
The main issue is to make the x86 checks apply to x86 targets only. We may end up with better checks on other architectures but this adapts the code to allow for that and its still controlled by whether QB_CPU_KVM is set. The code needed minor refactoring so the qemu-system-XXX name is set earlier so the kvm code can use it. (From OE-Core rev: acc0f4a6a99fe9367e57a5c2a4f995b6f4db4a9f) 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 'scripts')
-rwxr-xr-xscripts/runqemu22
1 files changed, 13 insertions, 9 deletions
diff --git a/scripts/runqemu b/scripts/runqemu
index 19fd521cd9..af90c010da 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -491,12 +491,13 @@ class BaseConfig(object):
491 yocto_paravirt_kvm_wiki = "https://wiki.yoctoproject.org/wiki/Running_an_x86_Yocto_Linux_image_under_QEMU_KVM" 491 yocto_paravirt_kvm_wiki = "https://wiki.yoctoproject.org/wiki/Running_an_x86_Yocto_Linux_image_under_QEMU_KVM"
492 dev_kvm = '/dev/kvm' 492 dev_kvm = '/dev/kvm'
493 dev_vhost = '/dev/vhost-net' 493 dev_vhost = '/dev/vhost-net'
494 with open('/proc/cpuinfo', 'r') as f: 494 if self.qemu_system.endswith(('i386', 'x86_64')):
495 kvm_cap = re.search('vmx|svm', "".join(f.readlines())) 495 with open('/proc/cpuinfo', 'r') as f:
496 if not kvm_cap: 496 kvm_cap = re.search('vmx|svm', "".join(f.readlines()))
497 logger.error("You are trying to enable KVM on a cpu without VT support.") 497 if not kvm_cap:
498 logger.error("Remove kvm from the command-line, or refer:") 498 logger.error("You are trying to enable KVM on a cpu without VT support.")
499 raise RunQemuError(yocto_kvm_wiki) 499 logger.error("Remove kvm from the command-line, or refer:")
500 raise RunQemuError(yocto_kvm_wiki)
500 501
501 if not os.path.exists(dev_kvm): 502 if not os.path.exists(dev_kvm):
502 logger.error("Missing KVM device. Have you inserted kvm modules?") 503 logger.error("Missing KVM device. Have you inserted kvm modules?")
@@ -709,6 +710,7 @@ class BaseConfig(object):
709 else: 710 else:
710 os.putenv('QEMU_AUDIO_DRV', 'none') 711 os.putenv('QEMU_AUDIO_DRV', 'none')
711 712
713 self.check_qemu_system()
712 self.check_kvm() 714 self.check_kvm()
713 self.check_fstype() 715 self.check_fstype()
714 self.check_rootfs() 716 self.check_rootfs()
@@ -1134,21 +1136,23 @@ class BaseConfig(object):
1134 1136
1135 return 'qemu-system-%s' % qbsys 1137 return 'qemu-system-%s' % qbsys
1136 1138
1137 def setup_final(self): 1139 def check_qemu_system(self):
1138 qemu_system = self.get('QB_SYSTEM_NAME') 1140 qemu_system = self.get('QB_SYSTEM_NAME')
1139 if not qemu_system: 1141 if not qemu_system:
1140 qemu_system = self.guess_qb_system() 1142 qemu_system = self.guess_qb_system()
1141 if not qemu_system: 1143 if not qemu_system:
1142 raise RunQemuError("Failed to boot, QB_SYSTEM_NAME is NULL!") 1144 raise RunQemuError("Failed to boot, QB_SYSTEM_NAME is NULL!")
1145 self.qemu_system = qemu_system
1143 1146
1144 qemu_bin = os.path.join(self.bindir_native, qemu_system) 1147 def setup_final(self):
1148 qemu_bin = os.path.join(self.bindir_native, self.qemu_system)
1145 1149
1146 # It is possible to have qemu-native in ASSUME_PROVIDED, and it won't 1150 # It is possible to have qemu-native in ASSUME_PROVIDED, and it won't
1147 # find QEMU in sysroot, it needs to use host's qemu. 1151 # find QEMU in sysroot, it needs to use host's qemu.
1148 if not os.path.exists(qemu_bin): 1152 if not os.path.exists(qemu_bin):
1149 logger.info("QEMU binary not found in %s, trying host's QEMU" % qemu_bin) 1153 logger.info("QEMU binary not found in %s, trying host's QEMU" % qemu_bin)
1150 for path in (os.environ['PATH'] or '').split(':'): 1154 for path in (os.environ['PATH'] or '').split(':'):
1151 qemu_bin_tmp = os.path.join(path, qemu_system) 1155 qemu_bin_tmp = os.path.join(path, self.qemu_system)
1152 logger.info("Trying: %s" % qemu_bin_tmp) 1156 logger.info("Trying: %s" % qemu_bin_tmp)
1153 if os.path.exists(qemu_bin_tmp): 1157 if os.path.exists(qemu_bin_tmp):
1154 qemu_bin = qemu_bin_tmp 1158 qemu_bin = qemu_bin_tmp