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:
parent
5bfa7e3d59
commit
07ce60bdfa
4 changed files with 18 additions and 5 deletions
|
@ -31,10 +31,11 @@ from os import environ as env
|
||||||
from m5.defines import buildEnv
|
from m5.defines import buildEnv
|
||||||
|
|
||||||
class SysConfig:
|
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.scriptname = script
|
||||||
self.diskname = disk
|
self.diskname = disk
|
||||||
self.memsize = mem
|
self.memsize = mem
|
||||||
|
self.root = rootdev
|
||||||
|
|
||||||
def script(self):
|
def script(self):
|
||||||
if self.scriptname:
|
if self.scriptname:
|
||||||
|
@ -62,6 +63,12 @@ class SysConfig:
|
||||||
buildEnv['TARGET_ISA']
|
buildEnv['TARGET_ISA']
|
||||||
exit(1)
|
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
|
# 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
|
# The first defined machine is the test system, the others are driving systems
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,7 @@ class MemBus(CoherentXBar):
|
||||||
|
|
||||||
def fillInCmdline(mdesc, template, **kwargs):
|
def fillInCmdline(mdesc, template, **kwargs):
|
||||||
kwargs.setdefault('disk', mdesc.disk())
|
kwargs.setdefault('disk', mdesc.disk())
|
||||||
|
kwargs.setdefault('rootdev', mdesc.rootdev())
|
||||||
kwargs.setdefault('mem', mdesc.mem())
|
kwargs.setdefault('mem', mdesc.mem())
|
||||||
kwargs.setdefault('script', mdesc.script())
|
kwargs.setdefault('script', mdesc.script())
|
||||||
return template % kwargs
|
return template % kwargs
|
||||||
|
@ -279,7 +280,7 @@ def makeArmSystem(mem_mode, machine_type, num_cpus=1, mdesc=None,
|
||||||
if not cmdline:
|
if not cmdline:
|
||||||
cmdline = 'earlyprintk=pl011,0x1c090000 console=ttyAMA0 ' + \
|
cmdline = 'earlyprintk=pl011,0x1c090000 console=ttyAMA0 ' + \
|
||||||
'lpj=19988480 norandmaps rw loglevel=8 ' + \
|
'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.realview.setupBootLoader(self.membus, self, binary)
|
||||||
self.gic_cpu_addr = self.realview.gic.cpu_addr
|
self.gic_cpu_addr = self.realview.gic.cpu_addr
|
||||||
|
|
|
@ -274,6 +274,8 @@ def addFSOptions(parser):
|
||||||
# Disk Image Options
|
# Disk Image Options
|
||||||
parser.add_option("--disk-image", action="store", type="string", default=None,
|
parser.add_option("--disk-image", action="store", type="string", default=None,
|
||||||
help="Path to the disk image to use.")
|
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
|
# Command line options
|
||||||
parser.add_option("--command-line", action="store", type="string",
|
parser.add_option("--command-line", action="store", type="string",
|
||||||
|
|
|
@ -313,10 +313,13 @@ if options.benchmark:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
if options.dual:
|
if options.dual:
|
||||||
bm = [SysConfig(disk=options.disk_image, mem=options.mem_size),
|
bm = [SysConfig(disk=options.disk_image, rootdev=options.root_device,
|
||||||
SysConfig(disk=options.disk_image, mem=options.mem_size)]
|
mem=options.mem_size),
|
||||||
|
SysConfig(disk=options.disk_image, rootdev=options.root_device,
|
||||||
|
mem=options.mem_size)]
|
||||||
else:
|
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
|
np = options.num_cpus
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue