default = Self.badaddr_responder.pio
-def makeLinuxAlphaSystem(mem_mode, mdesc=None, ruby=False):
+def fillInCmdline(mdesc, template, **kwargs):
+ kwargs.setdefault('disk', mdesc.disk())
+ kwargs.setdefault('mem', mdesc.mem())
+ kwargs.setdefault('script', mdesc.script())
+ return template % kwargs
+
+def makeLinuxAlphaSystem(mem_mode, mdesc=None, ruby=False, cmdline=None):
class BaseTsunami(Tsunami):
ethernet = NSGigE(pci_bus=0, pci_dev=1, pci_func=0)
self.kernel = binary('vmlinux')
self.pal = binary('ts_osfpal')
self.console = binary('console')
- self.boot_osflags = 'root=/dev/hda1 console=ttyS0'
+ if not cmdline:
+ cmdline = 'root=/dev/hda1 console=ttyS0'
+ self.boot_osflags = fillInCmdline(mdesc, cmdline)
return self
return self
def makeArmSystem(mem_mode, machine_type, num_cpus=1, mdesc=None,
- dtb_filename=None, bare_metal=False):
+ dtb_filename=None, bare_metal=False, cmdline=None):
assert machine_type
if bare_metal:
self.dtb_filename = binary(dtb_filename)
self.machine_type = machine_type
# Ensure that writes to the UART actually go out early in the boot
- boot_flags = 'earlyprintk=pl011,0x1c090000 console=ttyAMA0 ' + \
- 'lpj=19988480 norandmaps rw loglevel=8 ' + \
- 'mem=%s root=/dev/sda1' % mdesc.mem()
+ if not cmdline:
+ cmdline = 'earlyprintk=pl011,0x1c090000 console=ttyAMA0 ' + \
+ 'lpj=19988480 norandmaps rw loglevel=8 ' + \
+ 'mem=%(mem)s root=/dev/sda1'
self.realview.setupBootLoader(self.membus, self, binary)
self.gic_cpu_addr = self.realview.gic.cpu_addr
if mdesc.disk().lower().count('android'):
boot_flags += " init=/init "
- self.boot_osflags = boot_flags
+ self.boot_osflags = fillInCmdline(mdesc, cmdline)
self.realview.attachOnChipIO(self.membus, self.bridge)
self.realview.attachIO(self.iobus)
self.intrctrl = IntrControl()
return self
-def makeLinuxMipsSystem(mem_mode, mdesc=None):
+def makeLinuxMipsSystem(mem_mode, mdesc=None, cmdline=None):
class BaseMalta(Malta):
ethernet = NSGigE(pci_bus=0, pci_dev=1, pci_func=0)
ide = IdeController(disks=[Parent.disk0, Parent.disk2],
self.terminal = Terminal()
self.kernel = binary('mips/vmlinux')
self.console = binary('mips/console')
- self.boot_osflags = 'root=/dev/hda1 console=ttyS0'
+ if not cmdline:
+ cmdline = 'root=/dev/hda1 console=ttyS0'
+ self.boot_osflags = fillInCmdline(mdesc, cmdline)
self.system_port = self.membus.slave
self.intel_mp_table.base_entries = base_entries
self.intel_mp_table.ext_entries = ext_entries
-def makeLinuxX86System(mem_mode, numCPUs=1, mdesc=None, Ruby=False):
+def makeLinuxX86System(mem_mode, numCPUs=1, mdesc=None, Ruby=False,
+ cmdline=None):
self = LinuxX86System()
# Build up the x86 system and then specialize it for Linux
self.e820_table.entries = entries
# Command line
- self.boot_osflags = 'earlyprintk=ttyS0 console=ttyS0 lpj=7999923 ' + \
- 'root=/dev/hda1'
+ if not cmdline:
+ cmdline = 'earlyprintk=ttyS0 console=ttyS0 lpj=7999923 root=/dev/hda1'
+ self.boot_osflags = fillInCmdline(mdesc, cmdline)
self.kernel = binary('x86_64-vmlinux-2.6.22.9')
return self
# Disk Image Options
parser.add_option("--disk-image", action="store", type="string", default=None,
help="Path to the disk image to use.")
+
+ # Command line options
+ parser.add_option("--command-line", action="store", type="string",
+ default=None,
+ help="Template for the kernel command line.")
+ parser.add_option("--command-line-file", action="store",
+ default=None, type="string",
+ help="File with a template for the kernel command line")
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:
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)