mirror of
https://git.yoctoproject.org/meta-arm
synced 2026-04-20 11:29:54 +00:00
runfvp: ensure the default terminal is usable
Pick a default terminal which will actually work, instead of defaulting to xterm even if xterm isn't installed. Also show the default in the --help output. Change-Id: Ib3e7c32917725f404a171248549b6f9c0afe8158 Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Jon Mason <jon.mason@arm.com>
This commit is contained in:
@@ -19,6 +19,16 @@ terminal_map = {
|
||||
# TODO more terminals
|
||||
}
|
||||
|
||||
def get_default_terminal():
|
||||
import shutil
|
||||
import shlex
|
||||
|
||||
for terminal in "xterm",:
|
||||
command = shlex.split(terminal_map[terminal])[0]
|
||||
if shutil.which(command):
|
||||
return terminal
|
||||
return "none"
|
||||
|
||||
def get_image_directory(machine=None):
|
||||
"""
|
||||
Get the DEPLOY_DIR_IMAGE for the specified machine
|
||||
@@ -42,7 +52,7 @@ def parse_args(arguments):
|
||||
parser = argparse.ArgumentParser(description="Run images in a FVP")
|
||||
parser.add_argument("config", nargs="?", help="Machine name or path to .fvpconf file")
|
||||
group = parser.add_mutually_exclusive_group()
|
||||
group.add_argument("-t", "--terminals", choices=terminal_map.keys(), default="xterm", help="Automatically start terminals")
|
||||
group.add_argument("-t", "--terminals", choices=terminal_map.keys(), default=get_default_terminal(), help="Automatically start terminals (default: %(default)s)")
|
||||
group.add_argument("-c", "--console", action="store_true", help="Attach the first uart to stdin/stdout")
|
||||
parser.add_argument("--verbose", action="store_true", help="Output verbose logging")
|
||||
parser.usage = f"{parser.format_usage().strip()} -- [ arguments passed to FVP ]"
|
||||
|
||||
Reference in New Issue
Block a user