From 07ce60bdfa57eedf00f533704b5a2da3fa01b553 Mon Sep 17 00:00:00 2001 From: Curtis Dunham Date: Fri, 16 Jan 2015 14:12:03 -0600 Subject: [PATCH] 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. --- configs/common/Benchmarks.py | 9 ++++++++- configs/common/FSConfig.py | 3 ++- configs/common/Options.py | 2 ++ configs/example/fs.py | 9 ++++++--- 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 -- 2.30.2