Changes in tools/ew.py [c35cc8b:e9c1639] in mainline
- File:
-
- 1 edited
-
tools/ew.py (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tools/ew.py
rc35cc8b re9c1639 76 76 77 77 def termemu_detect(): 78 emus = ['gnome-terminal', 'foot', 'xfce4-terminal', 'xterm'] 79 80 if 'TERMINAL' in os.environ: 81 emus.insert(0, os.environ['TERMINAL']) 82 78 emus = ['gnome-terminal', 'xfce4-terminal', 'xterm'] 83 79 for termemu in emus: 84 80 try: 85 subprocess.check_output('which ' + termemu, shell = True , stderr = subprocess.STDOUT)81 subprocess.check_output('which ' + termemu, shell = True) 86 82 return termemu 87 83 except: … … 93 89 def run_in_console(cmd, title): 94 90 temu = termemu_detect() 95 96 if os.path.basename(temu.split(' ')[0]) in ['gnome-terminal', 'foot']: 91 if temu == 'gnome-terminal': 97 92 cmdline = temu + ' -- ' + cmd 98 93 else: … … 144 139 return 'system-x86_64', pc_options(64) 145 140 elif platform == 'arm32': 146 if machine == 'integratorcp': 147 return 'system-arm', '-M integratorcp' 148 elif machine == 'raspberrypi': 149 return 'system-arm', '-M raspi1ap' 141 return 'system-arm', '-M integratorcp' 150 142 elif platform == 'arm64': 151 if machine == 'virt': 152 # Search for the EDK2 firmware image 153 default_paths = ( 154 '/usr/local/qemu-efi-aarch64/QEMU_EFI.fd', # Custom 155 '/usr/share/edk2/aarch64/QEMU_EFI.fd', # Fedora 156 '/usr/share/qemu-efi-aarch64/QEMU_EFI.fd', # Ubuntu 157 ) 158 extra_info = ("Pre-compiled binary can be obtained from " 159 "http://snapshots.linaro.org/components/kernel/leg-virt-tianocore-edk2-upstream/latest/QEMU-AARCH64/RELEASE_GCC5/QEMU_EFI.fd.\n") 160 efi_path = find_firmware( 161 "EDK2", 'EW_QEMU_EFI_AARCH64', default_paths, extra_info) 162 if efi_path is None: 163 raise Exception 164 165 return 'system-aarch64', \ 166 '-M virt -cpu cortex-a57 -m 1024 -bios %s' % efi_path 143 # Search for the EDK2 firmware image 144 default_paths = ( 145 '/usr/local/qemu-efi-aarch64/QEMU_EFI.fd', # Custom 146 '/usr/share/edk2/aarch64/QEMU_EFI.fd', # Fedora 147 '/usr/share/qemu-efi-aarch64/QEMU_EFI.fd', # Ubuntu 148 ) 149 extra_info = ("Pre-compiled binary can be obtained from " 150 "http://snapshots.linaro.org/components/kernel/leg-virt-tianocore-edk2-upstream/latest/QEMU-AARCH64/RELEASE_GCC5/QEMU_EFI.fd.\n") 151 efi_path = find_firmware( 152 "EDK2", 'EW_QEMU_EFI_AARCH64', default_paths, extra_info) 153 if efi_path is None: 154 raise Exception 155 156 return 'system-aarch64', \ 157 '-M virt -cpu cortex-a57 -m 1024 -bios %s' % efi_path 167 158 elif platform == 'ia32': 168 159 return 'system-i386', pc_options(32) … … 178 169 raise Exception 179 170 if processor == 'us': 180 cmdline = '-M sun4u' 181 if is_override('nographic'): 182 cmdline += ' --prom-env boot-args="console=devices/\\hw\\pci0\\01:01.0\\com1\\a"' 183 return 'system-sparc64', cmdline 171 return 'system-sparc64', '-M sun4u --prom-env boot-args="console=devices/\\hw\\pci0\\01:01.0\\com1\\a"' 184 172 185 173 # processor = 'sun4v' … … 268 256 suffix, options = platform_to_qemu_options(platform, machine, processor) 269 257 cmd = 'qemu-' + suffix 258 259 if cpus: 260 cmd += ' -smp cpus=' + cpus + ' ' 270 261 271 262 cmdline = cmd … … 293 284 if (is_override('nographic')): 294 285 cmdline += ' -nographic' 295 console = True296 286 297 287 if (not console and (not is_override('nographic')) and not is_override('noserial')): … … 312 302 elif cfg['image'] == 'image.boot': 313 303 cmdline += ' -kernel image.boot' 314 elif cfg['image'] == 'kernel.img@rpi':315 cmdline += ' -bios boot/image.boot.bin'316 304 else: 317 305 cmdline += ' ' + cfg['image'] … … 336 324 def msim_run(platform, machine, processor): 337 325 hdisk_mk() 338 run_in_console('msim - n -c ' + TOOLS_DIR + '/conf/msim.conf', 'HelenOS/mips32 on msim')326 run_in_console('msim -c ' + TOOLS_DIR + '/conf/msim.conf', 'HelenOS/mips32 on msim') 339 327 340 328 def spike_run(platform, machine, processor): … … 354 342 'xhci' : False, 355 343 'tablet' : False 356 }, 357 'raspberrypi' : { 358 'run' : qemu_run, 359 'image' : 'kernel.img@rpi', 360 'audio' : False, 361 'console' : True, 362 'hdd' : False, 363 'net' : False, 364 'tablet' : False, 365 'usb' : False, 366 'xhci' : False 367 }, 344 } 368 345 }, 369 346 'arm64' : { … … 419 396 'image' : 'image.iso', 420 397 'audio' : False, 421 'console' : False,398 'console' : True, 422 399 'net' : False, 423 400 'usb' : False, … … 427 404 'sun4v' : { 428 405 'run' : qemu_run, 429 # QEMU 8.0.0 ignores the 'file' argument and instead uses 'id', 430 # which defaults to 'pflash0', but can be changed to the same value 431 # as 'file' 432 'image' : '-drive if=pflash,id=image.iso,readonly=on,file=image.iso', 406 'image' : '-drive if=pflash,readonly=on,file=image.iso', 433 407 'audio' : False, 434 408 'console' : True, … … 448 422 def usage(): 449 423 print("%s - emulator wrapper for running HelenOS\n" % os.path.basename(sys.argv[0])) 450 print("%s [ -d] [-h] [-net e1k|rtl8139|ne2k|virtio-net] [-hdd ata|virtio-blk] [-nohdd] [-nokvm] [-nonet] [-nosnd] [-nousb] [-noxhci] [-notablet]\n" %424 print("%s [$] [-d] [-h] [-net e1k|rtl8139|ne2k|virtio-net] [-hdd ata|virtio-blk] [-nohdd] [-nokvm] [-nonet] [-nosnd] [-nousb] [-noxhci] [-notablet]\n" % 451 425 os.path.basename(sys.argv[0])) 426 print("$\t to run multiple($) cpus") 452 427 print("-d\tDry run: do not run the emulation, just print the command line.") 453 428 print("-h\tPrint the usage information and exit.") … … 471 446 expect_hdd = False 472 447 expect_qemu = False 448 global cpus 449 cpus = '' 473 450 474 451 for i in range(1, len(sys.argv)): … … 511 488 usage() 512 489 exit() 490 elif sys.argv[i].isdigit(): 491 cpus = sys.argv[i] 513 492 elif sys.argv[i] == '-d': 514 493 overrides['dryrun'] = True
Note:
See TracChangeset
for help on using the changeset viewer.
