Changes in tools/ew.py [e9c1639:c35cc8b] in mainline


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/ew.py

    re9c1639 rc35cc8b  
    7676
    7777def termemu_detect():
    78         emus = ['gnome-terminal', 'xfce4-terminal', 'xterm']
     78        emus = ['gnome-terminal', 'foot', 'xfce4-terminal', 'xterm']
     79
     80        if 'TERMINAL' in os.environ:
     81                emus.insert(0, os.environ['TERMINAL'])
     82
    7983        for termemu in emus:
    8084                try:
    81                         subprocess.check_output('which ' + termemu, shell = True)
     85                        subprocess.check_output('which ' + termemu, shell = True, stderr = subprocess.STDOUT)
    8286                        return termemu
    8387                except:
     
    8993def run_in_console(cmd, title):
    9094        temu = termemu_detect()
    91         if temu == 'gnome-terminal':
     95
     96        if os.path.basename(temu.split(' ')[0]) in ['gnome-terminal', 'foot']:
    9297                cmdline = temu + ' -- ' + cmd
    9398        else:
     
    139144                return 'system-x86_64', pc_options(64)
    140145        elif platform == 'arm32':
    141                 return 'system-arm', '-M integratorcp'
     146                if machine == 'integratorcp':
     147                        return 'system-arm', '-M integratorcp'
     148                elif machine == 'raspberrypi':
     149                        return 'system-arm', '-M raspi1ap'
    142150        elif platform == 'arm64':
    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
     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
    158167        elif platform == 'ia32':
    159168                return 'system-i386', pc_options(32)
     
    169178                        raise Exception
    170179                if processor == 'us':
    171                         return 'system-sparc64', '-M sun4u --prom-env boot-args="console=devices/\\hw\\pci0\\01:01.0\\com1\\a"'
     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
    172184
    173185                # processor = 'sun4v'
     
    256268        suffix, options = platform_to_qemu_options(platform, machine, processor)
    257269        cmd = 'qemu-' + suffix
    258 
    259         if cpus:
    260         cmd += ' -smp cpus=' + cpus + ' '
    261270
    262271        cmdline = cmd
     
    284293        if (is_override('nographic')):
    285294                cmdline += ' -nographic'
     295                console = True
    286296
    287297        if (not console and (not is_override('nographic')) and not is_override('noserial')):
     
    302312        elif cfg['image'] == 'image.boot':
    303313                cmdline += ' -kernel image.boot'
     314        elif cfg['image'] == 'kernel.img@rpi':
     315                cmdline += ' -bios boot/image.boot.bin'
    304316        else:
    305317                cmdline += ' ' + cfg['image']
     
    324336def msim_run(platform, machine, processor):
    325337        hdisk_mk()
    326         run_in_console('msim -c ' + TOOLS_DIR + '/conf/msim.conf', 'HelenOS/mips32 on msim')
     338        run_in_console('msim -n -c ' + TOOLS_DIR + '/conf/msim.conf', 'HelenOS/mips32 on msim')
    327339
    328340def spike_run(platform, machine, processor):
     
    342354                        'xhci' : False,
    343355                        'tablet' : False
    344                 }
     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                },
    345368        },
    346369        'arm64' : {
     
    396419                                'image' : 'image.iso',
    397420                                'audio' : False,
    398                                 'console' : True,
     421                                'console' : False,
    399422                                'net' : False,
    400423                                'usb' : False,
     
    404427                        'sun4v' : {
    405428                                'run' : qemu_run,
    406                                 'image' : '-drive if=pflash,readonly=on,file=image.iso',
     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',
    407433                                'audio' : False,
    408434                                'console' : True,
     
    422448def usage():
    423449        print("%s - emulator wrapper for running HelenOS\n" % os.path.basename(sys.argv[0]))
    424         print("%s [$] [-d] [-h] [-net e1k|rtl8139|ne2k|virtio-net] [-hdd ata|virtio-blk] [-nohdd] [-nokvm] [-nonet] [-nosnd] [-nousb] [-noxhci] [-notablet]\n" %
     450        print("%s [-d] [-h] [-net e1k|rtl8139|ne2k|virtio-net] [-hdd ata|virtio-blk] [-nohdd] [-nokvm] [-nonet] [-nosnd] [-nousb] [-noxhci] [-notablet]\n" %
    425451            os.path.basename(sys.argv[0]))
    426         print("$\t to run multiple($) cpus")
    427452        print("-d\tDry run: do not run the emulation, just print the command line.")
    428453        print("-h\tPrint the usage information and exit.")
     
    446471        expect_hdd = False
    447472        expect_qemu = False
    448         global cpus
    449     cpus = ''
    450473
    451474        for i in range(1, len(sys.argv)):
     
    488511                        usage()
    489512                        exit()
    490                 elif sys.argv[i].isdigit():
    491             cpus = sys.argv[i]
    492513                elif sys.argv[i] == '-d':
    493514                        overrides['dryrun'] = True
Note: See TracChangeset for help on using the changeset viewer.