diff options
author | Chris Emmons <Chris.Emmons@arm.com> | 2015-03-19 04:06:14 -0400 |
---|---|---|
committer | Chris Emmons <Chris.Emmons@arm.com> | 2015-03-19 04:06:14 -0400 |
commit | 142ab40c4b57315e20c924d0615470ee24f46d9e (patch) | |
tree | ea8fb6bcea5b95fbbef2ab28d5530843a8f36fb6 /configs | |
parent | 9b4d8030e6d106e8ddae7b9940fe8f07d2621660 (diff) | |
download | gem5-142ab40c4b57315e20c924d0615470ee24f46d9e.tar.xz |
config: Specify OS type and release on command line
This patch enables users to speficy --os-type on the command
line. This option is used to take specific actions for an OS type,
such as changing the kernel command line. This patch is part of the
Android KitKat enablement.
Diffstat (limited to 'configs')
-rw-r--r-- | configs/common/Benchmarks.py | 19 | ||||
-rw-r--r-- | configs/common/FSConfig.py | 39 | ||||
-rw-r--r-- | configs/common/Options.py | 5 | ||||
-rw-r--r-- | configs/example/fs.py | 6 |
4 files changed, 57 insertions, 12 deletions
diff --git a/configs/common/Benchmarks.py b/configs/common/Benchmarks.py index 37343dfad..bf0a2ad88 100644 --- a/configs/common/Benchmarks.py +++ b/configs/common/Benchmarks.py @@ -31,11 +31,13 @@ from os import environ as env from m5.defines import buildEnv class SysConfig: - def __init__(self, script=None, mem=None, disk=None, rootdev=None): + def __init__(self, script=None, mem=None, disk=None, rootdev=None, + os_type='linux'): self.scriptname = script self.diskname = disk self.memsize = mem self.root = rootdev + self.ostype = os_type def script(self): if self.scriptname: @@ -69,6 +71,9 @@ class SysConfig: else: return '/dev/sda1' + def os_type(self): + return self.ostype + # 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 @@ -119,13 +124,17 @@ Benchmarks = { 'MutexTest': [SysConfig('mutex-test.rcS', '128MB')], 'ArmAndroid-GB': [SysConfig('null.rcS', '256MB', - 'ARMv7a-Gingerbread-Android.SMP.mouse.nolock.clean.img')], + 'ARMv7a-Gingerbread-Android.SMP.mouse.nolock.clean.img', + None, 'android-gingerbread')], 'bbench-gb': [SysConfig('bbench-gb.rcS', '256MB', - 'ARMv7a-Gingerbread-Android.SMP.mouse.nolock.img')], + 'ARMv7a-Gingerbread-Android.SMP.mouse.nolock.img', + None, 'android-gingerbread')], 'ArmAndroid-ICS': [SysConfig('null.rcS', '256MB', - 'ARMv7a-ICS-Android.SMP.nolock.clean.img')], + 'ARMv7a-ICS-Android.SMP.nolock.clean.img', + None, 'android-ics')], 'bbench-ics': [SysConfig('bbench-ics.rcS', '256MB', - 'ARMv7a-ICS-Android.SMP.nolock.img')] + 'ARMv7a-ICS-Android.SMP.nolock.img', + None, 'android-ics')] } benchs = Benchmarks.keys() diff --git a/configs/common/FSConfig.py b/configs/common/FSConfig.py index 462b8f6f7..cfc156649 100644 --- a/configs/common/FSConfig.py +++ b/configs/common/FSConfig.py @@ -43,6 +43,18 @@ from m5.objects import * from Benchmarks import * from m5.util import * +# Populate to reflect supported os types per target ISA +os_types = { 'alpha' : [ 'linux' ], + 'mips' : [ 'linux' ], + 'sparc' : [ 'linux' ], + 'x86' : [ 'linux' ], + 'arm' : [ 'linux', + 'android-gingerbread', + 'android-ics', + 'android-jellybean', + 'android-kitkat' ], + } + class CowIdeDisk(IdeDisk): image = CowDiskImage(child=RawDiskImage(read_only=True), read_only=False) @@ -54,7 +66,6 @@ class MemBus(SystemXBar): badaddr_responder = BadAddr() default = Self.badaddr_responder.pio - def fillInCmdline(mdesc, template, **kwargs): kwargs.setdefault('disk', mdesc.disk()) kwargs.setdefault('rootdev', mdesc.rootdev()) @@ -286,11 +297,31 @@ def makeArmSystem(mem_mode, machine_type, num_cpus=1, mdesc=None, self.gic_cpu_addr = self.realview.gic.cpu_addr self.flags_addr = self.realview.realview_io.pio_addr + 0x30 - # Android disk images must have 'android' keyword in the disk name - # Look for 'android' in disk name and append /init to boot_osflags + # This check is for users who have previously put 'android' in + # the disk image filename to tell the config scripts to + # prepare the kernel with android-specific boot options. That + # behavior has been replaced with a more explicit option per + # the error message below. The disk can have any name now and + # doesn't need to include 'android' substring. if (os.path.split(mdesc.disk())[-1]).lower().count('android'): - cmdline += " init=/init " + if 'android' not in mdesc.os_type(): + fatal("It looks like you are trying to boot an Android " \ + "platform. To boot Android, you must specify " \ + "--os-type with an appropriate Android release on " \ + "the command line.") + + # android-specific tweaks + if 'android' in mdesc.os_type(): + # generic tweaks + cmdline += " init=/init" + + # release-specific tweaks + if 'kitkat' in mdesc.os_type(): + cmdline += " androidboot.hardware=gem5 qemu=1 qemu.gles=0 " + \ + "android.bootanim=0" + self.boot_osflags = fillInCmdline(mdesc, cmdline) + self.realview.attachOnChipIO(self.membus, self.bridge) self.realview.attachIO(self.iobus) self.intrctrl = IntrControl() diff --git a/configs/common/Options.py b/configs/common/Options.py index 07059f23b..4cf1e6c5a 100644 --- a/configs/common/Options.py +++ b/configs/common/Options.py @@ -46,6 +46,8 @@ from Benchmarks import * import CpuConfig import MemConfig +from FSConfig import os_types + def _listCpuTypes(option, opt, value, parser): CpuConfig.print_cpu_list() sys.exit(0) @@ -241,6 +243,9 @@ def addFSOptions(parser): # System options parser.add_option("--kernel", action="store", type="string") + parser.add_option("--os-type", action="store", type="choice", + choices=os_types[buildEnv['TARGET_ISA']], default="linux", + help="Specifies type of OS to boot") parser.add_option("--script", action="store", type="string") parser.add_option("--frame-capture", action="store_true", help="Stores changed frame buffers from the VNC server to compressed "\ diff --git a/configs/example/fs.py b/configs/example/fs.py index 83b9b3267..98c7db480 100644 --- a/configs/example/fs.py +++ b/configs/example/fs.py @@ -314,12 +314,12 @@ if options.benchmark: else: if options.dual: bm = [SysConfig(disk=options.disk_image, rootdev=options.root_device, - mem=options.mem_size), + mem=options.mem_size, os_type=options.os_type), SysConfig(disk=options.disk_image, rootdev=options.root_device, - mem=options.mem_size)] + mem=options.mem_size, os_type=options.os_type)] else: bm = [SysConfig(disk=options.disk_image, rootdev=options.root_device, - mem=options.mem_size)] + mem=options.mem_size, os_type=options.os_type)] np = options.num_cpus |