Initial install script

This commit is contained in:
Bradlee Speice 2024-09-19 20:49:00 -04:00
commit 498cfd4c39

73
install_openonload.sh Executable file
View File

@ -0,0 +1,73 @@
#!/bin/bash
set -eu
debsrc_url="https://www.xilinx.com/content/dam/xilinx/publications/solarflare/onload/openonload/8-1-3-40/SF-122451-LS-14-OpenOnload-DEB-Release-Package.zip"
debsrc_folder="onload-8.1.3.40"
build_packages=(
"debhelper"
"devscripts"
"gawk"
"libcap-dev"
"libpcap-dev"
"python3-dev"
)
build_folder="$(mktemp -d)"
build_log="$build_folder/log"
function log() {
echo "-- $*"
}
function cmd() {
cmd_redirect="$* 1>> \"$build_log\" 2>&1"
log "Running: $*"
eval "$cmd_redirect"
return $?
}
log "Installing in $build_folder; logs available at $build_log"
log
log "Installing build packages:"
cmd sudo apt install -y "${build_packages[@]}"
log
debsrc_filename="/tmp/$(basename $debsrc_url)"
log "Retrieving OpenOnload sources:"
cmd wget -NP /tmp "$debsrc_url"
log
log "Unpacking OpenOnload sources:"
cmd pushd "$build_folder" && \
cmd busybox unzip "$debsrc_filename" && \
cmd tar xf ./*.tgz && \
cmd dpkg-source -x ./*.dsc
log
log "Building OpenOnload:"
cmd pushd "$build_folder/$debsrc_folder" && \
cmd debuild -i -uc -us
log
install_debs=("$build_folder"/*.deb)
log "Installing OpenOnload packages:"
cmd sudo apt install -y "${install_debs[@]}"
log
log "Building OpenOnload kernel modules:"
cmd sudo module-assistant --non-inter auto-install onload && \
# Not mentioned in the documentation, but:
# OpenOnload installs a module named sfc.ko, which clashes with
# the sfc.ko provided by the OS installation.
# To deal with this, a depmod file is also installed, which should
# instruct the OS to load OpenOnload's version.
# However, unless depmod is re-run after installation, OpenOnload will fail
# to load, citing "symbol not found" errors.
sudo depmod
log
log "Loading OpenOnload kernel modules:"
cmd sudo onload_tool reload
log
log "Installation complete."