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


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/ew.py

    r739bc43 r13eecc4  
    8989        return '-cpu 4Kc'
    9090
    91 def find_firmware(name, environ_var, default_paths, extra_info=None):
    92         """Find firmware image(s)."""
    93 
    94         if environ_var in os.environ:
    95                 return os.environ[environ_var]
    96 
    97         for path in default_paths:
    98                 if os.path.exists(path):
    99                         return path
    100 
    101         sys.stderr.write("Cannot find %s binary image(s)!\n" % name)
    102         sys.stderr.write(
    103             "Either set %s environment variable accordingly or place the image(s) in one of the default locations: %s.\n" %
    104             (environ_var, ", ".join(default_paths)))
    105         if extra_info is not None:
    106                 sys.stderr.write(extra_info)
    107         return None
    108 
    10991def platform_to_qemu_options(platform, machine, processor):
    11092        if platform == 'amd64':
     
    11294        elif platform == 'arm32':
    11395                return 'system-arm', '-M integratorcp'
    114         elif platform == 'arm64':
    115                 # Search for the EDK2 firmware image
    116                 default_paths = (
    117                         '/usr/local/qemu-efi-aarch64/QEMU_EFI.fd', # Custom
    118                         '/usr/share/edk2/aarch64/QEMU_EFI.fd',     # Fedora
    119                         '/usr/share/qemu-efi-aarch64/QEMU_EFI.fd', # Ubuntu
    120                 )
    121                 extra_info = ("Pre-compiled binary can be obtained from "
    122                     "http://snapshots.linaro.org/components/kernel/leg-virt-tianocore-edk2-upstream/latest/QEMU-AARCH64/RELEASE_GCC49/QEMU_EFI.fd.\n")
    123                 efi_path = find_firmware(
    124                     "EDK2", 'EW_QEMU_EFI_AARCH64', default_paths, extra_info)
    125                 if efi_path is None:
    126                         raise Exception
    127 
    128                 return 'system-aarch64', \
    129                     '-M virt -cpu cortex-a57 -m 1024 -bios %s' % efi_path
    13096        elif platform == 'ia32':
    13197                return 'system-i386', pc_options(32)
     
    142108                if processor == 'us':
    143109                        return 'system-sparc64', '-M sun4u --prom-env boot-args="console=devices/\\hw\\pci0\\01:01.0\\com1\\a"'
    144 
    145                 # processor = 'sun4v'
    146                 opensparc_bins = find_firmware(
    147                     "OpenSPARC", 'OPENSPARC_BINARIES',
    148                     ('/usr/local/opensparc/image/', ))
    149                 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))
    150122                        raise Exception
    151123
     
    236208                cmdline += ' ' + options
    237209
    238         if (not 'hdd' in cfg.keys() or cfg['hdd']):
    239                 cmdline += qemu_bd_options()
     210        cmdline += qemu_bd_options()
     211
    240212        if (not 'net' in cfg.keys()) or cfg['net']:
    241213                cmdline += qemu_net_options()
     
    262234        if cfg['image'] == 'image.iso':
    263235                cmdline += ' -boot d -cdrom image.iso'
    264         elif cfg['image'] == 'image.iso@arm64':
    265                 # Define image.iso cdrom backend.
    266                 cmdline += ' -drive if=none,file=image.iso,id=cdrom,media=cdrom'
    267                 # Define scsi bus.
    268                 cmdline += ' -device virtio-scsi-device'
    269                 # Define cdrom frontend connected to this scsi bus.
    270                 cmdline += ' -device scsi-cd,drive=cdrom'
    271236        elif cfg['image'] == 'image.boot':
    272237                cmdline += ' -kernel image.boot'
     
    311276                        'xhci' : False,
    312277                        'tablet' : False
    313                 }
    314         },
    315         'arm64' : {
    316                 'virt' : {
    317                         'run' : qemu_run,
    318                         'image' : 'image.iso@arm64',
    319                         'audio' : False,
    320                         'console' : True,
    321                         'hdd' : False,
    322                         'net' : False,
    323                         'tablet' : False,
    324                         'usb' : False,
    325                         'xhci' : False
    326278                }
    327279        },
Note: See TracChangeset for help on using the changeset viewer.