aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/runqemu
diff options
context:
space:
mode:
authorJoshua Lock <joshua.g.lock@intel.com>2016-09-21 20:35:37 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-09-21 22:02:16 +0100
commitc97912a17ddc65f0a4045cbcf4daacc86d26bf09 (patch)
tree66ee7c60ae76b2108f4cae601194f22749395959 /scripts/runqemu
parentcd47b648af422a979477df70e1e5f195ff24c6ec (diff)
downloadopenembedded-core-contrib-c97912a17ddc65f0a4045cbcf4daacc86d26bf09.tar.gz
runqemu: try and guess qemu-system binary when MACHINE isn't set
Emulate some logic from the prior, shell based, version of runqemu to try and infer the correct setting for MACHINE from the kernel and rootfs filenames. (From OE-Core rev: a5adabe1414061d6864c5913dd5e66a4527838f1) Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/runqemu')
-rwxr-xr-xscripts/runqemu36
1 files changed, 36 insertions, 0 deletions
diff --git a/scripts/runqemu b/scripts/runqemu
index 5170d87570..591746f657 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -846,9 +846,45 @@ class BaseConfig(object):
self.set('ROOTFS_OPTIONS', self.rootfs_options)
+ def guess_qb_system(self):
+ """attempt to determine the appropriate qemu-system binary"""
+ mach = self.get('MACHINE')
+ if not mach:
+ search = '.*(qemux86-64|qemux86|qemuarm64|qemuarm|qemumips64|qemumips|qemuppc).*'
+ if self.rootfs:
+ match = re.match(search, self.rootfs)
+ if match:
+ mach = match.group(1)
+ elif self.kernel:
+ match = re.match(search, self.kernel)
+ if match:
+ mach = match.group(1)
+
+ if not mach:
+ return None
+
+ if mach == 'qemuarm':
+ qbsys = 'arm'
+ elif mach == 'qemuarm64':
+ qbsys = 'aarch64'
+ elif mach == 'qemux86':
+ qbsys = 'i386'
+ elif mach == 'qemux86-64':
+ qbsys = 'x86_64'
+ elif mach == 'qemuppc':
+ qbsys = 'ppc'
+ elif mach == 'qemumips':
+ qbsys = 'mips'
+ elif mach == 'qemumips64':
+ qbsys = 'mips64'
+
+ return 'qemu-system-%s' % qbsys
+
def setup_final(self):
qemu_system = self.get('QB_SYSTEM_NAME')
if not qemu_system:
+ qemu_system = self.guess_qb_system()
+ if not qemu_system:
raise Exception("Failed to boot, QB_SYSTEM_NAME is NULL!")
qemu_bin = '%s/%s' % (self.get('STAGING_BINDIR_NATIVE'), qemu_system)