#!/bin/bash # Source this file to setup the environment 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 } function setup_meep() { . /nfs/apps/XILINX/xilinx_22_env.sh export PATH="$PATH:/apps/QDMA/meep-ionic/2022.1.4.4/linux-kernel/bin/" # Select the first FPGA in the node local line=$(grep fpgan /etc/motd | head -1 | tr -d ' ') 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}') # Setup mappings # Delta between where we load in the dma device and RAM local delta_addr=-0x60000000 export FPGACTL_BOOTLOADER_ADDR=$((0x80000000+$delta_addr)) export FPGACTL_KERNEL_ADDR=$((0x84000000+$delta_addr)) export FPGACTL_INITRD_ADDR=$((0x8c300000+$delta_addr)) export FPGACTL_ROOTFS_ADDR=$((0x100000000+$delta_addr)) } hostname=$(hostname) case "$hostname" in cucu) setup_cucu ;; fpgan*) setup_meep ;; *) echo "ERROR: unknown host $hostname";; esac