wlauto.common.gem5 package¶
Submodules¶
wlauto.common.gem5.device module¶
-
class
wlauto.common.gem5.device.
BaseGem5Device
[source]¶ Bases:
object
Base implementation for a gem5-based device
This class is used as the base class for OS-specific devices such as the G3m5LinuxDevice and the Gem5AndroidDevice. The majority of the gem5-specific functionality is included here.
Note: When inheriting from this class, make sure to inherit from this class prior to inheriting from the OS-specific class, i.e. LinuxDevice, to ensure that the methods are correctly overridden.
-
checkpoint_gem5
(end_simulation=False)[source]¶ Checkpoint the gem5 simulation, storing all system state
-
connect
()[source]¶ Connect to the gem5 simulation and wait for Android to boot. Then, create checkpoints, and mount the VirtIO device.
-
connect_gem5
()[source]¶ Connect to the telnet port of the gem5 simulation.
We connect, and wait for the prompt to be found. We do not use a timeout for this, and wait for the prompt in a while loop as the gem5 simulation can take many hours to reach a prompt when booting the system. We also inject some newlines periodically to try and force gem5 to show a prompt. Once the prompt has been found, we replace it with a unique prompt to ensure that we are able to match it properly. We also disable the echo as this simplifies parsing the output when executing commands on the device.
-
default_timeout
= 3600¶
-
delay
= 3600¶
-
deploy_m5
(context, force=False)[source]¶ Deploys the m5 binary to the device and returns the path to the binary on the device.
Parameters: force – by default, if the binary is already present on the device, it will not be deployed again. Setting force to True
overrides that behaviour and ensures that the binary is always copied. Defaults toFalse
.Returns: The on-device path to the m5 binary.
-
disconnect
()[source]¶ Close and disconnect from the gem5 simulation. Additionally, we remove the temporary directory used to pass files into the simulation.
-
execute
(command, timeout=1000, check_exit_code=True, background=False, as_root=False, busybox=False, **kwargs)[source]¶
-
gem5_shell
(command, as_root=False, timeout=None, check_exit_code=True, sync=True)[source]¶ Execute a command in the gem5 shell
This wraps the telnet connection to gem5 and processes the raw output.
This method waits for the shell to return, and then will try and separate the output from the command from the command itself. If this fails, warn, but continue with the potentially wrong output.
The exit code is also checked by default, and non-zero exit codes will raise a DeviceError.
-
init_gem5
(_)[source]¶ Start gem5, find out the telnet port and connect to the simulation.
We first create the temporary directory used by VirtIO to pass files into the simulation, as well as the gem5 output directory.We then create files for the standard output and error for the gem5 process. The gem5 process then is started.
-
is_rooted
¶
-
long_delay
= 10800¶
-
move_to_temp_dir
(source)[source]¶ Move a file to the temporary directory on the host for copying to the gem5 device
-
parameters
= [Param({'kind': <type 'str'>, 'mandatory': False, 'name': 'gem5_binary', 'constraint': None, 'default': './build/ARM/gem5.fast', 'allowed_values': None, 'global_alias': None, 'override': False}), Param({'kind': <class 'wlauto.utils.types.arguments'>, 'mandatory': True, 'name': 'gem5_args', 'constraint': None, 'default': None, 'allowed_values': None, 'global_alias': None, 'override': False}), Param({'kind': <class 'wlauto.utils.types.arguments'>, 'mandatory': True, 'name': 'gem5_vio_args', 'constraint': <function <lambda>>, 'default': None, 'allowed_values': None, 'global_alias': None, 'override': False}), Param({'kind': <type 'str'>, 'mandatory': None, 'name': 'temp_dir', 'constraint': None, 'default': '/tmp', 'allowed_values': None, 'global_alias': None, 'override': False}), Param({'kind': <function boolean>, 'mandatory': False, 'name': 'checkpoint', 'constraint': None, 'default': False, 'allowed_values': None, 'global_alias': None, 'override': False}), Param({'kind': <function integer>, 'mandatory': False, 'name': 'run_delay', 'constraint': <function <lambda>>, 'default': 0, 'allowed_values': None, 'global_alias': None, 'override': False})]¶
-
path_module
= 'posixpath'¶
-
platform
= None¶
-
pull_file
(source, dest, **kwargs)[source]¶ Pull a file from the gem5 device using m5 writefile
The file is copied to the local directory within the guest as the m5 writefile command assumes that the file is local. The file is then written out to the host system using writefile, prior to being moved to the destination on the host.
-
push_file
(source, dest, **kwargs)[source]¶ Push a file to the gem5 device using VirtIO
The file to push to the device is copied to the temporary directory on the host, before being copied within the simulation to the destination. Checks, in the form of ‘ls’ with error code checking, are performed to ensure that the file is copied to the destination.
-
ready_timeout
= 10800¶
-