summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkhilman <khilman@users.noreply.github.com>2018-05-25 08:22:05 -0700
committerGitHub <noreply@github.com>2018-05-25 08:22:05 -0700
commit2d79d03f5818c096535c9784b12df5ea99c0dbff (patch)
tree74a361f40db3149eeecc6e468933c9ca968358ca
parentb71a8c43342631b540ac2a3b05962f640f2f0fd7 (diff)
parent287e03c09e34ec77d696fcd7ad55912cc127a859 (diff)
Merge pull request #25 from montjoie/miscfix03
Miscfix03
-rw-r--r--README.md3
-rw-r--r--boards.yaml.example2
-rw-r--r--lava-master/Dockerfile3
-rw-r--r--lava-slave/Dockerfile11
-rwxr-xr-xlava-slave/scripts/start.sh14
-rwxr-xr-xlavalab-gen.py49
-rwxr-xr-xlavalab-gen.sh7
7 files changed, 52 insertions, 37 deletions
diff --git a/README.md b/README.md
index d72b6c0..0529b54 100644
--- a/README.md
+++ b/README.md
@@ -220,7 +220,8 @@ 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
- macaddr: (Optional) the MAC address to set in uboot
+ uboot_ipaddr: (optional) a static IP 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/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..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 && \
@@ -24,10 +20,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 \
@@ -56,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
diff --git a/lava-slave/scripts/start.sh b/lava-slave/scripts/start.sh
index dcbbcd7..92e76bb 100755
--- a/lava-slave/scripts/start.sh
+++ b/lava-slave/scripts/start.sh
@@ -6,18 +6,22 @@ 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
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
# 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
diff --git a/lavalab-gen.py b/lavalab-gen.py
index 396579e..037b5ff 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)
@@ -117,19 +117,24 @@ def main():
elif "connection_command" in b:
connection_command = b["connection_command"]
device_line += template_device_connection_command.substitute(connection_command=connection_command)
- if "macaddr" in b:
+ if "uboot_ipaddr" in b:
+ device_line += "{%% set uboot_ipaddr_cmd = 'setenv ipaddr %s' %%}\n" % b["uboot_ipaddr"]
+ 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
+ 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:
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 +143,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..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
@@ -18,8 +21,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 $?