2024-07-01 09:57:05 +02:00
|
|
|
#!/bin/bash
|
2024-03-01 18:37:05 +01:00
|
|
|
|
|
|
|
# Source this file to setup the environment
|
|
|
|
|
2024-07-01 09:57:05 +02:00
|
|
|
function setup_cucu()
|
|
|
|
{
|
|
|
|
INSTALL_PATH=/home/tools
|
|
|
|
LOAD_BITSTREAM=$INSTALL_PATH/scripts
|
|
|
|
|
|
|
|
export DMA_IP_DRIVERS="$INSTALL_PATH/drivers/$hostname/dma_ip_drivers-onic-gamma/xilinx_pcie_drivers"
|
|
|
|
|
|
|
|
if [ ! -d $DMA_IP_DRIVERS ]; then
|
|
|
|
echo "error: DMA_IP_DRIVERS $DMA_IP_DRIVERS directory does not exist" >&2
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
export PATH="$DMA_IP_DRIVERS/QDMA/linux-kernel/bin/:$PATH"
|
|
|
|
|
|
|
|
if [ -x /opt/Xilinx/Vivado/2020.1/settings64.sh ]; then
|
|
|
|
source /opt/Xilinx/Vivado/2020.1/settings64.sh
|
|
|
|
elif [ -x /opt/Xilinx/Vivado/2021.2/settings64.sh ]; then
|
|
|
|
source /opt/Xilinx/Vivado/2021.2/settings64.sh
|
|
|
|
fi
|
|
|
|
}
|
2024-03-01 18:37:05 +01:00
|
|
|
|
2024-07-01 09:57:05 +02:00
|
|
|
function setup_meep()
|
|
|
|
{
|
|
|
|
. /nfs/apps/XILINX/xilinx_22_env.sh
|
|
|
|
export PATH="$PATH:/apps/QDMA/meep-ionic/2022.1.4.4/linux-kernel/bin/"
|
2024-03-01 18:37:05 +01:00
|
|
|
|
2024-07-01 09:57:05 +02:00
|
|
|
# Select the first FPGA in the node
|
2024-07-08 09:55:13 +02:00
|
|
|
local line=$(grep fpgan /etc/motd | sed -n 2p | tr -d ' ')
|
2024-07-01 09:57:05 +02:00
|
|
|
export FPGACTL_PCIDEV=$(echo "$line" | awk -F'|' '{print $5}')
|
|
|
|
export FPGACTL_SERIAL=$(echo "$line" | awk -F'|' '{print $4}')
|
|
|
|
export FPGACTL_UART=$(echo "$line" | awk -F'|' '{print "/dev/"$7}')
|
2024-03-01 18:37:05 +01:00
|
|
|
|
2024-07-01 09:57:05 +02:00
|
|
|
# Setup mappings
|
2024-03-01 18:37:05 +01:00
|
|
|
|
2024-07-01 09:57:05 +02:00
|
|
|
# Delta between where we load in the dma device and RAM
|
2024-08-29 14:39:27 +02:00
|
|
|
local delta_addr=-0x60000000
|
2024-07-08 17:37:46 +02:00
|
|
|
|
|
|
|
# See https://gitlab.bsc.es/hwdesign/fpga/integration-lab/fpga-tools/-/blob/6a63bcea6d1d59df3c7d62311aa4935efd54d3a3/boot_riscv/boot_sa.sh#L36-40
|
2024-07-01 09:57:05 +02:00
|
|
|
export FPGACTL_BOOTLOADER_ADDR=$((0x80000000+$delta_addr))
|
|
|
|
export FPGACTL_KERNEL_ADDR=$((0x84000000+$delta_addr))
|
|
|
|
export FPGACTL_INITRD_ADDR=$((0x8c300000+$delta_addr))
|
2024-10-10 15:34:06 +02:00
|
|
|
export FPGACTL_ROOTFS_ADDR=$((0x1c0000000+$delta_addr))
|
2024-07-08 17:37:46 +02:00
|
|
|
export FPGACTL_BOOTROM_ADDR=$((0x00000100))
|
2024-07-01 09:57:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
hostname=$(hostname)
|
|
|
|
|
|
|
|
case "$hostname" in
|
|
|
|
cucu) setup_cucu ;;
|
|
|
|
fpgan*) setup_meep ;;
|
|
|
|
*) echo "ERROR: unknown host $hostname";;
|
|
|
|
esac
|