Changeset df425da in mainline for tools/ew.py
- Timestamp:
- 2016-03-08T23:45:14Z (9 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d4d8255
- Parents:
- b6bbc74
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/ew.py
rb6bbc74 rdf425da 38 38 import autotool 39 39 import platform 40 import thread 41 import time 40 42 41 43 overrides = {} … … 46 48 return False 47 49 48 def cfg_get(platform, machine ):49 if machine == "" :50 def cfg_get(platform, machine, processor): 51 if machine == "" or emulators[platform].has_key("run"): 50 52 return emulators[platform] 51 el se:53 elif processor == "" or emulators[platform][machine].has_key("run"): 52 54 return emulators[platform][machine] 55 else: 56 return emulators[platform][machine][processor] 53 57 54 58 def run_in_console(cmd, title): … … 142 146 return ' -device intel-hda -device hda-duplex' 143 147 144 def qemu_run(platform, machine ):145 cfg = cfg_get(platform, machine )148 def qemu_run(platform, machine, processor): 149 cfg = cfg_get(platform, machine, processor) 146 150 suffix, options = platform_to_qemu_options(platform, machine) 147 151 cmd = 'qemu-' + suffix … … 177 181 subprocess.call(cmdline, shell = True) 178 182 179 def ski_run(platform, machine ):183 def ski_run(platform, machine, processor): 180 184 run_in_console('ski -i contrib/conf/ski.conf', 'HelenOS/ia64 on ski') 181 185 182 def msim_run(platform, machine ):186 def msim_run(platform, machine, processor): 183 187 hdisk_mk() 184 188 run_in_console('msim -c contrib/conf/msim.conf', 'HelenOS/mips32 on msim') 185 189 190 def gem5_console_thread(): 191 # Wait a little bit so that gem5 can create the port 192 time.sleep(1) 193 term = os.environ['M5_PATH'] + '/gem5/util/term/m5term' 194 port = 3457 195 run_in_console(term + ' %d' % port, 'HelenOS/sun4v on gem5') 196 197 def gem5_run(platform, machine, processor): 198 try: 199 gem5 = os.environ['M5_PATH'] + '/gem5/build/SPARC/gem5.fast' 200 if not os.path.exists(gem5): 201 raise Exception 202 except: 203 print("Did you forget to set M5_PATH?") 204 raise 205 206 thread.start_new_thread(gem5_console_thread, ()) 207 208 cmdline = gem5 + ' ' + os.environ['M5_PATH'] + '/configs/example/fs.py --disk-image=' + os.path.abspath('image.iso') 209 210 print(cmdline) 211 if not is_override('dry_run'): 212 subprocess.call(cmdline, shell = True) 186 213 187 214 emulators = { … … 229 256 'sparc64' : { 230 257 'generic' : { 231 'run' : qemu_run, 232 'image' : 'image.iso', 233 'audio' : False 258 'us' : { 259 'run' : qemu_run, 260 'image' : 'image.iso', 261 'audio' : False 262 }, 263 'sun4v' : { 264 'run' : gem5_run, 265 } 234 266 } 235 267 }, … … 247 279 print("-nosnd\tDisable sound, if applicable.") 248 280 print("-nousb\tDisable USB support, if applicable.") 281 282 def fail(platform, machine): 283 print("Cannot start emulation for the chosen configuration. (%s/%s)" % (platform, machine)) 284 249 285 250 286 def run(): … … 301 337 mach = '' 302 338 339 if 'PROCESSOR' in config.keys(): 340 processor = config['PROCESSOR'] 341 else: 342 processor = '' 343 303 344 try: 304 emu_run = cfg_get(platform, mach)['run'] 345 emu_run = cfg_get(platform, mach, processor)['run'] 346 emu_run(platform, mach, processor) 305 347 except: 306 print("Cannot start emulation for the chosen configuration. (%s/%s)" % (platform, mach))348 fail(platform, mach) 307 349 return 308 350 309 emu_run(platform, mach)310 311 351 run()
Note:
See TracChangeset
for help on using the changeset viewer.