From 8661d68d711c209eecd6dcb693ec59c24f637f1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciro=20Santilli=20=E5=85=AD=E5=9B=9B=E4=BA=8B=E4=BB=B6=20?= =?UTF-8?q?=E6=B3=95=E8=BD=AE=E5=8A=9F?= Date: Sun, 5 May 2019 00:00:00 +0000 Subject: [PATCH] rum: --qemu-which host now works for user mode as well as system Don't fall back on host QEMU automatically, too much insanity. --- common.py | 21 +++++++++++++++++++-- run | 20 +++----------------- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/common.py b/common.py index 23be3a0..a06a448 100644 --- a/common.py +++ b/common.py @@ -658,10 +658,27 @@ Incompatible archs are skipped. # QEMU env['qemu_build_dir'] = join(env['out_dir'], 'qemu', env['qemu_build_id']) - env['qemu_executable_basename'] = 'qemu-system-{}'.format(env['arch']) - env['qemu_executable'] = join(env['qemu_build_dir'], '{}-softmmu'.format(env['arch']), env['qemu_executable_basename']) env['qemu_img_basename'] = 'qemu-img' env['qemu_img_executable'] = join(env['qemu_build_dir'], env['qemu_img_basename']) + if env['userland'] is None: + env['qemu_executable_basename'] = 'qemu-system-{}'.format(env['arch']) + else: + env['qemu_executable_basename'] = 'qemu-{}'.format(env['arch']) + if env['qemu_which'] == 'host': + env['qemu_executable'] = env['qemu_executable_basename'] + else: + if env['userland'] is None: + env['qemu_executable'] = join( + env['qemu_build_dir'], + '{}-softmmu'.format(env['arch']), + env['qemu_executable_basename'] + ) + else: + env['qemu_executable'] = join( + self.env['qemu_build_dir'], + '{}-linux-user'.format(self.env['arch']), + env['qemu_executable_basename'] + ) # gem5 if not env['_args_given']['gem5_build_dir']: diff --git a/run b/run index 6c96504..5a77ad5 100755 --- a/run +++ b/run @@ -553,11 +553,7 @@ Extra options to append at the end of the emulator command line. debug_args = [] cmd.extend( [ - os.path.join( - self.env['qemu_build_dir'], - '{}-linux-user'.format(self.env['arch']), - 'qemu-{}'.format(self.env['arch']) - ), LF, + self.env['qemu_executable'], LF, '-L', self.env['userland_library_dir'], LF, '-r', self.env['kernel_version'], LF, '-seed', '0', LF, @@ -570,16 +566,6 @@ Extra options to append at the end of the emulator command line. raise_image_not_found() extra_emulator_args.extend(extra_qemu_args) self.make_run_dirs() - if self.env['qemu_which'] == 'host' or not os.path.exists(self.env['qemu_executable']): - qemu_executable = self.env['qemu_executable_basename'] - qemu_executable_host = True - else: - qemu_executable = self.env['qemu_executable'] - qemu_executable_host = False - qemu_executable = shutil.which(qemu_executable) - if qemu_executable is None: - raise Exception('QEMU executable not found, did you forget to build or install it?\n' \ - 'Tried to use: ' + qemu_executable) if self.env['debug_vm']: serial_monitor = [] else: @@ -620,7 +606,7 @@ Extra options to append at the end of the emulator command line. machine2 = [] cmd.extend( [ - qemu_executable, LF, + self.env['qemu_executable'], LF, '-machine', self.env['machine'], LF, ] + machine2 + @@ -644,7 +630,7 @@ Extra options to append at the end of the emulator command line. ) if self.env['dtb'] is not None: cmd.extend(['-dtb', self.env['dtb'], LF]) - if not qemu_executable_host: + if not self.env['qemu_which'] == 'host': cmd.extend(qemu_user_and_system_options) if self.env['initrd']: extra_emulator_args.extend(['-initrd', self.env['buildroot_cpio'], LF])