diff --git a/README.md b/README.md index 59012ea..7753e47 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,7 @@ Options: single image file; x86 currently expects two, the kernel and the root task. - `-w` _TIME_ Number of seconds to wait between each attempt to acquire the lock (default 8) - `-t` _RETRIES_ Number of retries to perform for acquiring the lock (default -1) +- `--bitstream` _FILE_ Optional bitstream file to load to the FPGA. `mq sem dumpall|-signal|-wait|-cancel|-info `__` [-f] [-w `_retry-time_` ] [-t `_retry-count_` ] [-k `_LOCK_\__KEY_` ] [-T` _timeout_`]` diff --git a/scripts/enqueue b/scripts/enqueue index 5d8cc6c..92d56d5 100755 --- a/scripts/enqueue +++ b/scripts/enqueue @@ -42,7 +42,7 @@ EnqueueUsage() { echo " -s TEXT Specifies which machine this job is for" echo " -f FILE [+] Files to use as the job image" echo " -w TIME Number of seconds to wait between each attempt to acquire the lock (default 8)" - echo " -t RETRIES Number of retries to preform for acquiring the lock (default -1)" + echo " --bitstream FILE Optional bitstream to load to the FPGA" echo } @@ -78,6 +78,15 @@ Enqueue() { # that it is a dtb later dtbflag="-b $1" ;; + --bitstream) + shift + if ! [ -f "$1" ]; then + echo "bitstream file \"$1\" either does not exist, or is not considered a valid file" + exit -1 + fi + + bitstreamflag="--bitstream $1" + ;; -l) shift logfile="$1" @@ -245,7 +254,8 @@ Enqueue() { # parameters '-b' and 'my.dtb' # 'linux' is deliberately not in quotes so it will not create an empty # parameter if the flag is not set - SystemRunImage "${system}" "${completion}" "${completion_timeout}" "${errortxt}" "${logfile}" "${keep_alive}" ${linux} ${dtbflag} $files + # Ditto for 'bitstreamflag' + SystemRunImage "${system}" "${completion}" "${completion_timeout}" "${errortxt}" "${logfile}" "${keep_alive}" ${linux} ${dtbflag} ${bitstreamflag} $files ret=$? fi diff --git a/scripts/runner b/scripts/runner index e3913de..f2c1511 100755 --- a/scripts/runner +++ b/scripts/runner @@ -77,8 +77,17 @@ RebootConsoleRunTwoFiles() { return 1 fi fi + if [ ! -z "${bitstream}" ]; then + bitstreamfile=$(RemoteCommandOn ${HOST} "mktemp") + bitstreamflag="--bitstream $bitstreamfile" + if ! scp "${bitstream}" "${HOST}:${bitstreamfile}"; then + echo "Failed to copy bitstream file" + RemoteCommandOn ${HOST} rm -f "${kernelfile}" "${rootserverfile}" "${logfile}" "${dtbfile}" "${bitstreamfile}" + return 1 + fi + fi - ssh -tt -oLogLevel=quiet ${HOST} "stty isig -echoctl -echo; /tftpboot/${machine}/reboot $linux $dtbflag -l '${logfile}' -c '${completion}' -t '${completion_timeout}' -e '${errortxt}' -k '${kernelfile}' -u '${rootserverfile}' ${ka_flag}" + ssh -tt -oLogLevel=quiet ${HOST} "stty isig -echoctl -echo; /tftpboot/${machine}/reboot $linux $dtbflag $bitstreamflag -l '${logfile}' -c '${completion}' -t '${completion_timeout}' -e '${errortxt}' -k '${kernelfile}' -u '${rootserverfile}' ${ka_flag}" ret=$? if [ "${output}" != "" ]; then scp "${HOST}:${logfile}" "${output}" @@ -87,12 +96,15 @@ RebootConsoleRunTwoFiles() { if [ ! -z "${dtb}" ]; then RemoteCommandOn ${HOST} rm -f "${dtbfile}" fi + if [ ! -z "${bitstream}" ]; then + RemoteCommandOn ${HOST} rm -f "${bitstreamfile}" + fi return $ret fi if [ "${output}" = "" ]; then - "/tftpboot/${machine}/reboot" $linux $dtbflag -t "${completion_timeout}" -c "${completion}" -e "${errortxt}" -k "${kernel}" -u "${rootserver}" ${ka_flag} + "/tftpboot/${machine}/reboot" $linux $dtbflag $bitstreamflag -t "${completion_timeout}" -c "${completion}" -e "${errortxt}" -k "${kernel}" -u "${rootserver}" ${ka_flag} else - "/tftpboot/${machine}/reboot" $linux $dtbflag -t "${completion_timeout}" -c "${completion}" -e "${errortxt}" -l "${output}" -k "${kernel}" -u "${rootserver}" ${ka_flag} + "/tftpboot/${machine}/reboot" $linux $dtbflag $bitstreamflag -t "${completion_timeout}" -c "${completion}" -e "${errortxt}" -l "${output}" -k "${kernel}" -u "${rootserver}" ${ka_flag} fi } @@ -106,6 +118,11 @@ RebootConsoleRunOneFile() { dtb="$1" shift } + [ "$1" = '--bitstream' ] && { + shift + bitstream="$1" + shift + } completion=$1 completion_timeout=$2 errortxt=$3 @@ -134,13 +151,21 @@ RebootConsoleRunOneFile() { if [ ! -z "${dtb}" ]; then dtbfile=$(RemoteCommandOn ${HOST} "mktemp") dtbflag="-b $dtbfile" - if ! scp "${dtb}" "${HOST}:${kernelfile}"; then + if ! scp "${dtb}" "${HOST}:${dtbfile}"; then echo "Failed to copy dtb file" RemoteCommandOn ${HOST} rm -f "${dtbfile}" "${kernelfile}" "${logfile}" fi fi + if [ ! -z "${bitstream}" ]; then + bitstreamfile=$(RemoteCommandOn ${HOST} "mktemp") + bitstreamflag="--bitstream $bitstreamfile" + if ! scp "${bitstream}" "${HOST}:${bitstreamfile}"; then + echo "Failed to copy bitstream file" + RemoteCommandOn ${HOST} rm -f "${bitstreamfile} ${dtbfile}" "${kernelfile}" "${logfile}" + fi + fi - ssh -tt -oLogLevel=quiet ${HOST} "stty isig -echoctl -echo; /tftpboot/${machine}/reboot $linux $dtbflag -l '${logfile}' -c '${completion}' -t '${completion_timeout}' -e '${errortxt}' -k '${kernelfile}' ${ka_flag}" + ssh -tt -oLogLevel=quiet ${HOST} "stty isig -echoctl -echo; /tftpboot/${machine}/reboot $linux $dtbflag $bitstreamflag -l '${logfile}' -c '${completion}' -t '${completion_timeout}' -e '${errortxt}' -k '${kernelfile}' ${ka_flag}" ret=$? if [ "${output}" != "" ]; then scp "${HOST}:${logfile}" "${output}" @@ -149,11 +174,14 @@ RebootConsoleRunOneFile() { if [ ! -z "${dtb}" ]; then RemoteCommandOn ${HOST} rm -f "${dtbfile}" fi + if [ ! -z "${bitstream}" ]; then + RemoteCommandOn ${HOST} rm -f "${bitstreamfile}" + fi return $ret fi if [ "${output}" = "" ]; then - "/tftpboot/${machine}/reboot" $linux $dtbflag -t "${completion_timeout}" -c "${completion}" -e "${errortxt}" -k "${kernel}" ${ka_flag} + "/tftpboot/${machine}/reboot" $linux $dtbflag $bitstreamflag -t "${completion_timeout}" -c "${completion}" -e "${errortxt}" -k "${kernel}" ${ka_flag} else - "/tftpboot/${machine}/reboot" $linux $dtbflag -t "${completion_timeout}" -c "${completion}" -e "${errortxt}" -l "${output}" -k "${kernel}" ${ka_flag} + "/tftpboot/${machine}/reboot" $linux $dtbflag $bitstreamflag -t "${completion_timeout}" -c "${completion}" -e "${errortxt}" -l "${output}" -k "${kernel}" ${ka_flag} fi } diff --git a/scripts/system b/scripts/system index a998a12..c18a4cf 100755 --- a/scripts/system +++ b/scripts/system @@ -140,12 +140,19 @@ SystemRunImage() { shift 2 kernel="$7" } + + [ $kernel = "--bitstream" ] && { + bitstreamflag="$7 $8" + shift 2 + kernel="$7" + } + system_name="$("SystemName_${system}")" if [ "$("SystemNumFiles_${system}" $linux)" -eq 2 ]; then rootserver="$8" - RebootConsoleRunTwoFiles $linux $dtbflag "${completion}" "${completion_timeout}" "${errortxt}" "${logfile}" "${keep_alive}" "${kernel}" "${rootserver}" "${system_name}" + RebootConsoleRunTwoFiles $linux $dtbflag $bitstreamflag "${completion}" "${completion_timeout}" "${errortxt}" "${logfile}" "${keep_alive}" "${kernel}" "${rootserver}" "${system_name}" else - RebootConsoleRunOneFile $linux $dtbflag "${completion}" "${completion_timeout}" "${errortxt}" "${logfile}" "${keep_alive}" "${kernel}" "${system_name}" + RebootConsoleRunOneFile $linux $dtbflag $bitstreamflag "${completion}" "${completion_timeout}" "${errortxt}" "${logfile}" "${keep_alive}" "${kernel}" "${system_name}" fi } diff --git a/scripts/systems/cheshire1 b/scripts/systems/cheshire1 new file mode 100644 index 0000000..6ea266d --- /dev/null +++ b/scripts/systems/cheshire1 @@ -0,0 +1,62 @@ +#!/bin/sh +# +# Copyright 2025 UNSW, Sydney +# +# SPDX-License-Identifier: GPL-2.0-only + +if [ "${SCRIPT_PATH}" = "" ]; then + echo "This script should not be called directly! Please use mq.sh" + exit -1 +fi + +SystemNumFiles_cheshire1() { + echo 1 +} + +SystemName_cheshire1() { + echo "cheshire1" +} + +SystemPowerOff_cheshire1() { + RebootShutdown cheshire1 +} + +Arch_cheshire1() { + echo "riscv" +} + +ISA_cheshire1() { + echo "rv64imafdcsuh" +} + +SOC_cheshire1() { + echo "PULP Platform Cheshire" +} + +CPU_cheshire1() { + echo "CVA6" +} + +Cores_cheshire1() { + echo "1" +} + +RAM_cheshire1() { + echo "1GB" +} + +MaxCLK_cheshire1() { + echo "50MHz" +} + +Sel4Plat_cheshire1() { + echo "cheshire" +} + +PXELinux_cheshire1() { + echo "no" +} + +DTB_cheshire1() { + echo "no" +}