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