mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-01-31 10:11:17 +00:00
Gem5: Add support for deploying the m5 binary
This commit is contained in:
parent
480155fd8c
commit
e7c75b2d3b
BIN
wlauto/common/bin/arm64/m5
Executable file
BIN
wlauto/common/bin/arm64/m5
Executable file
Binary file not shown.
BIN
wlauto/common/bin/armeabi/m5
Executable file
BIN
wlauto/common/bin/armeabi/m5
Executable file
Binary file not shown.
6
wlauto/common/gem5/LICENSE
Normal file
6
wlauto/common/gem5/LICENSE
Normal file
@ -0,0 +1,6 @@
|
||||
The gem5 simulator can be obtained from http://repo.gem5.org/gem5/ and the
|
||||
corresponding documentation can be found at http://www.gem5.org.
|
||||
|
||||
The source for the m5 binaries bundled with Workload Automation (found at
|
||||
wlauto/common/bin/arm64/m5 and wlauto/common/bin/armeabi/m5) can be found at
|
||||
util/m5 in the gem5 source at http://repo.gem5.org/gem5/.
|
@ -29,6 +29,8 @@ import time
|
||||
from pexpect import EOF, TIMEOUT, pxssh
|
||||
|
||||
from wlauto import settings, Parameter
|
||||
from wlauto.core.resource import NO_ONE
|
||||
from wlauto.common.resources import Executable
|
||||
from wlauto.core import signal as sig
|
||||
from wlauto.exceptions import DeviceError
|
||||
from wlauto.utils import ssh, types
|
||||
@ -112,6 +114,7 @@ class BaseGem5Device(object):
|
||||
self.gem5 = None
|
||||
self.gem5_port = -1
|
||||
self.gem5outdir = os.path.join(settings.output_directory, "gem5")
|
||||
self.m5_path = 'm5'
|
||||
self.stdout_file = None
|
||||
self.stderr_file = None
|
||||
self.stderr_filename = None
|
||||
@ -609,7 +612,7 @@ class BaseGem5Device(object):
|
||||
|
||||
def gem5_util(self, command):
|
||||
""" Execute a gem5 utility command using the m5 binary on the device """
|
||||
self.gem5_shell('/sbin/m5 ' + command)
|
||||
self.gem5_shell('{} {}'.format(self.m5_path, command))
|
||||
|
||||
def sync_gem5_shell(self):
|
||||
"""
|
||||
@ -666,3 +669,33 @@ class BaseGem5Device(object):
|
||||
mount_command = "mount -t 9p -o trans=virtio,version=9p2000.L,aname={} gem5 /mnt/obb".format(self.temp_dir)
|
||||
self.gem5_shell(mount_command)
|
||||
|
||||
def deploy_m5(self, context, force=False):
|
||||
"""
|
||||
Deploys the m5 binary to the device and returns the path to the binary
|
||||
on the device.
|
||||
|
||||
:param 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.
|
||||
|
||||
"""
|
||||
on_device_executable = self.path.join(self.binaries_directory, 'm5')
|
||||
if not force and self.file_exists(on_device_executable):
|
||||
# We want to check the version of the binary. We cannot directly
|
||||
# check this because the m5 binary itself is unversioned. We also
|
||||
# need to make sure not to check the error code as "m5 --help"
|
||||
# returns a non-zero error code.
|
||||
output = self.gem5_shell('m5 --help', check_exit_code=False)
|
||||
if "writefile" in output:
|
||||
self.logger.debug("Using the m5 binary on the device...")
|
||||
self.m5_path = on_device_executable
|
||||
return on_device_executable
|
||||
else:
|
||||
self.logger.debug("m5 on device does not support writefile!")
|
||||
host_file = context.resolver.get(Executable(NO_ONE, self.abi, 'm5'))
|
||||
self.logger.info("Installing the m5 binary to the device...")
|
||||
self.m5_path = self.install(host_file)
|
||||
return self.m5_path
|
||||
|
@ -207,3 +207,4 @@ class Gem5AndroidDevice(BaseGem5Device, AndroidDevice):
|
||||
|
||||
def initialize(self, context):
|
||||
self.resize_shell()
|
||||
self.deploy_m5(context, force=False)
|
||||
|
@ -111,3 +111,4 @@ class Gem5LinuxDevice(BaseGem5Device, LinuxDevice):
|
||||
|
||||
def initialize(self, context):
|
||||
self.resize_shell()
|
||||
self.deploy_m5(context, force=False)
|
||||
|
Loading…
x
Reference in New Issue
Block a user