-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathMakefile
167 lines (138 loc) · 7.3 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# Host address on which LAVA is accessible.
LAVA_HOST = localhost
# LAVA user to create/use.
LAVA_USER = admin
# lavacli "identity" (cached credentials name) for the above user,
# to submit jobs, etc.
LAVA_IDENTITY = lava-docker
# Name of LAVA worker to which devices are registered/attached.
LAVA_WORKER = worker0
# sudo echo below is guaranteedly get a sudo password prompt and provide input
# (may be problematic in 2nd command with "&").
all:
docker-compose build
sudo echo
sudo contrib/udev-forward.py -i lava-dispatcher &
docker-compose up
lava-server:
docker-compose build lava-server
docker-compose up lava-server
lava-dispatcher:
docker-compose build lava-dispatcher
docker-compose up lava-dispatcher
stop:
-sudo pkill udev-forward.py
docker-compose stop
clean:
-sudo pkill udev-forward.py
docker-compose rm -vsf
docker volume rm -f lava-server-pgdata lava-server-joboutput lava-server-device-types lava-server-devices lava-server-health-checks lava-server-worker-state lava-server-worker-http lava-server-worker-tftp
# Clean host environment to let LAVA setup run w/o issues. As an example,
# stop ModemManager on Ubuntu, which grabs any new serial device and may
# interfere with commnication on it.
clean-env:
-sudo service apache2 stop
-sudo service ModemManager stop
# Create various board configs for connected board(s). Supposed to be done
# before "install" target.
board-configs:
@echo "Note: you should have *all* of your boards connected to USB before running this."
@echo "Press Ctrl+C to break if not, or Enter to continue. Review results carefully afterwards."
@read dummy
-mv ser2net/ser2net.conf ser2net/ser2net.conf.old
touch ser2net/ser2net.conf
@echo
-mv contrib/LAVA.rules contrib/LAVA.rules.old
contrib/make-board-files.sh devices
# Make any preparation steps (currently none) and build docker-compose images.
build:
docker-compose pull
# Explicitly pull dispatcher image FROM which we build our own.
# Otherwise docker-compose doesn't do that itself.
docker pull lavasoftware/lava-dispatcher:latest
docker-compose build
install:
sudo cp contrib/LAVA.rules /etc/udev/rules.d/
sudo cp contrib/usb-passthrough /usr/local/bin/
sudo udevadm control --reload
# This dir gets bind-mounted to dispatcher container and sub-containers
# it runs, to allow access to downloaded images across them.
sudo mkdir -p /var/lib/lava/dispatcher/tmp/
lava-setup: lava-user lava-identity lava-boards
lava-user:
@echo -n "Input password for the LAVA 'admin' user to be created: "; \
read passwd; \
test -n "$$passwd" && docker-compose exec lava-server lava-server manage users add $(LAVA_USER) --superuser --staff --passwd $$passwd || true
@echo
@echo "Now login with username: admin, passwd: (entered above) at:"
@echo "http://$(LAVA_HOST)/accounts/login/?next=/api/tokens/"
@echo "and create an auth token (long sequence of chars)."
@echo "(Trying to open this link in browser for you.)"
-xdg-open http://$(LAVA_HOST)/accounts/login/?next=/api/tokens/
lava-identity:
@echo
@echo -n "Enter the auth token that you created: "; \
read token; \
test -n "$$token" && lavacli identities add --username $(LAVA_USER) --token $$token --uri http://$(LAVA_HOST)/RPC2 $(LAVA_IDENTITY) || true
lavacli -i $(LAVA_IDENTITY) system version
lava-boards:
# Start with creating "virtual devices", which work in any setup,
# without additional hardware.
-lavacli -i $(LAVA_IDENTITY) device-types add qemu
-lavacli -i $(LAVA_IDENTITY) devices add --type qemu --worker $(LAVA_WORKER) qemu-01
lavacli -i $(LAVA_IDENTITY) devices dict set qemu-01 devices/qemu-01.jinja2
lavacli -i $(LAVA_IDENTITY) devices tags add qemu-01 lite
-lavacli -i $(LAVA_IDENTITY) devices add --type qemu --worker $(LAVA_WORKER) qemu-zephyr-01
lavacli -i $(LAVA_IDENTITY) devices dict set qemu-zephyr-01 devices/qemu-zephyr-01.jinja2
lavacli -i $(LAVA_IDENTITY) devices tags add qemu-zephyr-01 qemu-zephyr
lavacli -i $(LAVA_IDENTITY) devices tags add qemu-zephyr-01 lite
-lavacli -i $(LAVA_IDENTITY) device-types add docker
-lavacli -i $(LAVA_IDENTITY) devices add --type docker --worker $(LAVA_WORKER) docker-01
lavacli -i $(LAVA_IDENTITY) devices dict set docker-01 devices/docker-01.jinja2
lavacli -i $(LAVA_IDENTITY) devices tags add docker-01 zephyr-net
-lavacli -i $(LAVA_IDENTITY) devices add --type docker --worker $(LAVA_WORKER) docker-02
lavacli -i $(LAVA_IDENTITY) devices dict set docker-02 devices/docker-generic.jinja2
lavacli -i $(LAVA_IDENTITY) devices tags add docker-02 inet
# Now create LAVA device types/device for real hardware boards. Note
# that these require actual device configuration files for specific
# boards, which are different from a developer to developer, and
# thus are not included in the common "lite" branch. You're expected to
# generate these files locally, and ideally, store in a personal fork
# of the repository. See the wiki page,
# https://collaborate.linaro.org/pages/viewpage.action?pageId=118293253#GettingStartedwithLAVA,Docker,andaFRDMK64F:-Capturinglocalboardconfigurationforsemi-automatedsetup
# for more info.
# Note that if you run directly from the "lite" branch, the setup will
# still succeed (because various commands below are prefixed with "-"
# to make them non-fatal). In this case, you will be able to use
# virtual devices above, but not hardware boards below.
-lavacli -i $(LAVA_IDENTITY) device-types add musca_a
lavacli -i $(LAVA_IDENTITY) device-types template set musca_a device-types/musca_a.jinja2
-lavacli -i $(LAVA_IDENTITY) device-types add frdm-k64f
-lavacli -i $(LAVA_IDENTITY) devices add --type frdm-k64f --worker $(LAVA_WORKER) frdm-k64f-01
-lavacli -i $(LAVA_IDENTITY) devices dict set frdm-k64f-01 devices/frdm-k64f-01.jinja2
lavacli -i $(LAVA_IDENTITY) devices tags add frdm-k64f-01 zephyr-net
-lavacli -i $(LAVA_IDENTITY) device-types add frdm-kw41z
-lavacli -i $(LAVA_IDENTITY) devices add --type frdm-kw41z --worker $(LAVA_WORKER) frdm-kw41z-01
-lavacli -i $(LAVA_IDENTITY) devices dict set frdm-kw41z-01 devices/frdm-kw41z-01.jinja2
-lavacli -i $(LAVA_IDENTITY) device-types add cc3220SF
-lavacli -i $(LAVA_IDENTITY) devices add --type cc3220SF --worker $(LAVA_WORKER) cc3220SF-01
-lavacli -i $(LAVA_IDENTITY) devices dict set cc3220SF-01 devices/cc3220SF-01.jinja2
lavacli -i $(LAVA_IDENTITY) devices tags add cc3220SF-01 zephyr-net
-lavacli -i $(LAVA_IDENTITY) device-types add cc13x2-launchpad
-lavacli -i $(LAVA_IDENTITY) devices add --type cc13x2-launchpad --worker $(LAVA_WORKER) cc13x2-launchpad-01
-lavacli -i $(LAVA_IDENTITY) devices dict set cc13x2-launchpad-01 devices/cc13x2-launchpad-01.jinja2
lavacli -i $(LAVA_IDENTITY) devices tags add cc13x2-launchpad-01 zephyr-net
-lavacli -i $(LAVA_IDENTITY) device-types add disco-l475-iot1
-lavacli -i $(LAVA_IDENTITY) devices add --type disco-l475-iot1 --worker $(LAVA_WORKER) disco-l475-iot1-01
-lavacli -i $(LAVA_IDENTITY) devices dict set disco-l475-iot1-01 devices/disco-l475-iot1-01.jinja2
lavacli -i $(LAVA_IDENTITY) devices tags add disco-l475-iot1-01 zephyr-net
testjob:
lavacli -i $(LAVA_IDENTITY) jobs submit example/micropython-interactive.job
dispatcher-shell:
docker-compose exec lava-dispatcher bash
server-shell:
docker-compose exec lava-server bash
ser2net-raspi:
scp ser2net/ser2net.conf root@pi-worker01.local:/etc/
ssh root@pi-worker01.local "service ser2net stop; service ser2net start"
.PHONY: all dispatcher clean