Xilinx FPGA_as_a_Service之Xilinx Base Runtime指令碼分析

2020-08-13 13:07:45
參照[Xilinx FPGA_as_a_Service 概述](https://feishujun.blog.csdn.net/article/details/107910624) 的安裝流程,本篇部落格對Xilinx Base Runtime指令碼進行分析。第一個指令碼是在宿主機中執行的host_setup.sh。指令碼的主要用途是按照XRT和重新整理Shell。看其中的usage函數,列出了指令碼參數的使用,如下:
./host_setup.sh --version <version>
./host_setup.sh  -v       <version>
<version>        : 2018.3 / 2019.1 / 2019.2 / 2020.1
--skip-xrt-install    : skip install XRT
--skip-shell-flash    : skip flash Shell
--install-docker      : install docker service

比如Install 2019.2 XRT and flash Shell的命令如下:./host_setup.sh -v 2019.2

VERSION="2020.1"
for OSVERSION in "centos" "ubuntu-16.04" "ubuntu-18.04"; do
    for PLATFORM in "alveo-u200" "alveo-u250" "alveo-u280" "alveo-u50" ; do
        echo "${PLATFORM}_${VERSION}_${OSVERSION}"
        get_packages
        echo "$XRT_PACKAGE, $DSA, $SHELL_PACKAGE, $TIMESTAMP, $PACKAGE_NAME, $PACKAGE_VERSION, $XRT_VERSION, $CMC_PACKAGE, $SC_PACKAGE, $SHELL_TARBALL"
    done  
done
exit 0

get_packages() {
    COMB="${PLATFORM}_${VERSION}_${OSVERSION}"
    if grep -q $COMB "conf/spec.txt"; then    # 從conf/spec.txt中找出相關包
        XRT_PACKAGE=`grep ^$COMB: conf/spec.txt | awk -F':' '{print $2}' | awk -F';' '{print $1}' | awk -F= '{print $2}'`
        SHELL_PACKAGE=`grep ^$COMB: conf/spec.txt | awk -F':' '{print $2}' | awk -F';' '{print $2}' | awk -F= '{print $2}'`
        DSA=`grep ^$COMB: conf/spec.txt | awk -F':' '{print $2}' | awk -F';' '{print $3}' | awk -F= '{print $2}'`
        TIMESTAMP=`grep ^$COMB: conf/spec.txt | awk -F':' '{print $2}' | awk -F';' '{print $4}' | awk -F= '{print $2}'`
        PACKAGE_NAME=`grep ^$COMB: conf/spec.txt | awk -F':' '{print $2}' | awk -F';' '{print $6}' | awk -F= '{print $2}'`
        PACKAGE_VERSION=`grep ^$COMB: conf/spec.txt | awk -F':' '{print $2}' | awk -F';' '{print $7}' | awk -F= '{print $2}'`
        XRT_VERSION=`grep ^$COMB: conf/spec.txt | awk -F':' '{print $2}' | awk -F';' '{print $8}' | awk -F= '{print $2}'`
        if [[ "$PLATFORM" == "alveo-u50" ]]; then
            CMC_PACKAGE=`grep ^$COMB: conf/spec.txt | awk -F':' '{print $2}' | awk -F';' '{print $9}' | awk -F= '{print $2}'`
            SC_PACKAGE=`grep ^$COMB: conf/spec.txt | awk -F':' '{print $2}' | awk -F';' '{print $10}' | awk -F= '{print $2}'`
            SHELL_TARBALL=`grep ^$COMB: conf/spec.txt | awk -F':' '{print $2}' | awk -F';' '{print $11}' | awk -F= '{print $2}'`
        fi
    else
        usage
        echo ""
        list
        exit 1
    fi
}

在这里插入图片描述