3 # Boot script for Chrome OS devices attached to a servo debug connector, using
4 # NFS and TFTP to boot.
6 # We're run from the root of the repo, make a helper var for our paths
7 BM
=$CI_PROJECT_DIR/.gitlab-ci
/bare-metal
10 if [ -z "$BM_SERIAL" ]; then
11 echo "Must set BM_SERIAL in your gitlab-runner config.toml [[runners]] environment"
12 echo "This is the CPU serial device."
16 if [ -z "$BM_SERIAL_EC" ]; then
17 echo "Must set BM_SERIAL in your gitlab-runner config.toml [[runners]] environment"
18 echo "This is the EC serial device for controlling board power"
22 if [ ! -d /nfs
]; then
23 echo "NFS rootfs directory needs to be mounted at /nfs by the gitlab runner"
27 if [ ! -d /tftp
]; then
28 echo "TFTP directory for this board needs to be mounted at /tftp by the gitlab runner"
33 if [ -z "$BM_KERNEL" ]; then
34 echo "Must set BM_KERNEL to your board's kernel FIT image"
38 if [ -z "$BM_ROOTFS" ]; then
39 echo "Must set BM_ROOTFS to your board's rootfs directory in the job's variables"
43 if [ -z "$BM_CMDLINE" ]; then
44 echo "Must set BM_CMDLINE to your board's kernel command line arguments"
50 # Create the rootfs in the NFS directory. rm to make sure it's in a pristine
51 # state, since it's volume-mounted on the host.
54 .
$BM/rootfs-setup.sh
/nfs
56 # Set up the TFTP kernel/cmdline. When we support more than one board with
57 # this method, we'll need to do some check on the runner name or something.
59 cp $BM_KERNEL /tftp
/vmlinuz
60 echo "$BM_CMDLINE" > /tftp
/cmdline
62 # Start watching serials, and power up the device.
63 $BM/serial-buffer.py
$BM_SERIAL_EC |
tee serial-ec-output.txt |
sed -u 's|^|SERIAL-EC> |g' &
64 $BM/serial-buffer.py
$BM_SERIAL |
tee serial-output.txt |
sed -u 's|^|SERIAL-CPU> |g' &
65 while [ ! -e serial-output.txt
]; do
68 # Flush any partial commands in the EC's prompt, then ask for a reboot.
69 $BM/write-serial.py
$BM_SERIAL_EC ""
70 $BM/write-serial.py
$BM_SERIAL_EC reboot
72 # This is emitted right when the bootloader pauses to check for input. Emit a
73 # ^N character to request network boot, because we don't have a
74 # direct-to-netboot firmware on cheza.
75 $BM/expect-output.sh serial-output.txt
"load_archive: loading locale_en.bin"
76 $BM/write-serial.py
$BM_SERIAL `printf '\016'`
78 # Wait for the device to complete the deqp run
79 $BM/expect-output.sh serial-output.txt
"DEQP RESULT"
81 # power down the CPU on the device
82 $BM/write-serial.py
$BM_SERIAL_EC 'power off'
86 # Bring artifacts back from the NFS dir to the build dir where gitlab-runner
87 # will look for them. Note that results/ may already exist, so be careful
90 cp -Rp /nfs
/results
/. results
/
93 if grep -q "DEQP RESULT: pass" serial-output.txt
; then