mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2025-08-15 22:36:35 +00:00
Allow a custom disk image
This commit is contained in:
16
common.py
16
common.py
@ -243,6 +243,9 @@ Enable or disable ccache: https://cirosantilli.com/linux-kernel-module-cheat#cca
|
||||
To have some fun when the kernel starts to beat you.
|
||||
'''
|
||||
)
|
||||
self.add_argument(
|
||||
'--disk-image',
|
||||
)
|
||||
self.add_argument(
|
||||
'--dry-run',
|
||||
default=False,
|
||||
@ -1216,13 +1219,14 @@ Incompatible archs are skipped.
|
||||
env['image_elf'] = env['vmlinux']
|
||||
if env['_args_given']['linux_exec']:
|
||||
env['image'] = env['linux_exec']
|
||||
if env['emulator'] == 'gem5':
|
||||
if env['ramfs']:
|
||||
env['disk_image'] = None
|
||||
if not env['_args_given']['disk_image']:
|
||||
if env['emulator'] == 'gem5':
|
||||
if env['ramfs']:
|
||||
env['disk_image'] = None
|
||||
else:
|
||||
env['disk_image'] = env['rootfs_raw_file']
|
||||
else:
|
||||
env['disk_image'] = env['rootfs_raw_file']
|
||||
else:
|
||||
env['disk_image'] = env['qcow2_file']
|
||||
env['disk_image'] = env['qcow2_file']
|
||||
|
||||
# Android
|
||||
if not env['_args_given']['android_base_dir']:
|
||||
|
9
run
9
run
@ -521,6 +521,8 @@ Extra options to append at the end of the emulator command line.
|
||||
use_disk_image = self.env['disk_image'] is not None and \
|
||||
os.path.exists(self.env['disk_image']) or \
|
||||
not self.env['baremetal']
|
||||
if self.env['_args_given']['disk_image'] and not os.path.exists(self.env['disk_image']) :
|
||||
raise_rootfs_not_found()
|
||||
if self.env['emulator'] == 'gem5':
|
||||
if self.env['quiet']:
|
||||
show_stdout = False
|
||||
@ -827,10 +829,15 @@ Extra options to append at the end of the emulator command line.
|
||||
'-device', 'ide-hd,drive=img-blkreplay', LF,
|
||||
])
|
||||
if use_disk_image:
|
||||
if os.path.splitext(self.env['disk_image'])[1] == '.qcow2':
|
||||
disk_format = 'qcow2'
|
||||
else:
|
||||
disk_format = 'raw'
|
||||
extra_emulator_args.extend([
|
||||
'-drive',
|
||||
'file={},format=qcow2,if={}{}{}'.format(
|
||||
'file={},format={},if={}{}{}'.format(
|
||||
self.env['disk_image'],
|
||||
disk_format,
|
||||
driveif,
|
||||
snapshot,
|
||||
rrid
|
||||
|
Reference in New Issue
Block a user