summaryrefslogtreecommitdiff
path: root/configs/example/fs.py
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2014-12-04 16:42:07 -0800
committerGabe Black <gabeblack@google.com>2014-12-04 16:42:07 -0800
commit7540656fc5b8ce0cafb54f41b913a7e81cbfb4b3 (patch)
tree9d71ff1e0fec15253c091bb077aea8c854d23141 /configs/example/fs.py
parent22aaa5867f2449e2a73b7891fc34072c12c199b3 (diff)
downloadgem5-7540656fc5b8ce0cafb54f41b913a7e81cbfb4b3.tar.xz
config: Add two options for setting the kernel command line.
Both options accept template which will, through python string formatting, have "mem", "disk", and "script" values substituted in from the mdesc. Additional values can be used on a case by case basis by passing them as keyword arguments to the fillInCmdLine function. That makes it possible to have specialized parameters for a particular ISA, for instance. The first option lets you specify the template directly, and the other lets you specify a file which has the template in it.
Diffstat (limited to 'configs/example/fs.py')
-rw-r--r--configs/example/fs.py37
1 files changed, 27 insertions, 10 deletions
diff --git a/configs/example/fs.py b/configs/example/fs.py
index 0277feef3..62a298559 100644
--- a/configs/example/fs.py
+++ b/configs/example/fs.py
@@ -71,20 +71,34 @@ def is_kvm_cpu(cpu_class):
return have_kvm_support and cpu_class != None and \
issubclass(cpu_class, BaseKvmCPU)
+def cmd_line_template():
+ if options.command_line and options.command_line_file:
+ print "Error: --command-line and --command-line-file are " \
+ "mutually exclusive"
+ sys.exit(1)
+ if options.command_line:
+ return options.command_line
+ if options.command_line_file:
+ return open(options.command_line_file).read().strip()
+ return None
+
def build_test_system(np):
+ cmdline = cmd_line_template()
if buildEnv['TARGET_ISA'] == "alpha":
- test_sys = makeLinuxAlphaSystem(test_mem_mode, bm[0], options.ruby)
+ test_sys = makeLinuxAlphaSystem(test_mem_mode, bm[0], options.ruby,
+ cmdline=cmdline)
elif buildEnv['TARGET_ISA'] == "mips":
- test_sys = makeLinuxMipsSystem(test_mem_mode, bm[0])
+ test_sys = makeLinuxMipsSystem(test_mem_mode, bm[0], cmdline=cmdline)
elif buildEnv['TARGET_ISA'] == "sparc":
- test_sys = makeSparcSystem(test_mem_mode, bm[0])
+ test_sys = makeSparcSystem(test_mem_mode, bm[0], cmdline=cmdline)
elif buildEnv['TARGET_ISA'] == "x86":
test_sys = makeLinuxX86System(test_mem_mode, options.num_cpus, bm[0],
- options.ruby)
+ options.ruby, cmdline=cmdline)
elif buildEnv['TARGET_ISA'] == "arm":
test_sys = makeArmSystem(test_mem_mode, options.machine_type,
options.num_cpus, bm[0], options.dtb_filename,
- bare_metal=options.bare_metal)
+ bare_metal=options.bare_metal,
+ cmdline=cmdline)
if options.enable_context_switch_stats_dump:
test_sys.enable_context_switch_stats_dump = True
else:
@@ -202,16 +216,19 @@ def build_drive_system(np):
drive_mem_mode = 'atomic'
DriveMemClass = SimpleMemory
+ cmdline = cmd_line_template()
if buildEnv['TARGET_ISA'] == 'alpha':
- drive_sys = makeLinuxAlphaSystem(drive_mem_mode, bm[1])
+ drive_sys = makeLinuxAlphaSystem(drive_mem_mode, bm[1], cmdline=cmdline)
elif buildEnv['TARGET_ISA'] == 'mips':
- drive_sys = makeLinuxMipsSystem(drive_mem_mode, bm[1])
+ drive_sys = makeLinuxMipsSystem(drive_mem_mode, bm[1], cmdline=cmdline)
elif buildEnv['TARGET_ISA'] == 'sparc':
- drive_sys = makeSparcSystem(drive_mem_mode, bm[1])
+ drive_sys = makeSparcSystem(drive_mem_mode, bm[1], cmdline=cmdline)
elif buildEnv['TARGET_ISA'] == 'x86':
- drive_sys = makeLinuxX86System(drive_mem_mode, np, bm[1])
+ drive_sys = makeLinuxX86System(drive_mem_mode, np, bm[1],
+ cmdline=cmdline)
elif buildEnv['TARGET_ISA'] == 'arm':
- drive_sys = makeArmSystem(drive_mem_mode, options.machine_type, bm[1])
+ drive_sys = makeArmSystem(drive_mem_mode, options.machine_type, bm[1],
+ cmdline=cmdline)
# Create a top-level voltage domain
drive_sys.voltage_domain = VoltageDomain(voltage = options.sys_voltage)