Пример #1
0
def run():
    expect_nic = False
    expect_hdd = False
    expect_qemu = False

    for i in range(1, len(sys.argv)):

        if expect_nic:
            expect_nic = False
            if not 'net' in overrides.keys():
                overrides['net'] = {}
            if sys.argv[i] == 'e1k':
                overrides['net']['e1k'] = True
            elif sys.argv[i] == 'rtl8139':
                overrides['net']['rtl8139'] = True
            elif sys.argv[i] == 'ne2k':
                overrides['net']['ne2k'] = True
            elif sys.argv[i] == 'virtio-net':
                overrides['net']['virtio-net'] = True
            else:
                usage()
                exit()
            continue

        if expect_hdd:
            expect_hdd = False
            if not 'hdd' in overrides.keys():
                overrides['hdd'] = {}
            if sys.argv[i] == 'ata':
                overrides['hdd']['ata'] = True
            elif sys.argv[i] == 'virtio-blk':
                overrides['hdd']['virtio-blk'] = True
            else:
                usage()
                exit()
            continue

        if expect_qemu:
            expect_qemu = False
            overrides['qemu_path'] = sys.argv[i]

        elif sys.argv[i] == '-h':
            usage()
            exit()
        elif sys.argv[i] == '-d':
            overrides['dryrun'] = True
        elif sys.argv[i] == '-net' and i < len(sys.argv) - 1:
            expect_nic = True
        elif sys.argv[i] == '-hdd' and i < len(sys.argv) - 1:
            expect_hdd = True
        elif sys.argv[i] == '-nohdd':
            overrides['nohdd'] = True
        elif sys.argv[i] == '-nokvm':
            overrides['nokvm'] = True
        elif sys.argv[i] == '-nonet':
            overrides['nonet'] = True
        elif sys.argv[i] == '-nosnd':
            overrides['nosnd'] = True
        elif sys.argv[i] == '-nousb':
            overrides['nousb'] = True
        elif sys.argv[i] == '-noxhci':
            overrides['noxhci'] = True
        elif sys.argv[i] == '-notablet':
            overrides['notablet'] = True
        elif sys.argv[i] == '-nographic':
            overrides['nographic'] = True
        elif sys.argv[i] == '-bigmem':
            overrides['bigmem'] = True
        elif sys.argv[i] == '-noserial':
            overrides['noserial'] = True
        elif sys.argv[i] == '-qemu_path' and i < len(sys.argv) - 1:
            expect_qemu = True
        else:
            usage()
            exit()

    config = {}
    autotool.read_config(autotool.CONFIG, config)

    if 'PLATFORM' in config.keys():
        platform = config['PLATFORM']
    else:
        platform = ''

    if 'MACHINE' in config.keys():
        mach = config['MACHINE']
    else:
        mach = ''

    if 'PROCESSOR' in config.keys():
        processor = config['PROCESSOR']
    else:
        processor = ''

    try:
        emu_run = cfg_get(platform, mach, processor)['run']
        emu_run(platform, mach, processor)
    except:
        fail(platform, mach)
        return
Пример #2
0
def run():
    expect_nic = False

    for i in range(1, len(sys.argv)):

        if expect_nic:
            expect_nic = False
            if not 'net' in overrides.keys():
                overrides['net'] = {}
            if sys.argv[i] == 'e1k':
                overrides['net']['e1k'] = True
            elif sys.argv[i] == 'rtl8139':
                overrides['net']['rtl8139'] = True
            elif sys.argv[i] == 'ne2k':
                overrides['net']['ne2k'] = True
            else:
                usage()
                exit()

        elif sys.argv[i] == '-h':
            usage()
            exit()
        elif sys.argv[i] == '-d':
            overrides['dryrun'] = True
        elif sys.argv[i] == '-net' and i < len(sys.argv) - 1:
            expect_nic = True
        elif sys.argv[i] == '-nohdd':
            overrides['nohdd'] = True
        elif sys.argv[i] == '-nokvm':
            overrides['nokvm'] = True
        elif sys.argv[i] == '-nonet':
            overrides['nonet'] = True
        elif sys.argv[i] == '-nosnd':
            overrides['nosnd'] = True
        elif sys.argv[i] == '-nousb':
            overrides['nousb'] = True
        else:
            usage()
            exit()

    config = {}
    autotool.read_config(autotool.CONFIG, config)

    if 'PLATFORM' in config.keys():
        platform = config['PLATFORM']
    else:
        platform = ''

    if 'MACHINE' in config.keys():
        mach = config['MACHINE']
    else:
        mach = ''

    if 'PROCESSOR' in config.keys():
        processor = config['PROCESSOR']
    else:
        processor = ''

    try:
        emu_run = cfg_get(platform, mach, processor)['run']
        emu_run(platform, mach, processor)
    except:
        fail(platform, mach)
        return
Пример #3
0
def run():
    expect_nic = False

    for i in range(1, len(sys.argv)):

        if expect_nic:
            expect_nic = False
            if not 'net' in overrides.keys():
                overrides['net'] = {}
            if sys.argv[i] == 'e1k':
                overrides['net']['e1k'] = True
            elif sys.argv[i] == 'rtl8139':
                overrides['net']['rtl8139'] = True
            elif sys.argv[i] == 'ne2k':
                overrides['net']['ne2k'] = True
            else:
                usage()
                exit()

        elif sys.argv[i] == '-h':
            usage()
            exit()
        elif sys.argv[i] == '-d':
            overrides['dryrun'] = True
        elif sys.argv[i] == '-net' and i < len(sys.argv) - 1:
            expect_nic = True
        elif sys.argv[i] == '-nohdd':
            overrides['nohdd'] = True
        elif sys.argv[i] == '-nokvm':
            overrides['nokvm'] = True
        elif sys.argv[i] == '-nonet':
            overrides['nonet'] = True
        elif sys.argv[i] == '-nosnd':
            overrides['nosnd'] = True
        elif sys.argv[i] == '-nousb':
            overrides['nousb'] = True
        else:
            usage()
            exit()

    config = {}
    autotool.read_config(autotool.CONFIG, config)

    if 'PLATFORM' in config.keys():
        platform = config['PLATFORM']
    else:
        platform = ''

    if 'MACHINE' in config.keys():
        mach = config['MACHINE']
    else:
        mach = ''

    try:
        emu_run = cfg_get(platform, mach)['run']
    except:
        print("Cannot start emulation for the chosen configuration. (%s/%s)" %
              (platform, mach))
        return

    emu_run(platform, mach)