diff options
Diffstat (limited to 'scripts/runqemu')
-rwxr-xr-x | scripts/runqemu | 22 |
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 |