Changeset 9185e42 in mainline for tools/ew.py


Ignore:
Timestamp:
2017-01-22T10:52:17Z (7 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
61b208f
Parents:
bfa4ffa
Message:

Replace gem5 support in favor of qemu-system-sparc64 -M niagara support

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/ew.py

    rbfa4ffa r9185e42  
    8080        return '-cpu 4Kc'
    8181
    82 def platform_to_qemu_options(platform, machine):
     82def platform_to_qemu_options(platform, machine, processor):
    8383        if platform == 'amd64':
    8484                return 'system-x86_64', pc_options(64)
     
    9595                return 'system-ppc', '-m 256'
    9696        elif platform == 'sparc64':
    97                 return 'system-sparc64', '--prom-env boot-args="console=devices/\\hw\\pci0\\00:03.0\\com1\\a"'
     97                if machine != 'generic':
     98                        raise Exception
     99                if processor == 'us':
     100                        return 'system-sparc64', '-M sun4u --prom-env boot-args="console=devices/\\hw\\pci0\\00:03.0\\com1\\a"'
     101                elif processor == 'sun4v':
     102                        default_path = '/usr/local/opensparc/image/'
     103                try:
     104                        if os.path.exists(default_path):
     105                                opensparc_bins = default_path
     106                        elif os.path.exists(os.environ['OPENSPARC_BINARIES']):
     107                                opensparc_bins = os.environ['OPENSPARC_BINARIES']
     108                        else:
     109                                raise Exception
     110                except:
     111                        print("Cannot find OpenSPARC binary images!")
     112                        print("Either set OPENSPARC_BINARIES environment variable accordingly or place the images in %s." % (default_path))
     113                        raise Exception
     114
     115                return 'system-sparc64', '-M niagara -m 256 -L %s' % (opensparc_bins)
     116
    98117
    99118def hdisk_mk():
     
    148167def qemu_run(platform, machine, processor):
    149168        cfg = cfg_get(platform, machine, processor)
    150         suffix, options = platform_to_qemu_options(platform, machine)
     169        suffix, options = platform_to_qemu_options(platform, machine, processor)
    151170        cmd = 'qemu-' + suffix
    152171
     
    168187        elif cfg['image'] == 'image.boot':
    169188                cmdline += ' -kernel image.boot'
     189        else:
     190                cmdline += ' ' + cfg['image']
    170191
    171192        if ('console' in cfg.keys()) and not cfg['console']:
     
    175196                if machine != '':
    176197                        title += ' on ' + machine
     198                if 'expect' in cfg.keys():
     199                        cmdline = 'expect -c \'spawn %s; expect "%s" { send "%s" } timeout exp_continue; interact\'' % (cmdline, cfg['expect']['src'], cfg['expect']['dst'])
    177200                run_in_console(cmdline, title)
    178201        else:
     
    190213def spike_run(platform, machine, processor):
    191214        run_in_console('spike image.boot', 'HelenOS/risvc64 on Spike')
    192 
    193 def gem5_console_thread():
    194         # Wait a little bit so that gem5 can create the port
    195         time.sleep(1)
    196         term = os.environ['M5_PATH'] + '/gem5/util/term/m5term'
    197         port = 3457
    198         run_in_console('expect -c \'spawn %s %d; expect "ok " { send "boot\n" } timeout exp_continue; interact\'' % (term, port), 'HelenOS/sun4v on gem5')
    199 
    200 def gem5_run(platform, machine, processor):
    201         try:
    202                 gem5 = os.environ['M5_PATH'] + '/gem5/build/SPARC/gem5.fast'
    203                 if not os.path.exists(gem5):
    204                         raise Exception
    205         except:
    206                 print("Did you forget to set M5_PATH?")
    207                 raise
    208 
    209         thread.start_new_thread(gem5_console_thread, ())
    210 
    211         cmdline = gem5 + ' ' + os.environ['M5_PATH'] + '/configs/example/fs.py --disk-image=' + os.path.abspath('image.iso')
    212 
    213         print(cmdline)
    214         if not is_override('dry_run'):
    215                 subprocess.call(cmdline, shell = True)
    216215
    217216emulators = {
     
    270269                        },
    271270                        'sun4v' : {
    272                                 'run' : gem5_run,
     271                                'run' : qemu_run,
     272                                'image' : '-drive if=pflash,readonly=on,file=image.iso',
     273                                'audio' : False,
     274                                'console' : False,
     275                                'net' : False,
     276                                'usb' : False,
     277                                'expect' : {
     278                                        'src' : 'ok ',
     279                                        'dst' : 'boot\n'
     280                                },
    273281                        }
    274282                }
Note: See TracChangeset for help on using the changeset viewer.