Changes in tools/ew.py [ecf0a04b:13eecc4] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/ew.py
recf0a04b r13eecc4 57 57 58 58 def termemu_detect(): 59 emus = ['gnome-terminal', 'xfce4-terminal', 'xterm'] 60 for termemu in emus: 59 for termemu in ['xfce4-terminal', 'xterm']: 61 60 try: 62 61 subprocess.check_output('which ' + termemu, shell = True) … … 65 64 pass 66 65 67 print('Could not find any of the terminal emulators %s.'%(emus))68 sys.exit(1)69 70 66 def 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 + '"' 78 69 print(cmdline) 79 70 if not is_override('dryrun'): … … 96 87 97 88 def 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' 117 90 118 91 def platform_to_qemu_options(platform, machine, processor): … … 121 94 elif platform == 'arm32': 122 95 return 'system-arm', '-M integratorcp' 123 elif platform == 'arm64':124 # Search for the EDK2 firmware image125 default_paths = (126 '/usr/local/qemu-efi-aarch64/QEMU_EFI.fd', # Custom127 '/usr/share/edk2/aarch64/QEMU_EFI.fd', # Fedora128 '/usr/share/qemu-efi-aarch64/QEMU_EFI.fd', # Ubuntu129 )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 Exception136 137 return 'system-aarch64', \138 '-M virt -cpu cortex-a57 -m 1024 -bios %s' % efi_path139 96 elif platform == 'ia32': 140 97 return 'system-i386', pc_options(32) … … 151 108 if processor == 'us': 152 109 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)) 159 122 raise Exception 160 123 … … 245 208 cmdline += ' ' + options 246 209 247 if (not 'hdd' in cfg.keys() or cfg['hdd']):248 cmdline += qemu_bd_options() 210 cmdline += qemu_bd_options() 211 249 212 if (not 'net' in cfg.keys()) or cfg['net']: 250 213 cmdline += qemu_net_options() … … 271 234 if cfg['image'] == 'image.iso': 272 235 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'280 236 elif cfg['image'] == 'image.boot': 281 237 cmdline += ' -kernel image.boot' … … 320 276 'xhci' : False, 321 277 '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' : False335 278 } 336 279 },
Note:
See TracChangeset
for help on using the changeset viewer.