summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--lava-slave/Dockerfile3
-rwxr-xr-xlava-slave/scripts/start.sh3
-rw-r--r--lava-slave/ser2net.conf0
-rwxr-xr-xlavalab-gen.py29
5 files changed, 31 insertions, 5 deletions
diff --git a/README.md b/README.md
index 2ea9773..56aec3f 100644
--- a/README.md
+++ b/README.md
@@ -251,6 +251,7 @@ boards:
idproduct: the PID of the UART (Formated as 0xXXXX)
serial: The serial number in case of FTDI uart
devpath: the UDEV devpath to this uart for UART without serial number
+ use_ser2net: True/false (Use ser2net instead of conmux-console)
connection_command: A command to be ran for getting a serial console
pdu_generic:
hard_reset_command: commandline to reset the board
diff --git a/lava-slave/Dockerfile b/lava-slave/Dockerfile
index b7252ef..11ef6c8 100644
--- a/lava-slave/Dockerfile
+++ b/lava-slave/Dockerfile
@@ -53,6 +53,9 @@ RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install cu
RUN rm /etc/apt/sources.list.d/testing.list
+RUN apt-get -y install ser2net
+COPY ser2net.conf /etc
+
COPY scripts/lava-slave /etc/init.d/
RUN chmod 755 /etc/init.d/lava-slave
diff --git a/lava-slave/scripts/start.sh b/lava-slave/scripts/start.sh
index 35e58a4..ef6eb68 100755
--- a/lava-slave/scripts/start.sh
+++ b/lava-slave/scripts/start.sh
@@ -8,6 +8,9 @@ if [[ -n "$LAVA_MASTER" ]]; then
fi
service tftpd-hpa start || exit 4
+if [ -s /etc/ser2net.conf ];then
+ service ser2net start || exit 7
+fi
touch /var/run/conmux-registry
/usr/sbin/conmux-registry 63000 /var/run/conmux-registry&
diff --git a/lava-slave/ser2net.conf b/lava-slave/ser2net.conf
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/lava-slave/ser2net.conf
diff --git a/lavalab-gen.py b/lavalab-gen.py
index 13677c8..bb7809c 100755
--- a/lavalab-gen.py
+++ b/lavalab-gen.py
@@ -36,6 +36,13 @@ template_device_pdu_generic = string.Template("""
{% set power_on_command = '${power_on_command}' %}
""")
+template_ser2net = string.Template("""
+${port}:telnet:600:/dev/${board}:${baud} 8DATABITS NONE 1STOPBIT banner
+""")
+template_device_ser2net = string.Template("""
+{% set connection_command = 'telnet 127.0.0.1 ${port}' %}
+""")
+
template_udev_serial = string.Template("""#
SUBSYSTEM=="tty", ATTRS{idVendor}=="${idvendor}", ATTRS{idProduct}=="${idproduct}", ATTRS{serial}=="${serial}", MODE="0664", OWNER="uucp", SYMLINK+="${board}"
""")
@@ -252,6 +259,7 @@ def main():
if "boards" not in workers:
print("Missing boards")
sys.exit(1)
+ ser2net_port = 60000
boards = workers["boards"]
for board in boards:
board_name = board["name"]
@@ -310,7 +318,6 @@ def main():
if type(idvendor) == str:
print("Please put hexadecimal IDs for vendor %s (like 0x%s)" % (board_name, idvendor))
sys.exit(1)
- line = template_conmux.substitute(board=board_name, baud=baud)
if "serial" in uart:
serial = board["uart"]["serial"]
udev_line = template_udev_serial.substitute(board=board_name, serial=serial, idvendor="%04x" % idvendor, idproduct="%04x" % idproduct)
@@ -328,10 +335,22 @@ def main():
dockcomp["services"][worker_name]["devices"] = []
dc_devices = dockcomp["services"][worker_name]["devices"]
dc_devices.append("/dev/%s:/dev/%s" % (board_name, board_name))
- fp = open("%s/conmux/%s.cf" % (workerdir, board_name), "w")
- fp.write(line)
- fp.close()
- device_line += template_device_conmux.substitute(board=board_name)
+ use_conmux = True
+ if "use_ser2net" in uart:
+ use_conmux = False
+ if use_conmux:
+ conmuxline = template_conmux.substitute(board=board_name, baud=baud)
+ device_line += template_device_conmux.substitute(board=board_name)
+ fp = open("%s/conmux/%s.cf" % (workerdir, board_name), "w")
+ fp.write(conmuxline)
+ fp.close()
+ else:
+ ser2net_line = template_ser2net.substitute(port=ser2net_port,baud=baud,board=board_name)
+ device_line += template_device_ser2net.substitute(port=ser2net_port)
+ ser2net_port += 1
+ fp = open("%s/ser2net.conf" % workerdir, "a")
+ fp.write(ser2net_line)
+ fp.close()
elif "connection_command" in board:
connection_command = board["connection_command"]
device_line += template_device_connection_command.substitute(connection_command=connection_command)