summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorentin LABBE <clabbe@baylibre.com>2018-06-08 11:14:55 +0200
committerCorentin LABBE <clabbe@baylibre.com>2018-07-12 14:07:37 +0200
commit72fce7856928dbae032eee15a1cd5a8b8c9ce384 (patch)
tree0601538174edd4529c47dff5c23d6d1c0b601167
parent615e0d597510736dab68e41bd9dc002da6b2514f (diff)
Support screen for uart
This patch add support for using screen instead of conmux-console. screen can be used by adding "use_screen: True" to uart. screen is necessary for some board with internal uart which have a micro cut when switching power (like DRA7-EVM and M3ULCB)
-rw-r--r--README.md1
-rw-r--r--lava-slave/Dockerfile5
-rw-r--r--lava-slave/lava-screen.conf0
-rwxr-xr-xlava-slave/scripts/start.sh13
-rwxr-xr-xlavalab-gen.py17
5 files changed, 35 insertions, 1 deletions
diff --git a/README.md b/README.md
index 56aec3f..c48f43e 100644
--- a/README.md
+++ b/README.md
@@ -252,6 +252,7 @@ boards:
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)
+ use_screen: True/false (Use screen via ssh 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 11ef6c8..a5b0148 100644
--- a/lava-slave/Dockerfile
+++ b/lava-slave/Dockerfile
@@ -81,6 +81,11 @@ COPY devices/ /root/devices/
COPY scripts/extra_actions /root/
RUN if [ -x /root/extra_actions ] ; then /root/extra_actions ; fi
+RUN apt-get -y install screen openssh-server
+RUN ssh-keygen -q -f /root/.ssh/id_rsa
+RUN cat /root/.ssh/id_rsa.pub > /root/.ssh/authorized_keys
+COPY lava-screen.conf /root/
+
EXPOSE 69/udp 80
CMD /start.sh
diff --git a/lava-slave/lava-screen.conf b/lava-slave/lava-screen.conf
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/lava-slave/lava-screen.conf
diff --git a/lava-slave/scripts/start.sh b/lava-slave/scripts/start.sh
index ef6eb68..21b6903 100755
--- a/lava-slave/scripts/start.sh
+++ b/lava-slave/scripts/start.sh
@@ -23,6 +23,19 @@ do
/usr/sbin/conmux $item &
done
+HAVE_SCREEN=0
+while read screenboard
+do
+ echo "Start screen for $screenboard"
+ TERM=xterm screen -d -m -S $screenboard /dev/$screenboard 115200 -ixoff -ixon || exit 9
+ HAVE_SCREEN=1
+done < /root/lava-screen.conf
+if [ $HAVE_SCREEN -eq 1 ];then
+ sed -i 's,UsePAM.*yes,UsePAM no,' /etc/ssh/sshd_config || exit 10
+ service ssh start || exit 11
+fi
+
+
# start an http file server for boot/transfer_overlay support
(cd /var/lib/lava/dispatcher; python -m SimpleHTTPServer 80) &
diff --git a/lavalab-gen.py b/lavalab-gen.py
index bb7809c..83a8a2d 100755
--- a/lavalab-gen.py
+++ b/lavalab-gen.py
@@ -43,6 +43,10 @@ template_device_ser2net = string.Template("""
{% set connection_command = 'telnet 127.0.0.1 ${port}' %}
""")
+template_device_screen = string.Template("""
+{% set connection_command = 'ssh -o StrictHostKeyChecking=no -t root@127.0.0.1 "TERM=xterm screen -x ${board}"' %}
+""")
+
template_udev_serial = string.Template("""#
SUBSYSTEM=="tty", ATTRS{idVendor}=="${idvendor}", ATTRS{idProduct}=="${idproduct}", ATTRS{serial}=="${serial}", MODE="0664", OWNER="uucp", SYMLINK+="${board}"
""")
@@ -336,21 +340,32 @@ def main():
dc_devices = dockcomp["services"][worker_name]["devices"]
dc_devices.append("/dev/%s:/dev/%s" % (board_name, board_name))
use_conmux = True
+ use_ser2net = False
+ use_screen = False
if "use_ser2net" in uart:
use_conmux = False
+ use_ser2net = True
+ if "use_screen" in uart:
+ use_conmux = False
+ use_screen = True
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:
+ if use_ser2net:
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()
+ if use_screen:
+ device_line += template_device_screen.substitute(board=board_name)
+ fp = open("%s/lava-screen.conf" % workerdir, "a")
+ fp.write("%s\n" % board_name)
+ fp.close()
elif "connection_command" in board:
connection_command = board["connection_command"]
device_line += template_device_connection_command.substitute(connection_command=connection_command)