Changes in tools/ew.py [ecf0a04b:13eecc4] in mainline


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/ew.py

    recf0a04b r13eecc4  
    5757
    5858def termemu_detect():
    59         emus = ['gnome-terminal', 'xfce4-terminal', 'xterm']
    60         for termemu in emus:
     59        for termemu in ['xfce4-terminal', 'xterm']:
    6160                try:
    6261                        subprocess.check_output('which ' + termemu, shell = True)
     
    6564                        pass
    6665
    67         print('Could not find any of the terminal emulators %s.'%(emus))
    68         sys.exit(1)
    69 
    7066def run_in_console(cmd, title):
    71         temu = termemu_detect()
    72         if temu == 'gnome-terminal':
    73                 cmdline = temu + ' -- ' + cmd
    74         else:
    75                 ecmd = cmd.replace('"', '\\"')
    76                 cmdline = temu + ' -T ' + '"' + title + '"' + ' -e "' + ecmd + '"'
    77 
     67        ecmd = cmd.replace('"', '\\"')
     68        cmdline = termemu_detect() + ' -T ' + '"' + title + '"' + ' -e "' + ecmd + '"'
    7869        print(cmdline)
    7970        if not is_override('dryrun'):
     
    9687
    9788def malta_options():
    98         return '-cpu 4Kc -append "console=devices/\\hw\\pci0\\00:0a.0\\com1\\a"'
    99 
    100 def find_firmware(name, environ_var, default_paths, extra_info=None):
    101         """Find firmware image(s)."""
    102 
    103         if environ_var in os.environ:
    104                 return os.environ[environ_var]
    105 
    106         for path in default_paths:
    107                 if os.path.exists(path):
    108                         return path
    109 
    110         sys.stderr.write("Cannot find %s binary image(s)!\n" % name)
    111         sys.stderr.write(
    112             "Either set %s environment variable accordingly or place the image(s) in one of the default locations: %s.\n" %
    113             (environ_var, ", ".join(default_paths)))
    114         if extra_info is not None:
    115                 sys.stderr.write(extra_info)
    116         return None
     89        return '-cpu 4Kc'
    11790
    11891def platform_to_qemu_options(platform, machine, processor):
     
    12194        elif platform == 'arm32':
    12295                return 'system-arm', '-M integratorcp'
    123         elif platform == 'arm64':
    124                 # Search for the EDK2 firmware image
    125                 default_paths = (
    126                         '/usr/local/qemu-efi-aarch64/QEMU_EFI.fd', # Custom
    127                         '/usr/share/edk2/aarch64/QEMU_EFI.fd',     # Fedora
    128                         '/usr/share/qemu-efi-aarch64/QEMU_EFI.fd', # Ubuntu
    129                 )
    130                 extra_info = ("Pre-compiled binary can be obtained from "
    131                     "http://snapshots.linaro.org/components/kernel/leg-virt-tianocore-edk2-upstream/latest/QEMU-AARCH64/RELEASE_GCC49/QEMU_EFI.fd.\n")
    132                 efi_path = find_firmware(
    133                     "EDK2", 'EW_QEMU_EFI_AARCH64', default_paths, extra_info)
    134                 if efi_path is None:
    135                         raise Exception
    136 
    137                 return 'system-aarch64', \
    138                     '-M virt -cpu cortex-a57 -m 1024 -bios %s' % efi_path
    13996        elif platform == 'ia32':
    14097                return 'system-i386', pc_options(32)
     
    151108                if processor == 'us':
    152109                        return 'system-sparc64', '-M sun4u --prom-env boot-args="console=devices/\\hw\\pci0\\01:01.0\\com1\\a"'
    153 
    154                 # processor = 'sun4v'
    155                 opensparc_bins = find_firmware(
    156                     "OpenSPARC", 'OPENSPARC_BINARIES',
    157                     ('/usr/local/opensparc/image/', ))
    158                 if opensparc_bins is None:
     110                elif processor == 'sun4v':
     111                        default_path = '/usr/local/opensparc/image/'
     112                try:
     113                        if os.path.exists(default_path):
     114                                opensparc_bins = default_path
     115                        elif os.path.exists(os.environ['OPENSPARC_BINARIES']):
     116                                opensparc_bins = os.environ['OPENSPARC_BINARIES']
     117                        else:
     118                                raise Exception
     119                except:
     120                        print("Cannot find OpenSPARC binary images!")
     121                        print("Either set OPENSPARC_BINARIES environment variable accordingly or place the images in %s." % (default_path))
    159122                        raise Exception
    160123
     
    245208                cmdline += ' ' + options
    246209
    247         if (not 'hdd' in cfg.keys() or cfg['hdd']):
    248                 cmdline += qemu_bd_options()
     210        cmdline += qemu_bd_options()
     211
    249212        if (not 'net' in cfg.keys()) or cfg['net']:
    250213                cmdline += qemu_net_options()
     
    271234        if cfg['image'] == 'image.iso':
    272235                cmdline += ' -boot d -cdrom image.iso'
    273         elif cfg['image'] == 'image.iso@arm64':
    274                 # Define image.iso cdrom backend.
    275                 cmdline += ' -drive if=none,file=image.iso,id=cdrom,media=cdrom'
    276                 # Define scsi bus.
    277                 cmdline += ' -device virtio-scsi-device'
    278                 # Define cdrom frontend connected to this scsi bus.
    279                 cmdline += ' -device scsi-cd,drive=cdrom'
    280236        elif cfg['image'] == 'image.boot':
    281237                cmdline += ' -kernel image.boot'
     
    320276                        'xhci' : False,
    321277                        'tablet' : False
    322                 }
    323         },
    324         'arm64' : {
    325                 'virt' : {
    326                         'run' : qemu_run,
    327                         'image' : 'image.iso@arm64',
    328                         'audio' : False,
    329                         'console' : True,
    330                         'hdd' : False,
    331                         'net' : False,
    332                         'tablet' : False,
    333                         'usb' : False,
    334                         'xhci' : False
    335278                }
    336279        },
Note: See TracChangeset for help on using the changeset viewer.