92
111
return ' -device rtl8139,vlan=0'
94
113
def qemu_net_options():
95
nic_options = qemu_nic_e1k_options()
114
if is_override('nonet'):
118
if 'net' in overrides.keys():
119
if 'e1k' in overrides['net'].keys():
120
nic_options += qemu_nic_e1k_options()
121
if 'rtl8139' in overrides['net'].keys():
122
nic_options += qemu_nic_rtl8139_options()
123
if 'ne2k' in overrides['net'].keys():
124
nic_options += qemu_nic_ne2k_options()
126
# Use the default NIC
127
nic_options += qemu_nic_e1k_options()
96
129
return nic_options + ' -net user -redir udp:8080::8080 -redir udp:8081::8081 -redir tcp:8080::8080 -redir tcp:8081::8081 -redir tcp:2223::2223'
98
131
def qemu_usb_options():
101
def qemu_run(platform, machine, console, image, networking, storage, usb):
132
if is_override('nousb'):
136
def qemu_audio_options():
137
if is_override('nosnd'):
139
return ' -soundhw sb16'
141
def qemu_run(platform, machine):
142
cfg = cfg_get(platform, machine)
102
143
suffix, options = platform_to_qemu_options(platform, machine)
103
144
cmd = 'qemu-' + suffix
127
170
run_in_console(cmdline, title)
130
subprocess.call(cmdline, shell = True)
173
if not is_override('dryrun'):
174
subprocess.call(cmdline, shell = True)
132
def ski_run(platform, machine, console, image, networking, storage, usb):
176
def ski_run(platform, machine):
133
177
run_in_console('ski -i contrib/conf/ski.conf', 'HelenOS/ia64 on ski')
135
def msim_run(platform, machine, console, image, networking, storage, usb):
179
def msim_run(platform, machine):
136
180
run_in_console('msim -c contrib/conf/msim.conf', 'HelenOS/mips32 on msim')
139
emulators['amd64'] = {}
140
emulators['arm32'] = {}
141
emulators['ia32'] = {}
142
emulators['ia64'] = {}
143
emulators['mips32'] = {}
144
emulators['ppc32'] = {}
145
emulators['sparc64'] = {}
147
emulators['amd64'][''] = qemu_run, True, 'image.iso', True, True, True
148
emulators['arm32']['integratorcp'] = qemu_run, True, 'image.boot', False, False, False
149
emulators['ia32'][''] = qemu_run, True, 'image.iso', True, True, True
150
emulators['ia64']['ski'] = ski_run, False, 'image.boot', False, False, False
151
emulators['mips32']['msim'] = msim_run, False, 'image.boot', False, False, False
152
emulators['mips32']['lmalta'] = qemu_run, False, 'image.boot', False, False, False
153
emulators['mips32']['bmalta'] = qemu_run, False, 'image.boot', False, False, False
154
emulators['ppc32'][''] = qemu_run, True, 'image.iso', True, True, True
155
emulators['sparc64']['generic'] = qemu_run, True, 'image.iso', True, True, True
186
'image' : 'image.iso'
191
'image' : 'image.boot',
198
'image' : 'image.iso'
211
'image' : 'image.boot',
216
'image' : 'image.boot',
222
'image' : 'image.iso',
228
'image' : 'image.iso',
235
print("%s - emulator wrapper for running HelenOS\n" % os.path.basename(sys.argv[0]))
236
print("%s [-d] [-h] [-net e1k|rtl8139|ne2k] [-nohdd] [-nokvm] [-nonet] [-nosnd] [-nousb]\n" %
237
os.path.basename(sys.argv[0]))
238
print("-d\tDry run: do not run the emulation, just print the command line.")
239
print("-h\tPrint the usage information and exit.")
240
print("-nohdd\tDisable hard disk, if applicable.")
241
print("-nokvm\tDisable KVM, if applicable.")
242
print("-nonet\tDisable networking support, if applicable.")
243
print("-nosnd\tDisable sound, if applicable.")
244
print("-nousb\tDisable USB support, if applicable.")
249
for i in range(1, len(sys.argv)):
253
if not 'net' in overrides.keys():
254
overrides['net'] = {}
255
if sys.argv[i] == 'e1k':
256
overrides['net']['e1k'] = True
257
elif sys.argv[i] == 'rtl8139':
258
overrides['net']['rtl8139'] = True
259
elif sys.argv[i] == 'ne2k':
260
overrides['net']['ne2k'] = True
265
elif sys.argv[i] == '-h':
268
elif sys.argv[i] == '-d':
269
overrides['dryrun'] = True
270
elif sys.argv[i] == '-net' and i < len(sys.argv) - 1:
272
elif sys.argv[i] == '-nohdd':
273
overrides['nohdd'] = True
274
elif sys.argv[i] == '-nokvm':
275
overrides['nokvm'] = True
276
elif sys.argv[i] == '-nonet':
277
overrides['nonet'] = True
278
elif sys.argv[i] == '-nosnd':
279
overrides['nosnd'] = True
280
elif sys.argv[i] == '-nousb':
281
overrides['nousb'] = True
159
287
autotool.read_config(autotool.CONFIG, config)
289
if 'PLATFORM' in config.keys():
162
290
platform = config['PLATFORM']
294
if 'MACHINE' in config.keys():
167
295
mach = config['MACHINE']
172
emu_run, console, image, networking, storage, usb = emulators[platform][mach]
300
emu_run = cfg_get(platform, mach)['run']
174
print("Cannot start emulation for the chosen configuration.")
302
print("Cannot start emulation for the chosen configuration. (%s/%s)" % (platform, mach))
177
emu_run(platform, mach, console, image, networking, storage, usb)
305
emu_run(platform, mach)