mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
prebuilt: automatically pick up qemu from PATH if not built like qemu-img
This commit is contained in:
2
build
2
build
@@ -133,6 +133,8 @@ name_to_component_map = {
|
||||
'protobuf-compiler',
|
||||
'python-dev',
|
||||
'python-pip',
|
||||
# For prebuilt qcow2 unpack.
|
||||
'qemu-utils',
|
||||
'scons',
|
||||
'zlib1g-dev',
|
||||
},
|
||||
|
||||
@@ -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:
|
||||
|
||||
12
run
12
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
|
||||
|
||||
Reference in New Issue
Block a user