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.
This commit is contained in:
Curtis Dunham 2015-01-16 14:12:03 -06:00
parent 5bfa7e3d59
commit 07ce60bdfa
4 changed files with 18 additions and 5 deletions

View file

@ -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

View file

@ -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

View file

@ -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",

View file

@ -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