summaryrefslogtreecommitdiffstats
path: root/configs
diff options
context:
space:
mode:
authorRoland Hieber <rhi@pengutronix.de>2021-04-26 12:07:15 +0200
committerRobert Schwebel <r.schwebel@pengutronix.de>2021-04-26 12:08:51 +0200
commitd975eb8b04087f8606d881d527d02e75f97c6243 (patch)
tree4c92b0f4332310867dbcc405c80cf40b92f8d725 /configs
parent55e2a6b1cf7ee69819d9f8388d2eba35fc077c2a (diff)
downloadDistroKit-d975eb8b04087f8606d881d527d02e75f97c6243.tar.gz
DistroKit-d975eb8b04087f8606d881d527d02e75f97c6243.tar.xz
v7a: run: make the SSH forwarding port multiprocess-compatible
When multiple ./configs/platform-v7a/run scripts are run at the same time, the first qemu process will open port 4445, and following runs will fail. To prevent that, first look at the environment variable QEMU_SSH_PORT to determine the port to be used (so that users can set this in their shell to keep the port constant), or fall back to a port between 1025 and 65025 based on the shell's PID, which should have a good chance of choosing an unused, but stable port. Also print the port forwarding before starting qemu, so we don't have to bother about grepping the process list. Signed-off-by: Roland Hieber <rhi@pengutronix.de> Link: https://lore.pengutronix.de/20210426100714.10944-1-rhi@pengutronix.de Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
Diffstat (limited to 'configs')
-rwxr-xr-xconfigs/platform-v7a/run3
1 files changed, 2 insertions, 1 deletions
diff --git a/configs/platform-v7a/run b/configs/platform-v7a/run
index ed8ab1b..8af190f 100755
--- a/configs/platform-v7a/run
+++ b/configs/platform-v7a/run
@@ -39,7 +39,7 @@ fi
# the port to which an sshd would connect (in the emulated sysem)
SSH_INTERNAL_PORT=22
# the port which QEMU opens at the host side to give access to the ${SSH_INTERNAL_PORT}
-SSH_EXTERNAL_PORT=4445
+SSH_EXTERNAL_PORT=${QEMU_SSH_PORT:-${PPID%64000+1025}}
# check if vde is available for networking
if [ -z "${VDE_SOCKET}" ]; then
@@ -59,6 +59,7 @@ fi
# fall back to user network if necessary
if [ -z "${QEMU_NET}" ]; then
QEMU_NET=(-netdev user,id=net1,hostfwd=tcp:127.0.0.1:${SSH_EXTERNAL_PORT}-:${SSH_INTERNAL_PORT} )
+ echo "Forwarding SSH port 127.0.0.1:${SSH_EXTERNAL_PORT} -> qemu:${SSH_INTERNAL_PORT}"
fi
BASE_CMDLINE="console=ttyAMA0,115200 loglevel=5 systemd.log_level=warning systemd.show_status=auto"