From 4bd2731463230669c7c19c0ee085f3019f3ef169 Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Wed, 7 Mar 2018 10:29:25 +0100 Subject: Ensure that tty can be read by cu On some OS, the rights/user from host are not duplicated on guest. So the tty is owned by root and cu could not read it. Force the owning of all tty by uucp --- lava-slave/scripts/start.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lava-slave/scripts/start.sh b/lava-slave/scripts/start.sh index dcbbcd7..ec94aee 100755 --- a/lava-slave/scripts/start.sh +++ b/lava-slave/scripts/start.sh @@ -16,6 +16,8 @@ sleep 2 for item in $(ls /etc/conmux/*cf) do echo "Add $item" + # On some OS, the rights/user from host are not duplicated on guest + grep -o '/dev/[a-zA-Z0-9_-]*' $item | xargs chown uucp /usr/sbin/conmux $item & done -- cgit 1.2.3-korg From c79a1c359bf42a0164f85d7e54476e7b1430b0ec Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Wed, 7 Mar 2018 10:31:40 +0100 Subject: Install qemu-kvm only on x86/x86_64 qemu-kvm is not availlable on ARM. Install it only on supported x86/x86_64 --- lava-master/Dockerfile | 3 ++- lava-slave/Dockerfile | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lava-master/Dockerfile b/lava-master/Dockerfile index 607a79a..a65fd9a 100644 --- a/lava-master/Dockerfile +++ b/lava-master/Dockerfile @@ -33,11 +33,12 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get -y install \ qemu-system \ qemu-system-arm \ qemu-system-i386 \ - qemu-kvm \ ser2net \ u-boot-tools \ python-setproctitle +RUN if [ "$(uname -m)" = "x86_64" -o "$(uname -m)" = "x86" ] ;then apt-get -y install qemu-kvm ; fi + #RUN service postgresql start \ # && DEBIAN_FRONTEND=noninteractive apt-get -y install \ # lava \ diff --git a/lava-slave/Dockerfile b/lava-slave/Dockerfile index 6f2181e..b6a2cee 100644 --- a/lava-slave/Dockerfile +++ b/lava-slave/Dockerfile @@ -24,10 +24,11 @@ RUN \ qemu-system \ qemu-system-arm \ qemu-system-i386 \ - qemu-kvm \ xnbd-server \ e2fsprogs +RUN if [ "$(uname -m)" = "x86_64" -o "$(uname -m)" = "x86" ] ;then apt-get -y install qemu-kvm ; fi + # Uncomment the following for having the latest package (you need to comment all build-lava below) #RUN DEBIAN_FRONTEND=noninteractive apt-get -y install wget gnupg \ # && wget http://images.validation.linaro.org/production-repo/production-repo.key.asc \ -- cgit 1.2.3-korg From 0276f97db590c8187dc6b8df21c6bb06ca53100f Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Wed, 7 Mar 2018 10:38:33 +0100 Subject: Move copy of helper scripts Since nothing depends on them, copy them at last step. This prevents rebuild of all docker steps when changing them. --- lava-slave/Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lava-slave/Dockerfile b/lava-slave/Dockerfile index b6a2cee..b5e6385 100644 --- a/lava-slave/Dockerfile +++ b/lava-slave/Dockerfile @@ -2,10 +2,6 @@ FROM bitnami/minideb:stretch RUN apt-get update -# Add services helper utilities to start and stop LAVA -COPY scripts/stop.sh . -COPY scripts/start.sh . - # e2fsprogs is for libguestfs RUN \ echo 'lava-server lava-server/instance-name string lava-slave-instance' | debconf-set-selections && \ @@ -57,6 +53,10 @@ RUN apt-get update RUN DEBIAN_FRONTEND=noninteractive apt-get -y install cu RUN rm /etc/apt/sources.list.d/testing.list +# Add services helper utilities to start and stop LAVA +COPY scripts/stop.sh . +COPY scripts/start.sh . + EXPOSE 69/udp 80 CMD /start.sh -- cgit 1.2.3-korg From 32ad2b81fcd4ac8980a7ebbc2eb583314c3c569f Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Fri, 16 Feb 2018 15:01:08 +0100 Subject: Rename lab to worker This patch fix the misleading name lab to the more proper worker since a lab could be a group of workers. --- lavalab-gen.py | 40 ++++++++++++++++++++-------------------- lavalab-gen.sh | 4 ++-- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/lavalab-gen.py b/lavalab-gen.py index 396579e..6e9a547 100755 --- a/lavalab-gen.py +++ b/lavalab-gen.py @@ -45,7 +45,7 @@ SUBSYSTEM=="tty", ATTRS{idVendor}=="${idvendor}", ATTRS{idProduct}=="${idproduct def main(): fp = open(boards_yaml, "r") - labs = yaml.load(fp) + workers = yaml.load(fp) fp.close() tdc = open("docker-compose.template", "r") dockcomp = yaml.load(tdc) @@ -61,21 +61,21 @@ def main(): fp = open("lava-slave/conmux/.empty", "w") fp.close() - for lab_name in labs: + for worker_name in workers: udev_line ="" - lab = labs[lab_name] + worker = workers[worker_name] use_kvm = False - if "host_has_cpuflag_kvm" in lab: - use_kvm = lab["host_has_cpuflag_kvm"] + if "host_has_cpuflag_kvm" in worker: + use_kvm = worker["host_has_cpuflag_kvm"] if use_kvm: - if "devices" in dockcomp["services"][lab_name]: - dc_devices = dockcomp["services"][lab_name]["devices"] + if "devices" in dockcomp["services"][worker_name]: + dc_devices = dockcomp["services"][worker_name]["devices"] else: - dockcomp["services"][lab_name]["devices"] = [] - dc_devices = dockcomp["services"][lab_name]["devices"] + dockcomp["services"][worker_name]["devices"] = [] + dc_devices = dockcomp["services"][worker_name]["devices"] dc_devices.append("/dev/kvm:/dev/kvm") - for board_name in lab["boardlist"]: - b = lab["boardlist"][board_name] + for board_name in worker["boardlist"]: + b = worker["boardlist"][board_name] if b.get("disabled", None): continue @@ -104,11 +104,11 @@ def main(): else: devpath = b["uart"]["devpath"] udev_line += template_udev_devpath.substitute(board=board_name, devpath=devpath, idvendor="%04x" % idvendor, idproduct="%04x" % idproduct) - if "devices" in dockcomp["services"][lab_name]: - dc_devices = dockcomp["services"][lab_name]["devices"] + if "devices" in dockcomp["services"][worker_name]: + dc_devices = dockcomp["services"][worker_name]["devices"] else: - dockcomp["services"][lab_name]["devices"] = [] - dc_devices = dockcomp["services"][lab_name]["devices"] + 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("lava-slave/conmux/%s.cf" % board_name, "w") fp.write(line) @@ -129,7 +129,7 @@ def main(): device_line += "{% set no_kvm = True %}\n" if not os.path.isdir("lava-master/devices/"): os.mkdir("lava-master/devices/") - device_path = "lava-master/devices/%s" % lab_name + device_path = "lava-master/devices/%s" % worker_name if not os.path.isdir(device_path): os.mkdir(device_path) board_device_file = "%s/%s.jinja2" % (device_path, board_name) @@ -138,12 +138,12 @@ def main(): fp.close() if not os.path.isdir("udev"): os.mkdir("udev") - fp = open("udev/99-lavalab-udev-%s.rules" % lab_name, "w") + fp = open("udev/99-lavaworker-udev-%s.rules" % worker_name, "w") fp.write(udev_line) fp.close() - if "dispatcher_ip" in lab: - fp = open("lava-master/slaves/%s.yaml" % lab_name, "w") - fp.write("dispatcher_ip: %s" % lab["dispatcher_ip"]) + if "dispatcher_ip" in worker: + fp = open("lava-master/slaves/%s.yaml" % worker_name, "w") + fp.write("dispatcher_ip: %s" % worker["dispatcher_ip"]) fp.close() #now proceed with tokens diff --git a/lavalab-gen.sh b/lavalab-gen.sh index d6fcf94..a227d83 100755 --- a/lavalab-gen.sh +++ b/lavalab-gen.sh @@ -18,8 +18,8 @@ BEROOT="" if [ $(id -u) -ne 0 ];then BEROOT="sudo " fi -$BEROOT rm /etc/udev/rules.d/*lavalab*rules -$BEROOT cp udev/*lavalab*rules /etc/udev/rules.d/ +$BEROOT rm /etc/udev/rules.d/*lava*rules +$BEROOT cp udev/*lava*rules /etc/udev/rules.d/ $BEROOT udevadm control --reload-rules || exit $? $BEROOT udevadm trigger || exit $? -- cgit 1.2.3-korg From 277552fb20a1b9919d9600390f96ecd1c71d44e8 Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Wed, 7 Mar 2018 10:44:52 +0100 Subject: Reorder start of slave services Starting lava-slave too early is dangerous since some services it needs are not started yet. Always start lava-slave in last. --- lava-slave/scripts/start.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lava-slave/scripts/start.sh b/lava-slave/scripts/start.sh index ec94aee..92e76bb 100755 --- a/lava-slave/scripts/start.sh +++ b/lava-slave/scripts/start.sh @@ -6,10 +6,6 @@ fi service tftpd-hpa start || exit 4 -# FIXME lava-slave does not run if old pid is present -rm -f /var/run/lava-slave.pid -service lava-slave start || exit 5 - touch /var/run/conmux-registry /usr/sbin/conmux-registry 63000 /var/run/conmux-registry& sleep 2 @@ -22,4 +18,10 @@ do done # start an http file server for boot/transfer_overlay support -(cd /var/lib/lava/dispatcher; python -m SimpleHTTPServer 80) +(cd /var/lib/lava/dispatcher; python -m SimpleHTTPServer 80) & + +# FIXME lava-slave does not run if old pid is present +rm -f /var/run/lava-slave.pid +service lava-slave start || exit 5 + +sleep 3650d -- cgit 1.2.3-korg From ce5aedf52f6c67e849b31b22dc083dc56f02543c Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Thu, 8 Mar 2018 12:13:17 +0100 Subject: labalab-gen.sh: clean all generated files Some generated files are not cleaned, add them to the toclean list --- lavalab-gen.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lavalab-gen.sh b/lavalab-gen.sh index a227d83..60c5d94 100755 --- a/lavalab-gen.sh +++ b/lavalab-gen.sh @@ -6,6 +6,9 @@ rm -rv lava-slave/conmux/ rm -rv lava-master/tokens/ rm -rv lava-master/users/ rm udev/*lavalab*rules +rm lava-master/scripts/build-lava +rm lava-slave/scripts/build-lava +rm docker-compose.yml if [ "$1" = "mrproper" ];then exit 0 -- cgit 1.2.3-korg From 018f10b1c57760071fd20cd052b1eff5ec32ecd7 Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Thu, 12 Apr 2018 11:53:43 +0200 Subject: Add uboot_ipaddr Some boards have broken uboot dhcp, so we need to set a static ip in uboot. This patch add a way to specify such IP via uboot_ipaddr. --- README.md | 1 + lavalab-gen.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/README.md b/README.md index d72b6c0..5194b67 100644 --- a/README.md +++ b/README.md @@ -220,6 +220,7 @@ lab-slave-XX: The name of the slave (where XX is a number) boardlist: devicename: Each board must be named by their device-type as "device-type-XX" (where XX is a number) type: the LAVA device-type of this device + uboot_ipaddr: (optional) a static IP to set in uboot macaddr: (Optional) the MAC address to set in uboot # One of uart or connection_command must be choosen uart: diff --git a/lavalab-gen.py b/lavalab-gen.py index 6e9a547..d01ccb1 100755 --- a/lavalab-gen.py +++ b/lavalab-gen.py @@ -117,6 +117,8 @@ def main(): elif "connection_command" in b: connection_command = b["connection_command"] device_line += template_device_connection_command.substitute(connection_command=connection_command) + if "uboot_ipaddr" in b: + device_line += "{%% set uboot_ipaddr_cmd = 'setenv ipaddr %s' %%}\n" % b["uboot_ipaddr"] if "macaddr" in b: device_line += '{% set uboot_set_mac = true %}' device_line += "{%% set uboot_mac_addr = '%s' %%}" % b["macaddr"] -- cgit 1.2.3-korg From 9b618eb08b00cf6a84b157c462025b22c951a4b2 Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Thu, 12 Apr 2018 11:55:07 +0200 Subject: Rename macaddr to uboot_macaddr For clarify the use of macaddr, rename it to uboot_macaddr. --- README.md | 2 +- boards.yaml.example | 2 +- lavalab-gen.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5194b67..0529b54 100644 --- a/README.md +++ b/README.md @@ -221,7 +221,7 @@ lab-slave-XX: The name of the slave (where XX is a number) devicename: Each board must be named by their device-type as "device-type-XX" (where XX is a number) type: the LAVA device-type of this device uboot_ipaddr: (optional) a static IP to set in uboot - macaddr: (Optional) the MAC address to set in uboot + uboot_macaddr: (Optional) the MAC address to set in uboot # One of uart or connection_command must be choosen uart: idvendor: The VID of the UART (Formated as 0xXXXX) diff --git a/boards.yaml.example b/boards.yaml.example index 1e485a4..5737a48 100644 --- a/boards.yaml.example +++ b/boards.yaml.example @@ -33,7 +33,7 @@ lab-slave-0: idvendor: 0x067b idproduct: 0x2303 devpath: 1.1.4 - macaddr: "00:FA:E0:DE:AD:78" + uboot_macaddr: "00:FA:E0:DE:AD:78" dragonboard-410c-01: type: dragonboard-410c pdu_generic: diff --git a/lavalab-gen.py b/lavalab-gen.py index d01ccb1..08e2649 100755 --- a/lavalab-gen.py +++ b/lavalab-gen.py @@ -119,9 +119,9 @@ def main(): device_line += template_device_connection_command.substitute(connection_command=connection_command) if "uboot_ipaddr" in b: device_line += "{%% set uboot_ipaddr_cmd = 'setenv ipaddr %s' %%}\n" % b["uboot_ipaddr"] - if "macaddr" in b: + if "uboot_macaddr" in b: device_line += '{% set uboot_set_mac = true %}' - device_line += "{%% set uboot_mac_addr = '%s' %%}" % b["macaddr"] + device_line += "{%% set uboot_mac_addr = '%s' %%}\n" % b["uboot_macaddr"] if "fastboot_serial_number" in b: fserial = b["fastboot_serial_number"] device_line += "{%% set fastboot_serial_number = '%s' %%}" % fserial -- cgit 1.2.3-korg From 287e03c09e34ec77d696fcd7ad55912cc127a859 Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Fri, 13 Apr 2018 09:34:56 +0200 Subject: Permit to add custom option in board files Some board need some jinja options (ex: nanopik2 need use_vendor_uboot) but adding all possible options is not worth the cost. So this patch adds a custom way to add option to board file. --- lavalab-gen.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lavalab-gen.py b/lavalab-gen.py index 08e2649..037b5ff 100755 --- a/lavalab-gen.py +++ b/lavalab-gen.py @@ -125,6 +125,9 @@ def main(): if "fastboot_serial_number" in b: fserial = b["fastboot_serial_number"] device_line += "{%% set fastboot_serial_number = '%s' %%}" % fserial + if "custom_option" in b: + for coption in b["custom_option"]: + device_line += "{%% %s %%}" % coption # board specific hacks if devicetype == "qemu" and not use_kvm: -- cgit 1.2.3-korg