Add trampoline scripts to CI
This commit is contained in:
parent
056f572ee9
commit
8b491f519b
@ -3,4 +3,4 @@ build:lagarto-ox-rd:
|
|||||||
tags:
|
tags:
|
||||||
- nix
|
- nix
|
||||||
script:
|
script:
|
||||||
- nix develop -L .#lagarto-ox-rd --command env
|
- nix develop -L .#lagarto-ox-rd --command fpga/run-remotely.sh fpgalogin1:ci
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
#!/usr/bin/bash
|
#!/usr/bin/bash
|
||||||
|
|
||||||
set -x
|
#set -x
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
source ./env.sh
|
source ./env.sh
|
||||||
|
|
||||||
#bitstream="-w system-acme_ea-4h2v.bit"
|
bitstream="-w bitstream.bit"
|
||||||
|
|
||||||
./fpgactl $bitstream -b opensbi.bin -k kernel.bin -i initrd.bin -r rootfs.img -R bootrom.bin
|
./fpgactl $bitstream -R bootrom.bin -b opensbi.bin -k kernel.bin -i initrd.bin -r rootfs.img
|
||||||
|
|
||||||
picocom -b 115200 /dev/ttyUSB2
|
picocom -b 115200 $FPGACTL_UART
|
||||||
|
31
fpga/run-login.sh
Executable file
31
fpga/run-login.sh
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
#!/usr/bin/bash
|
||||||
|
|
||||||
|
#set -x
|
||||||
|
set -e
|
||||||
|
|
||||||
|
path="$1"
|
||||||
|
|
||||||
|
# First determine if we already have jobs already
|
||||||
|
n=$(squeue --me -lh | wc -l)
|
||||||
|
|
||||||
|
if [ "$n" -gt 1 ]; then
|
||||||
|
echo "Too many jobs queued already" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$n" == 0 ]; then
|
||||||
|
# No running jobs, so allocate a new job
|
||||||
|
echo salloc -N 1 --constraint=dmaqdma --no-shell
|
||||||
|
fi
|
||||||
|
|
||||||
|
while [ "$n" != 1 ]; do
|
||||||
|
sleep 2
|
||||||
|
n=$(squeue --me -lh)
|
||||||
|
done
|
||||||
|
|
||||||
|
host=$(squeue -h -o %N)
|
||||||
|
|
||||||
|
echo "Switching to $host"
|
||||||
|
|
||||||
|
# Continue the execution there
|
||||||
|
ssh "$host" "$path/run-node.sh" "$path"
|
30
fpga/run-node.sh
Executable file
30
fpga/run-node.sh
Executable file
@ -0,0 +1,30 @@
|
|||||||
|
#!/usr/bin/bash
|
||||||
|
|
||||||
|
#set -x
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo "Hello from $(hostname)"
|
||||||
|
|
||||||
|
path="$1"
|
||||||
|
|
||||||
|
cd "$path"
|
||||||
|
|
||||||
|
# First kill any picocom instance
|
||||||
|
killall picocom || true
|
||||||
|
|
||||||
|
# Setup the environment
|
||||||
|
. env.sh
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
|
# Then perform the boot
|
||||||
|
./fpgactl -w bitstream.bit -R bootrom.bin -b opensbi.bin -k kernel.bin -i initrd.bin # -r rootfs.img
|
||||||
|
|
||||||
|
# Restart it again only loading the bootrom and OpenSBI (notice OpenSBI
|
||||||
|
# relocates itself so it will likely be gone by now)
|
||||||
|
sleep 1 && ./fpgactl -R bootrom.bin -b opensbi.bin &
|
||||||
|
|
||||||
|
# Set dead switch
|
||||||
|
sleep 30 && killall picocom &
|
||||||
|
|
||||||
|
picocom -q -x 10000 -b 115200 $FPGACTL_UART
|
21
fpga/run-remotely.sh
Executable file
21
fpga/run-remotely.sh
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Executes a pipeline in a remote machine taking the values from the environment
|
||||||
|
# Usage fpga/run-remotely.sh <host>:<path>
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
dst=fpgalogin1:nixos
|
||||||
|
|
||||||
|
if [ "$1" != "" ]; then
|
||||||
|
dst="$1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
path=${dst#*:}
|
||||||
|
|
||||||
|
# Copy all required elements to the destination machine
|
||||||
|
fpga/upload.sh "$dst"
|
||||||
|
|
||||||
|
# Launch the pipeline from there
|
||||||
|
set +x
|
||||||
|
ssh fpgalogin1 "$path/run-login.sh" "$path" | awk -f fpga/verify.awk
|
@ -3,16 +3,18 @@
|
|||||||
set -e
|
set -e
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
#dst=femu:nixos/
|
#dst=femu:nixos
|
||||||
dst=fpgalogin1:nixos/
|
dst=fpgalogin1:nixos
|
||||||
|
|
||||||
if [ "$1" != "" ]; then
|
if [ "$1" != "" ]; then
|
||||||
dst="$1"
|
dst="$1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rsync -a fpga/fpgactl "$dst"
|
rsync -a fpga/run-login.sh "$dst/"
|
||||||
#rsync -a fpga/boot.sh "$dst"
|
rsync -a fpga/run-node.sh "$dst/"
|
||||||
rsync -a fpga/env.sh "$dst"
|
rsync -a fpga/fpgactl "$dst/"
|
||||||
|
rsync -a fpga/boot.sh "$dst/"
|
||||||
|
rsync -a fpga/env.sh "$dst/"
|
||||||
rsync $(find "$OPENSBI" -name fw_payload.bin) "$dst/opensbi.bin"
|
rsync $(find "$OPENSBI" -name fw_payload.bin) "$dst/opensbi.bin"
|
||||||
rsync "$KERNEL/Image" "$dst/kernel.bin"
|
rsync "$KERNEL/Image" "$dst/kernel.bin"
|
||||||
rsync "$INITRD/initrd" "$dst/initrd.bin"
|
rsync "$INITRD/initrd" "$dst/initrd.bin"
|
||||||
|
20
fpga/verify.awk
Normal file
20
fpga/verify.awk
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
BEGIN {
|
||||||
|
bootrom_ok = 0
|
||||||
|
opensbi_ok = 0
|
||||||
|
test_ok = 0
|
||||||
|
}
|
||||||
|
/RBOOTROM/ { bootrom_ok = 1 }
|
||||||
|
/^OpenSBI v/ { opensbi_ok = 1 }
|
||||||
|
/^TEST-RESULT-OK/ { test_ok = 1 }
|
||||||
|
{ printf "line> "; print }
|
||||||
|
END {
|
||||||
|
printf "Test summary:\n"
|
||||||
|
printf " Bootrom: %s\n", bootrom_ok ? "OK" : "FAIL";
|
||||||
|
printf " OpenSBI: %s\n", opensbi_ok ? "OK" : "FAIL";
|
||||||
|
#printf " Result: %s\n", test_ok ? "OK" : "FAIL";
|
||||||
|
|
||||||
|
if (bootrom_ok && opensbi_ok)
|
||||||
|
exit 0;
|
||||||
|
else
|
||||||
|
exit 1;
|
||||||
|
}
|
@ -108,7 +108,7 @@ final: prev:
|
|||||||
};
|
};
|
||||||
|
|
||||||
rbootrom = prev.pkgsStatic.stdenv.mkDerivation {
|
rbootrom = prev.pkgsStatic.stdenv.mkDerivation {
|
||||||
name = "sa-fpga-tests";
|
name = "rbootrom";
|
||||||
src = ./bootrom;
|
src = ./bootrom;
|
||||||
dontConfigure = true;
|
dontConfigure = true;
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
|
Loading…
Reference in New Issue
Block a user