diff options
author | Joshua Lock <joshua.g.lock@intel.com> | 2016-09-21 20:35:37 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-09-21 22:02:16 +0100 |
commit | c97912a17ddc65f0a4045cbcf4daacc86d26bf09 (patch) | |
tree | 66ee7c60ae76b2108f4cae601194f22749395959 /scripts | |
parent | cd47b648af422a979477df70e1e5f195ff24c6ec (diff) | |
download | poky-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')
-rwxr-xr-x | scripts/runqemu | 36 |
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): | |||
846 | 846 | ||
847 | self.set('ROOTFS_OPTIONS', self.rootfs_options) | 847 | self.set('ROOTFS_OPTIONS', self.rootfs_options) |
848 | 848 | ||
849 | def guess_qb_system(self): | ||
850 | """attempt to determine the appropriate qemu-system binary""" | ||
851 | mach = self.get('MACHINE') | ||
852 | if not mach: | ||
853 | search = '.*(qemux86-64|qemux86|qemuarm64|qemuarm|qemumips64|qemumips|qemuppc).*' | ||
854 | if self.rootfs: | ||
855 | match = re.match(search, self.rootfs) | ||
856 | if match: | ||
857 | mach = match.group(1) | ||
858 | elif self.kernel: | ||
859 | match = re.match(search, self.kernel) | ||
860 | if match: | ||
861 | mach = match.group(1) | ||
862 | |||
863 | if not mach: | ||
864 | return None | ||
865 | |||
866 | if mach == 'qemuarm': | ||
867 | qbsys = 'arm' | ||
868 | elif mach == 'qemuarm64': | ||
869 | qbsys = 'aarch64' | ||
870 | elif mach == 'qemux86': | ||
871 | qbsys = 'i386' | ||
872 | elif mach == 'qemux86-64': | ||
873 | qbsys = 'x86_64' | ||
874 | elif mach == 'qemuppc': | ||
875 | qbsys = 'ppc' | ||
876 | elif mach == 'qemumips': | ||
877 | qbsys = 'mips' | ||
878 | elif mach == 'qemumips64': | ||
879 | qbsys = 'mips64' | ||
880 | |||
881 | return 'qemu-system-%s' % qbsys | ||
882 | |||
849 | def setup_final(self): | 883 | def setup_final(self): |
850 | qemu_system = self.get('QB_SYSTEM_NAME') | 884 | qemu_system = self.get('QB_SYSTEM_NAME') |
851 | if not qemu_system: | 885 | if not qemu_system: |
886 | qemu_system = self.guess_qb_system() | ||
887 | if not qemu_system: | ||
852 | raise Exception("Failed to boot, QB_SYSTEM_NAME is NULL!") | 888 | raise Exception("Failed to boot, QB_SYSTEM_NAME is NULL!") |
853 | 889 | ||
854 | qemu_bin = '%s/%s' % (self.get('STAGING_BINDIR_NATIVE'), qemu_system) | 890 | qemu_bin = '%s/%s' % (self.get('STAGING_BINDIR_NATIVE'), qemu_system) |