1
0
mirror of https://git.yoctoproject.org/meta-arm synced 2026-05-07 04:58:57 +00:00

scripts/runfvp: add Screen support

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>
Signed-off-by: Jon Mason <jon.mason@arm.com>
This commit is contained in:
Gyorgy Szing
2026-04-23 17:37:20 +02:00
committed by Jon Mason
parent 2b0fbab119
commit 9aedfffcfc
2 changed files with 19 additions and 1 deletions
+3
View File
@@ -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/
+16 -1
View File
@@ -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)