diff --git a/build b/build index 14c4eb4..050f3ff 100755 --- a/build +++ b/build @@ -133,6 +133,8 @@ name_to_component_map = { 'protobuf-compiler', 'python-dev', 'python-pip', + # For prebuilt qcow2 unpack. + 'qemu-utils', 'scons', 'zlib1g-dev', }, diff --git a/common.py b/common.py index 3b0f933..a591b89 100644 --- a/common.py +++ b/common.py @@ -537,7 +537,7 @@ def print_time(ellapsed_seconds): print("time {:02}:{:02}:{:02}".format(int(hours), int(minutes), int(seconds))) def raw_to_qcow2(prebuilt=False, reverse=False): - if prebuilt: + if prebuilt or not os.path.exists(common.qemu_img_executable): disable_trace = [] qemu_img_executable = common.qemu_img_basename else: diff --git a/run b/run index 24c4494..1962aa6 100755 --- a/run +++ b/run @@ -249,13 +249,14 @@ def main(args, extra_args=None): raise_image_not_found() extra_emulator_args.extend(extra_qemu_args) common.make_run_dirs() - if args.prebuilt: + if args.prebuilt or not os.path.exists(common.qemu_executable): qemu_executable = common.qemu_executable_basename - qemu_found = shutil.which(qemu_executable) is not None + qemu_executable_prebuilt = True else: qemu_executable = common.qemu_executable - qemu_found = os.path.exists(qemu_executable) - if not qemu_found and not args.dry_run: + qemu_executable_prebuilt = 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 args.debug_vm: @@ -296,10 +297,11 @@ def main(args, extra_args=None): '-smp', str(args.cpus), common.Newline, ] + virtfs_cmd + - qemu_user_and_system_options + serial_monitor + vnc ) + if not qemu_executable_prebuilt: + cmd.extend(qemu_user_and_system_options) if args.initrd: extra_emulator_args.extend(['-initrd', os.path.join(common.buildroot_images_dir, 'rootfs.cpio')]) rr = args.record or args.replay