summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCurtis Dunham <Curtis.Dunham@arm.com>2015-01-16 14:12:03 -0600
committerCurtis Dunham <Curtis.Dunham@arm.com>2015-01-16 14:12:03 -0600
commit07ce60bdfa57eedf00f533704b5a2da3fa01b553 (patch)
tree7127baf93ec9357f0d48fd00c8e5c529478e2e59
parent5bfa7e3d59138b0b440e5b2e67e8077c1d59c34b (diff)
downloadgem5-07ce60bdfa57eedf00f533704b5a2da3fa01b553.tar.xz
config: add --root-device machine parameter
In case /dev/sda1 is not actually the boot partition for an image, we can override it on the command line or in a benchmark definition.
-rw-r--r--configs/common/Benchmarks.py9
-rw-r--r--configs/common/FSConfig.py3
-rw-r--r--configs/common/Options.py2
-rw-r--r--configs/example/fs.py9
4 files changed, 18 insertions, 5 deletions
diff --git a/configs/common/Benchmarks.py b/configs/common/Benchmarks.py
index 44cbef976..37343dfad 100644
--- a/configs/common/Benchmarks.py
+++ b/configs/common/Benchmarks.py
@@ -31,10 +31,11 @@ from os import environ as env
from m5.defines import buildEnv
class SysConfig:
- def __init__(self, script=None, mem=None, disk=None):
+ def __init__(self, script=None, mem=None, disk=None, rootdev=None):
self.scriptname = script
self.diskname = disk
self.memsize = mem
+ self.root = rootdev
def script(self):
if self.scriptname:
@@ -62,6 +63,12 @@ class SysConfig:
buildEnv['TARGET_ISA']
exit(1)
+ def rootdev(self):
+ if self.root:
+ return self.root
+ else:
+ return '/dev/sda1'
+
# Benchmarks are defined as a key in a dict which is a list of SysConfigs
# The first defined machine is the test system, the others are driving systems
diff --git a/configs/common/FSConfig.py b/configs/common/FSConfig.py
index 88de3b8df..cfa6dee4d 100644
--- a/configs/common/FSConfig.py
+++ b/configs/common/FSConfig.py
@@ -57,6 +57,7 @@ class MemBus(CoherentXBar):
def fillInCmdline(mdesc, template, **kwargs):
kwargs.setdefault('disk', mdesc.disk())
+ kwargs.setdefault('rootdev', mdesc.rootdev())
kwargs.setdefault('mem', mdesc.mem())
kwargs.setdefault('script', mdesc.script())
return template % kwargs
@@ -279,7 +280,7 @@ def makeArmSystem(mem_mode, machine_type, num_cpus=1, mdesc=None,
if not cmdline:
cmdline = 'earlyprintk=pl011,0x1c090000 console=ttyAMA0 ' + \
'lpj=19988480 norandmaps rw loglevel=8 ' + \
- 'mem=%(mem)s root=/dev/sda1'
+ 'mem=%(mem)s root=%(rootdev)s'
self.realview.setupBootLoader(self.membus, self, binary)
self.gic_cpu_addr = self.realview.gic.cpu_addr
diff --git a/configs/common/Options.py b/configs/common/Options.py
index ea3de8691..07059f23b 100644
--- a/configs/common/Options.py
+++ b/configs/common/Options.py
@@ -274,6 +274,8 @@ def addFSOptions(parser):
# Disk Image Options
parser.add_option("--disk-image", action="store", type="string", default=None,
help="Path to the disk image to use.")
+ parser.add_option("--root-device", action="store", type="string", default=None,
+ help="OS device name for root partition")
# Command line options
parser.add_option("--command-line", action="store", type="string",
diff --git a/configs/example/fs.py b/configs/example/fs.py
index 9609b25a2..83b9b3267 100644
--- a/configs/example/fs.py
+++ b/configs/example/fs.py
@@ -313,10 +313,13 @@ if options.benchmark:
sys.exit(1)
else:
if options.dual:
- bm = [SysConfig(disk=options.disk_image, mem=options.mem_size),
- SysConfig(disk=options.disk_image, mem=options.mem_size)]
+ bm = [SysConfig(disk=options.disk_image, rootdev=options.root_device,
+ mem=options.mem_size),
+ SysConfig(disk=options.disk_image, rootdev=options.root_device,
+ mem=options.mem_size)]
else:
- bm = [SysConfig(disk=options.disk_image, mem=options.mem_size)]
+ bm = [SysConfig(disk=options.disk_image, rootdev=options.root_device,
+ mem=options.mem_size)]
np = options.num_cpus