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.

capture_screen(filepath)[source]
checkpoint_gem5(end_simulation=False)[source]

Checkpoint the gem5 simulation, storing all system state

close()[source]
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
delete_file(filepath, **kwargs)[source]

Delete a file on the device

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 to False.
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]
file_exists(filepath)[source]

Check if a file exists

find_prompt()[source]
forward_port(_)[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.

gem5_util(command)[source]

Execute a gem5 utility command using the m5 binary on the device

get_directory(context, directory)[source]

Pull a directory from the device

get_pids_of(process_name)[source]

Returns a list of PIDs of all processes with the specified name.

get_properties(context)[source]

Get the property files from the device

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
mount_virtio()[source]

Mount the VirtIO device in the simulated system.

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'
ping()[source]
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
reset()[source]
resize_shell()[source]

Resize the shell to avoid line wrapping issues.

start_gem5()[source]

Starts the gem5 simulator, and parses the output to get the telnet port.

sync_gem5_shell()[source]

Synchronise with the gem5 shell.

Write some unique text to the gem5 device to allow us to synchronise with the shell output. We actually get two prompts so we need to match both of these.

validate()[source]
wait_for_boot()[source]

Module contents