mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
pass disk image to baremetal if present
Why not? But this is mostly a cheap workaround for gem5 baremetal not handling no disk images.
This commit is contained in:
13
common.py
13
common.py
@@ -1148,7 +1148,6 @@ Incompatible archs are skipped.
|
||||
|
||||
# Image
|
||||
if env['baremetal'] is not None:
|
||||
env['disk_image'] = None
|
||||
env['image'] = self.resolve_baremetal_executable(env['baremetal'])
|
||||
source_path_noext = os.path.splitext(join(
|
||||
env['root_dir'],
|
||||
@@ -1176,16 +1175,18 @@ Incompatible archs are skipped.
|
||||
if env['emulator'] == 'gem5':
|
||||
if not env['_args_given']['linux_exec']:
|
||||
env['image'] = env['vmlinux']
|
||||
if env['ramfs']:
|
||||
env['disk_image'] = None
|
||||
else:
|
||||
env['disk_image'] = env['rootfs_raw_file']
|
||||
else:
|
||||
if not env['_args_given']['linux_exec']:
|
||||
env['image'] = env['linux_image']
|
||||
env['disk_image'] = env['qcow2_file']
|
||||
if env['_args_given']['linux_exec']:
|
||||
env['image'] = env['linux_exec']
|
||||
if env['emulator'] == 'gem5':
|
||||
if env['ramfs']:
|
||||
env['disk_image'] = None
|
||||
else:
|
||||
env['disk_image'] = env['rootfs_raw_file']
|
||||
else:
|
||||
env['disk_image'] = env['qcow2_file']
|
||||
|
||||
# Android
|
||||
if not env['_args_given']['android_base_dir']:
|
||||
|
||||
9
run
9
run
@@ -501,6 +501,9 @@ Extra options to append at the end of the emulator command line.
|
||||
f.write(struct.pack('<{}'.format(self.python_struct_int_format(self.env['int_size'])), len(cli_args)))
|
||||
f.write(b''.join(argv_addr_data))
|
||||
f.write(b'\0'.join(arg.encode() for arg in cli_args) + b'\0')
|
||||
use_disk_image = self.env['disk_image'] is not None and \
|
||||
os.path.exists(self.env['disk_image']) or \
|
||||
self.env['baremetal'] is None
|
||||
if self.env['emulator'] == 'gem5':
|
||||
if self.env['quiet']:
|
||||
show_stdout = False
|
||||
@@ -569,7 +572,7 @@ Extra options to append at the end of the emulator command line.
|
||||
'--num-cpus', str(self.env['cpus']), LF,
|
||||
'--script', self.env['gem5_readfile_file'], LF,
|
||||
])
|
||||
if self.env['disk_image'] is not None:
|
||||
if use_disk_image:
|
||||
cmd.extend(['--disk-image', self.env['disk_image'], LF])
|
||||
if not self.env['baremetal'] is None:
|
||||
cmd.extend([
|
||||
@@ -646,7 +649,7 @@ Extra options to append at the end of the emulator command line.
|
||||
'--little-cpus', str(self.env['cpus'] // 2), LF,
|
||||
'--root', '/dev/vda', LF,
|
||||
])
|
||||
if self.env['disk_image'] is not None:
|
||||
if use_disk_image:
|
||||
cmd.extend(['--disk', self.env['disk_image'], LF])
|
||||
if self.env['dtb']:
|
||||
cmd.extend([
|
||||
@@ -796,7 +799,7 @@ Extra options to append at the end of the emulator command line.
|
||||
'-drive', 'driver=blkreplay,if=none,image=img-direct,id=img-blkreplay', LF,
|
||||
'-device', 'ide-hd,drive=img-blkreplay', LF,
|
||||
])
|
||||
if self.env['disk_image'] is not None:
|
||||
if use_disk_image:
|
||||
extra_emulator_args.extend([
|
||||
'-drive',
|
||||
'file={},format=qcow2,if={}{}{}'.format(
|
||||
|
||||
Reference in New Issue
Block a user