@@ -33,6 +33,8 @@ The tool attempts to automatically select a suitable terminal type. To see which
`runfvp` determines availability by checking for required executables in your PATH as well as environment variables specific to each terminal type. If any of these checks fail, the corresponding terminal type is disabled.
The --help output also lists all currently available terminal types.
+When using `-terminals=screen`, `runfvp` must be launched from within an existing [`screen`][screen] session. Normally, screen sets the `STY` environment variable to reference the current session. However, if the session is renamed or if `kas` is started from within the screen session, this value may become invalid or be lost. In such cases, `STY` must be set manually. Use `screen -ls` to view the list of currently attached sessions.
+
The default terminal can also be configured by writing a [INI-style][INI] configuration file to `~/.config/runfvp.conf`:
```
@@ -144,3 +146,4 @@ FVP_ENV_PASSTHROUGH = "ARMLMD_LICENSE_FILE FM_TRACE_PLUGINS"
[FVP]: https://developer.arm.com/tools-and-software/simulation-models/fixed-virtual-platforms
[tmux]: https://tmux.github.io/
[INI]: https://docs.python.org/3/library/configparser.html
+[screen]: https://www.gnu.org/software/screen/
@@ -1,4 +1,3 @@
-import shutil
import collections
import pathlib
import os
@@ -37,6 +36,20 @@ def check_executable(*cmd) -> bool:
return exitcode == 0
+def screen_is_ready(*, silent: bool = False) -> bool:
+ log_print = (lambda *_args, **_kwargs: None) if silent else logger.error
+
+ if not check_executable("screen", "--version"):
+ log_print("--terminal screen requires screen to be available and runnable, but startup failed.")
+ return False
+
+ if not os.environ.get("STY"):
+ log_print("--terminal screen requires runfvp to be started from a screen session.\n\tEnsure $STY is set in the environment.")
+ return False
+
+ return True
+
+
def tmux_is_ready(*, silent: bool = False) -> bool:
log_print = (lambda *_args, **_kwargs: None) if silent else logger.error
@@ -126,6 +139,8 @@ class Terminals:
terminals = Terminals()
# TODO: option to switch between telnet and netcat
connect_command = "telnet localhost %port"
+sty = os.environ.get("STY")
+terminals.add_terminal(2, "screen", f'screen -S "{sty}" -X screen -t "{{name}} - %title" -L {connect_command}', screen_is_ready)
terminals.add_terminal(2, "tmux", f'tmux new-window -n "{{name}}" "{connect_command}"', tmux_is_ready)
terminals.add_terminal(2, "gnome-terminal", f'gnome-terminal --window --title "{{name}} - %title" --command "{connect_command}"', gterm_is_ready)
terminals.add_terminal(1, "xterm", f'xterm -title "{{name}} - %title" -e {connect_command}', xterm_is_ready)
Add support for Screen the GNU terminal multiplexer. The -t/--terminal option now accepts "screen" as a terminal type. When selected, the tool must be run from within an existing Screen session, and each FVP terminal is opened in a new Screen window. Signed-off-by: Gyorgy Szing <gyorgy.szing@arm.com> --- documentation/runfvp.md | 3 +++ meta-arm/lib/fvp/terminal.py | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-)