summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@arm.com>2023-09-13 18:32:41 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-09-14 09:19:34 +0100
commit81b304e2558730de285f2773371340fc636a8ed1 (patch)
tree1cbe6a097c214e1cac5ebcc7ffb8fd4ea0187aa5
parent2f5edb6904bf16a9c52a9b124aeb5297487cd716 (diff)
downloadopenembedded-core-contrib-81b304e2558730de285f2773371340fc636a8ed1.tar.gz
testimage: respect target/server IPs when using slirp
We can't hardcode these IPs when using slirp. The target IP will need a port to be specified as this controls what port the SSH connection uses, and when slirp is used it can't bind to port 22. The qemu runner (OEQemuTarget) assumes that the first port forward is the SSH forward, but this may be wrong or a different target may be used. The server IP depends on how the virtual networking is configured. runqemu defaults to 10.0.2.x for the guests so that is a wise default, but that may be configured differently. Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes-recipe/testimage.bbclass9
1 files changed, 6 insertions, 3 deletions
diff --git a/meta/classes-recipe/testimage.bbclass b/meta/classes-recipe/testimage.bbclass
index 7340996788..8a944f5809 100644
--- a/meta/classes-recipe/testimage.bbclass
+++ b/meta/classes-recipe/testimage.bbclass
@@ -370,9 +370,12 @@ def testimage_main(d):
export_proxies(d)
if slirp:
- target_ip = "127.0.0.1"
- # from qemu target to host with default DHCP server
- server_ip = "10.0.2.2"
+ # Default to 127.0.0.1 and let the runner identify the port forwarding
+ # (as OEQemuTarget does), but allow overriding.
+ target_ip = d.getVar("TEST_TARGET_IP") or "127.0.0.1"
+ # Default to 10.0.2.2 as this is the IP that the guest has with the
+ # default qemu slirp networking configuration, but allow overriding.
+ server_ip = d.getVar("TEST_SERVER_IP") or "10.0.2.2"
else:
target_ip = d.getVar("TEST_TARGET_IP")
server_ip = d.getVar("TEST_SERVER_IP")