From patchwork Tue Apr 26 12:33:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: harry.moulton@arm.com X-Patchwork-Id: 7182 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7FA7AC433EF for ; Tue, 26 Apr 2022 12:34:17 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.5531.1650976456183895363 for ; Tue, 26 Apr 2022 05:34:16 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: harry.moulton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4461E23A; Tue, 26 Apr 2022 05:34:15 -0700 (PDT) Received: from e123741.cambridge.arm.com (e123741.cambridge.arm.com [10.1.196.216]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 94CB83F774; Tue, 26 Apr 2022 05:34:14 -0700 (PDT) From: harry.moulton@arm.com To: meta-arm@lists.yoctoproject.org, Ross.Burton@arm.com Cc: nd@arm.com, Harry Moulton Subject: [PATCH honister 1/9] arm-bsp/machine: Add runfvp config for corstone1000 Date: Tue, 26 Apr 2022 13:33:51 +0100 Message-Id: <20220426123359.22873-2-harry.moulton@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220426123359.22873-1-harry.moulton@arm.com> References: <20220426123359.22873-1-harry.moulton@arm.com> List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 26 Apr 2022 12:34:17 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/meta-arm/message/3302 From: Harry Moulton Add the runfvp config for corstone1000-fvp. Signed-off-by: Harry Moulton --- ci/corstone1000-fvp.yml | 1 + kas/corstone1000-fvp.yml | 7 ++++ .../conf/machine/corstone1000-fvp.conf | 34 ++++++++++++++++++- 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/ci/corstone1000-fvp.yml b/ci/corstone1000-fvp.yml index 66cdec6e..b6ae242f 100644 --- a/ci/corstone1000-fvp.yml +++ b/ci/corstone1000-fvp.yml @@ -10,3 +10,4 @@ local_conf_header: INITRAMFS_IMAGE:remove = "corstone1000-initramfs-image" machine: corstone1000-fvp + diff --git a/kas/corstone1000-fvp.yml b/kas/corstone1000-fvp.yml index 531fd1ac..2420aa8e 100644 --- a/kas/corstone1000-fvp.yml +++ b/kas/corstone1000-fvp.yml @@ -12,5 +12,12 @@ repos: machine: corstone1000-fvp +local_conf_header: + fvp-config: | + # Remove Dropbear SSH as it will not fit into the corstone1000 image. + IMAGE_FEATURES:remove = " ssh-server-dropbear" + INHERIT = " ${@bb.utils.contains('BUILD_ARCH', 'x86_64', 'fvpboot', '', d)}" + LICENSE_FLAGS_WHITELIST:append = " Arm-FVP-EULA" + target: - corstone1000-image diff --git a/meta-arm-bsp/conf/machine/corstone1000-fvp.conf b/meta-arm-bsp/conf/machine/corstone1000-fvp.conf index fc69fe84..eb122f35 100644 --- a/meta-arm-bsp/conf/machine/corstone1000-fvp.conf +++ b/meta-arm-bsp/conf/machine/corstone1000-fvp.conf @@ -1,9 +1,41 @@ #@TYPE: Machine #@NAME: corstone1000-fvp machine #@DESCRIPTION: Machine configuration for Corstone1000 64-bit FVP - require conf/machine/include/corstone1000.inc TFA_TARGET_PLATFORM = "fvp" TFM_PLATFORM_IS_FVP = "TRUE" + +# testimage config +TEST_TARGET = "OEFVPTarget" +TEST_SUITES = "noop" + +# FVP Config +FVP_PROVIDER ?= "fvp-corstone1000-native" +FVP_EXE ?= "FVP_Corstone-1000" +FVP_CONSOLE ?= "host_terminal_0" + +# FVP Parameters +FVP_CONFIG[se.trustedBootROMloader.fname] ?= "${DEPLOY_DIR_IMAGE}/bl1.bin" +FVP_CONFIG[board.xnvm_size] ?= "64" +FVP_CONFIG[se.trustedSRAM_config] ?= "6" +FVP_CONFIG[se.BootROM_config] ?= "3" +FVP_CONFIG[board.hostbridge.interfaceName] ?= "tap0" +FVP_CONFIG[board.smsc_91c111.enabled] ?= "1" +FVP_CONFIG[board.hostbridge.userNetworking] ?= "true" +FVP_CONFIG[board.hostbridge.userNetPorts] ?= "5555=5555,8080=80,8022=22" +FVP_CONFIG[board.se_flash_size] ?= "8192" +FVP_CONFIG[diagnostics] ?= "4" +FVP_CONFIG[disable_visualisation] ?= "true" +FVP_CONFIG[se.nvm.update_raw_image] ?= "0" + +# Boot image +FVP_DATA ?= "board.flash0=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.wic.nopt@0x68100000" + +# FVP Terminals +FVP_TERMINALS[host.host_terminal_0] ?= "Normal World Console" +FVP_TERMINALS[host.host_terminal_1] ?= "Secure World Console" +FVP_TERMINALS[se.secenc_terminal] ?= "Secure Enclave Console" +FVP_TERMINALS[extsys0.extsys_terminal] ?= "Cortex M3" + From patchwork Tue Apr 26 12:33:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: harry.moulton@arm.com X-Patchwork-Id: 7183 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6651AC433EF for ; Tue, 26 Apr 2022 12:34:27 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web09.5780.1650976457708528872 for ; Tue, 26 Apr 2022 05:34:18 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: harry.moulton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4B32FED1; Tue, 26 Apr 2022 05:34:17 -0700 (PDT) Received: from e123741.cambridge.arm.com (e123741.cambridge.arm.com [10.1.196.216]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9C4EF3F774; Tue, 26 Apr 2022 05:34:16 -0700 (PDT) From: harry.moulton@arm.com To: meta-arm@lists.yoctoproject.org, Ross.Burton@arm.com Cc: nd@arm.com, Ross Burton Subject: [PATCH honister 2/9] runfvp: add an asyncio TODO Date: Tue, 26 Apr 2022 13:33:52 +0100 Message-Id: <20220426123359.22873-3-harry.moulton@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220426123359.22873-1-harry.moulton@arm.com> References: <20220426123359.22873-1-harry.moulton@arm.com> List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 26 Apr 2022 12:34:27 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/meta-arm/message/3303 From: Ross Burton Signed-off-by: Ross Burton --- scripts/runfvp | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/runfvp b/scripts/runfvp index 66a76cc5..524de24d 100755 --- a/scripts/runfvp +++ b/scripts/runfvp @@ -205,6 +205,7 @@ def runfvp(cli_args): telnet = await asyncio.create_subprocess_exec("telnet", "localhost", str(port), stdin=sys.stdin, stdout=sys.stdout) await telnet.wait() logger.debug(f"Telnet quit, cancelling tasks") + # TODO: this is 3.7+ for t in asyncio.all_tasks(): logger.debug(f"Cancelling {t}") t.cancel() From patchwork Tue Apr 26 12:33:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: harry.moulton@arm.com X-Patchwork-Id: 7184 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6AA02C433F5 for ; Tue, 26 Apr 2022 12:34:27 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web09.5781.1650976462405293958 for ; Tue, 26 Apr 2022 05:34:22 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: harry.moulton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9DF4D23A; Tue, 26 Apr 2022 05:34:21 -0700 (PDT) Received: from e123741.cambridge.arm.com (e123741.cambridge.arm.com [10.1.196.216]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EE2263F774; Tue, 26 Apr 2022 05:34:20 -0700 (PDT) From: harry.moulton@arm.com To: meta-arm@lists.yoctoproject.org, Ross.Burton@arm.com Cc: nd@arm.com, Ross Burton Subject: [PATCH honister 3/9] runfvp: handle the fvp quitting before we kill it Date: Tue, 26 Apr 2022 13:33:53 +0100 Message-Id: <20220426123359.22873-4-harry.moulton@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220426123359.22873-1-harry.moulton@arm.com> References: <20220426123359.22873-1-harry.moulton@arm.com> List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 26 Apr 2022 12:34:27 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/meta-arm/message/3304 From: Ross Burton Don't raise an exception if the FVP has quit before we get around to killing it. Signed-off-by: Ross Burton --- scripts/runfvp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/runfvp b/scripts/runfvp index 524de24d..877e80cb 100755 --- a/scripts/runfvp +++ b/scripts/runfvp @@ -179,7 +179,10 @@ async def start_fvp(cli, console_cb): finally: # If we get cancelled or throw an exception, kill the FVP logger.debug(f"Killing FVP PID {fvp_process.pid}") - fvp_process.terminate() + try: + fvp_process.terminate() + except ProcessLookupError: + pass if await fvp_process.wait() != 0: logger.info(f"{cli[0]} quit with code {fvp_process.returncode}") From patchwork Tue Apr 26 12:33:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: harry.moulton@arm.com X-Patchwork-Id: 7186 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6AA36C4332F for ; Tue, 26 Apr 2022 12:34:27 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.5656.1650976463858165279 for ; Tue, 26 Apr 2022 05:34:24 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: harry.moulton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 78222ED1; Tue, 26 Apr 2022 05:34:23 -0700 (PDT) Received: from e123741.cambridge.arm.com (e123741.cambridge.arm.com [10.1.196.216]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BC0063F774; Tue, 26 Apr 2022 05:34:22 -0700 (PDT) From: harry.moulton@arm.com To: meta-arm@lists.yoctoproject.org, Ross.Burton@arm.com Cc: nd@arm.com, Ross Burton Subject: [PATCH honister 4/9] runfvp: don't hide output when using terminals Date: Tue, 26 Apr 2022 13:33:54 +0100 Message-Id: <20220426123359.22873-5-harry.moulton@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220426123359.22873-1-harry.moulton@arm.com> References: <20220426123359.22873-1-harry.moulton@arm.com> List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 26 Apr 2022 12:34:27 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/meta-arm/message/3305 From: Ross Burton Only pass a console_cb if we're hooking up a console, so that the output from the FVP is visible on the terminal. Signed-off-by: Ross Burton --- scripts/runfvp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/runfvp b/scripts/runfvp index 877e80cb..77668248 100755 --- a/scripts/runfvp +++ b/scripts/runfvp @@ -216,7 +216,8 @@ def runfvp(cli_args): try: # When we can assume Py3.7+, this can simply be asyncio.run() loop = asyncio.get_event_loop() - loop.run_until_complete(asyncio.gather(start_fvp(cli, console_cb=console_started))) + console_cb = expected_terminal and console_started or None + loop.run_until_complete(asyncio.gather(start_fvp(cli, console_cb=console_cb))) except asyncio.CancelledError: pass From patchwork Tue Apr 26 12:33:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: harry.moulton@arm.com X-Patchwork-Id: 7185 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 735AEC433FE for ; Tue, 26 Apr 2022 12:34:27 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.5613.1650976465544097175 for ; Tue, 26 Apr 2022 05:34:25 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: harry.moulton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2E19123A; Tue, 26 Apr 2022 05:34:25 -0700 (PDT) Received: from e123741.cambridge.arm.com (e123741.cambridge.arm.com [10.1.196.216]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7E52D3F774; Tue, 26 Apr 2022 05:34:24 -0700 (PDT) From: harry.moulton@arm.com To: meta-arm@lists.yoctoproject.org, Ross.Burton@arm.com Cc: nd@arm.com, Ross Burton Subject: [PATCH honister 5/9] runfvp: don't use f-string when there's no expressions Date: Tue, 26 Apr 2022 13:33:55 +0100 Message-Id: <20220426123359.22873-6-harry.moulton@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220426123359.22873-1-harry.moulton@arm.com> References: <20220426123359.22873-1-harry.moulton@arm.com> List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 26 Apr 2022 12:34:27 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/meta-arm/message/3306 From: Ross Burton Signed-off-by: Ross Burton --- scripts/runfvp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/runfvp b/scripts/runfvp index 77668248..fb334795 100755 --- a/scripts/runfvp +++ b/scripts/runfvp @@ -169,7 +169,7 @@ async def start_fvp(cli, console_cb): # Look for serial connections opening if console_cb: - m = re.match(fr"^(\S+): Listening for serial connection on port (\d+)$", line) + m = re.match(r"^(\S+): Listening for serial connection on port (\d+)$", line) if m: terminal = m.group(1) port = int(m.group(2)) From patchwork Tue Apr 26 12:33:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: harry.moulton@arm.com X-Patchwork-Id: 7188 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75EB4C433FE for ; Tue, 26 Apr 2022 12:34:37 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.5657.1650976467398377378 for ; Tue, 26 Apr 2022 05:34:27 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: harry.moulton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A3A91ED1; Tue, 26 Apr 2022 05:34:26 -0700 (PDT) Received: from e123741.cambridge.arm.com (e123741.cambridge.arm.com [10.1.196.216]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 005713F774; Tue, 26 Apr 2022 05:34:25 -0700 (PDT) From: harry.moulton@arm.com To: meta-arm@lists.yoctoproject.org, Ross.Burton@arm.com Cc: nd@arm.com, Ross Burton Subject: [PATCH honister 6/9] runfvp: refactor terminal selection Date: Tue, 26 Apr 2022 13:33:56 +0100 Message-Id: <20220426123359.22873-7-harry.moulton@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220426123359.22873-1-harry.moulton@arm.com> References: <20220426123359.22873-1-harry.moulton@arm.com> List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 26 Apr 2022 12:34:37 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/meta-arm/message/3307 From: Ross Burton Rewrite the terminal code to have a priority list of terminals when selecting a default, allow the user to pick a default with a configuration file, and add gnome-terminal to the list. Signed-off-by: Ross Burton --- scripts/runfvp | 69 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 52 insertions(+), 17 deletions(-) diff --git a/scripts/runfvp b/scripts/runfvp index fb334795..ca1e797c 100755 --- a/scripts/runfvp +++ b/scripts/runfvp @@ -1,6 +1,7 @@ #! /usr/bin/env python3 import asyncio +import collections import json import os import re @@ -12,25 +13,59 @@ import pathlib import logging logger = logging.getLogger("RunFVP") -# TODO: option to switch between telnet and netcat -connect_command = "telnet localhost %port" +from typing import List, Optional + +def get_config_dir() -> pathlib.Path: + value = os.environ.get("XDG_CONFIG_HOME") + if value and os.path.isabs(value): + return pathlib.Path(value) + else: + return pathlib.Path.home() / ".config" + +class Terminals: + Terminal = collections.namedtuple("Terminal", ["priority", "name", "command"]) + + def __init__(self): + self.terminals = [] + + def add_terminal(self, priority, name, command): + self.terminals.append(Terminals.Terminal(priority, name, command)) + # Keep this list sorted by priority + self.terminals.sort(reverse=True, key=lambda t: t.priority) + self.name_map = {t.name: t for t in self.terminals} -terminal_map = { - "tmux": f"tmux new-window -n \"%title\" \"{connect_command}\"", - "xterm": f"xterm -title \"%title\" -e {connect_command}", - "none": "" - # TODO more terminals -} + def configured_terminal(self) -> Optional[str]: + import configparser -def get_default_terminal(): - import shutil - import shlex + config = configparser.ConfigParser() + config.read(get_config_dir() / "runfvp.conf") + return config.get("RunFVP", "Terminal", fallback=None) - for terminal in "xterm",: - command = shlex.split(terminal_map[terminal])[0] - if shutil.which(command): - return terminal - return "none" + def preferred_terminal(self) -> str: + import shlex, shutil + + preferred = self.configured_terminal() + if preferred: + return preferred + + for t in self.terminals: + if t.command and shutil.which(shlex.split(t.command)[0]): + return t.name + return self.terminals[-1].name + + def all_terminals(self) -> List[str]: + return self.name_map.keys() + + def __getitem__(self, name: str): + return self.name_map[name] + +terminals = Terminals() +# TODO: option to switch between telnet and netcat +connect_command = "telnet localhost %port" +terminals.add_terminal(2, "tmux", f"tmux new-window -n \"%title\" \"{connect_command}\""), +terminals.add_terminal(2, "gnome-terminal", f"gnome-terminal --window --title \"%title\" --command \"{connect_command}\""), +terminals.add_terminal(1, "xterm", f"xterm -title \"%title\" -e {connect_command}"), +terminals.add_terminal(0, "none", None) def get_image_directory(machine=None): """ @@ -59,7 +94,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=get_default_terminal(), help="Automatically start terminals (default: %(default)s)") + group.add_argument("-t", "--terminals", choices=terminals.all_terminals(), default=terminals.preferred_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 ]" From patchwork Tue Apr 26 12:33:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: harry.moulton@arm.com X-Patchwork-Id: 7190 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77592C433EF for ; Tue, 26 Apr 2022 12:34:37 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.5658.1650976469374213286 for ; Tue, 26 Apr 2022 05:34:29 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: harry.moulton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E69E823A; Tue, 26 Apr 2022 05:34:28 -0700 (PDT) Received: from e123741.cambridge.arm.com (e123741.cambridge.arm.com [10.1.196.216]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 220AD3F774; Tue, 26 Apr 2022 05:34:28 -0700 (PDT) From: harry.moulton@arm.com To: meta-arm@lists.yoctoproject.org, Ross.Burton@arm.com Cc: nd@arm.com, Ross Burton , Jon Mason Subject: [PATCH honister 7/9] runfvp: fix undefined variable in terminal selection login Date: Tue, 26 Apr 2022 13:33:57 +0100 Message-Id: <20220426123359.22873-8-harry.moulton@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220426123359.22873-1-harry.moulton@arm.com> References: <20220426123359.22873-1-harry.moulton@arm.com> List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 26 Apr 2022 12:34:37 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/meta-arm/message/3308 From: Ross Burton Since 10e60cc the terminal_map doesn't exist, this piece of code wasn't updated. Signed-off-by: Ross Burton Signed-off-by: Jon Mason --- scripts/runfvp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/runfvp b/scripts/runfvp index ca1e797c..c20455fd 100755 --- a/scripts/runfvp +++ b/scripts/runfvp @@ -182,7 +182,7 @@ def parse_config(args, config): # TODO if raw mode # cli.extend(["--parameter", f"{terminal}.mode=raw"]) # TODO put name into terminal title - cli.extend(["--parameter", f"{terminal}.terminal_command={terminal_map[args.terminals]}"]) + cli.extend(["--parameter", f"{terminal}.terminal_command={terminals[args.terminals].command}"]) else: # Disable terminal cli.extend(["--parameter", f"{terminal}.start_telnet=0"]) From patchwork Tue Apr 26 12:33:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: harry.moulton@arm.com X-Patchwork-Id: 7187 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75E87C433F5 for ; Tue, 26 Apr 2022 12:34:37 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.5536.1650976471196684265 for ; Tue, 26 Apr 2022 05:34:31 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: harry.moulton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D454223A; Tue, 26 Apr 2022 05:34:30 -0700 (PDT) Received: from e123741.cambridge.arm.com (e123741.cambridge.arm.com [10.1.196.216]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 164843F774; Tue, 26 Apr 2022 05:34:29 -0700 (PDT) From: harry.moulton@arm.com To: meta-arm@lists.yoctoproject.org, Ross.Burton@arm.com Cc: nd@arm.com, Ross Burton , Jon Mason Subject: [PATCH honister 8/9] runfvp: propagate the exit code correctly Date: Tue, 26 Apr 2022 13:33:58 +0100 Message-Id: <20220426123359.22873-9-harry.moulton@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220426123359.22873-1-harry.moulton@arm.com> References: <20220426123359.22873-1-harry.moulton@arm.com> List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 26 Apr 2022 12:34:37 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/meta-arm/message/3309 From: Ross Burton runfvp could encounter an error but the exit code remained as 0. Signed-off-by: Ross Burton Signed-off-by: Jon Mason --- scripts/runfvp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/runfvp b/scripts/runfvp index c20455fd..5cab0949 100755 --- a/scripts/runfvp +++ b/scripts/runfvp @@ -221,6 +221,9 @@ async def start_fvp(cli, console_cb): if await fvp_process.wait() != 0: logger.info(f"{cli[0]} quit with code {fvp_process.returncode}") + return fvp_process.returncode + else: + return 0 def runfvp(cli_args): args, fvp_args = parse_args(cli_args) @@ -234,7 +237,7 @@ def runfvp(cli_args): expected_terminal = config["console"] if not expected_terminal: logger.error("--console used but FVP_CONSOLE not set in machine configuration") - sys.exit(1) + return 1 else: expected_terminal = None @@ -252,9 +255,10 @@ def runfvp(cli_args): # When we can assume Py3.7+, this can simply be asyncio.run() loop = asyncio.get_event_loop() console_cb = expected_terminal and console_started or None - loop.run_until_complete(asyncio.gather(start_fvp(cli, console_cb=console_cb))) + return loop.run_until_complete(start_fvp(cli, console_cb=console_cb)) except asyncio.CancelledError: - pass + # This means telnet exited, which isn't an error + return 0 if __name__ == "__main__": try: @@ -264,6 +268,6 @@ if __name__ == "__main__": if sys.stdin.isatty(): signal.signal(signal.SIGTTOU, signal.SIG_IGN) os.tcsetpgrp(sys.stdin.fileno(), os.getpgrp()) - runfvp(sys.argv[1:]) + sys.exit(runfvp(sys.argv[1:])) except KeyboardInterrupt: pass From patchwork Tue Apr 26 12:33:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: harry.moulton@arm.com X-Patchwork-Id: 7189 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81FDFC4332F for ; Tue, 26 Apr 2022 12:34:37 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.5537.1650976472959754295 for ; Tue, 26 Apr 2022 05:34:33 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: harry.moulton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9F774ED1; Tue, 26 Apr 2022 05:34:32 -0700 (PDT) Received: from e123741.cambridge.arm.com (e123741.cambridge.arm.com [10.1.196.216]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D44FA3F774; Tue, 26 Apr 2022 05:34:31 -0700 (PDT) From: harry.moulton@arm.com To: meta-arm@lists.yoctoproject.org, Ross.Burton@arm.com Cc: nd@arm.com, Ross Burton , Jon Mason Subject: [PATCH honister 9/9] runfvp: check for telnet Date: Tue, 26 Apr 2022 13:33:59 +0100 Message-Id: <20220426123359.22873-10-harry.moulton@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220426123359.22873-1-harry.moulton@arm.com> References: <20220426123359.22873-1-harry.moulton@arm.com> List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 26 Apr 2022 12:34:37 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/meta-arm/message/3310 From: Ross Burton Check for telnet on startup to avoid mysterious failures later when telnet isn't available. Signed-off-by: Ross Burton Signed-off-by: Jon Mason --- scripts/runfvp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/runfvp b/scripts/runfvp index 5cab0949..0ebf873e 100755 --- a/scripts/runfvp +++ b/scripts/runfvp @@ -5,6 +5,7 @@ import collections import json import os import re +import shutil import signal import sys import subprocess @@ -42,7 +43,7 @@ class Terminals: return config.get("RunFVP", "Terminal", fallback=None) def preferred_terminal(self) -> str: - import shlex, shutil + import shlex preferred = self.configured_terminal() if preferred: @@ -233,6 +234,11 @@ def runfvp(cli_args): cli.extend(fvp_args) logger.debug(f"Constructed FVP call: {cli}") + # Check that telnet is present + if not bool(shutil.which("telnet")): + logger.error("Cannot find telnet, this is needed to connect to the FVP.") + return 1 + if args.console: expected_terminal = config["console"] if not expected_terminal: