add new topology parameter: arch
[csit.git] / tests / tldk / tldk_scripts / install_tldk.sh
1 #!/bin/bash
2
3 set -x
4
5 # set arch, default to x86_64 if none given
6 ARCH=${1:-"x86_64"}
7
8 # dpdk prefers "arm64" to "aarch64" and does not allow arm64 native target
9 if [ $ARCH == "aarch64" ]; then
10     ARCH="arm64"
11     MACHINE="armv8a"
12 else
13     MACHINE="native"
14 fi
15
16 DPDK_VERSION=16.11.1
17
18 ROOTDIR=/tmp/TLDK-testing
19 PWDDIR=$(pwd)
20 DPDK_DIR=dpdk
21 DPDK_PACKAGE=${DPDK_DIR}"-"${DPDK_VERSION}.tar.xz
22
23 # compile and install the DPDK
24 cd ${ROOTDIR}
25 sudo tar xvf ${DPDK_PACKAGE}
26 sudo mv dpdk-stable-${DPDK_VERSION} dpdk
27 echo $PWD
28 echo ${DPDK_PACKAGE}
29 cd ./${DPDK_DIR}
30 sudo sed -i 's/^CONFIG_RTE_LIBRTE_PMD_PCAP=n/CONFIG_RTE_LIBRTE_PMD_PCAP=y/g' ./config/common_base
31 sudo make install T=${ARCH}-${MACHINE}-linuxapp-gcc
32 cd ${PWDDIR}
33
34 # compile the TLDK
35 export RTE_SDK=${ROOTDIR}/${DPDK_DIR}/
36 export RTE_TARGET=${ARCH}-${MACHINE}-linuxapp-gcc
37 cd ${ROOTDIR}/tldk
38 make all
39 cd ${PWDDIR}
40
41 sudo killall -9 l4fwd 2>/dev/null
42
43 sleep 5
44
45 pid=`pgrep l4fwd`
46 if [ "$pid" != "" ]; then
47     echo "terminate the l4fwd failed!"
48     exit 1
49 fi
50
51 # check and setup the hugepages
52 SYS_HUGEPAGE=$(cat /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages)
53 if [ ${SYS_HUGEPAGE} -lt 1024 ]; then
54     MOUNT=$(mount | grep /mnt/huge)
55     while [ "${MOUNT}" != "" ]
56     do
57         sudo umount /mnt/huge
58         sleep 1
59         MOUNT=$(mount | grep /mnt/huge)
60     done
61
62     echo 1024 | sudo tee /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages
63     echo 1024 | sudo tee /sys/devices/system/node/node1/hugepages/hugepages-2048kB/nr_hugepages
64
65     sudo mkdir -p /mnt/huge
66     sudo mount -t hugetlbfs nodev /mnt/huge/
67     test $? -eq 0 || exit 1
68 fi

©2016 FD.io a Linux Foundation Collaborative Project. All Rights Reserved.
Linux Foundation is a registered trademark of The Linux Foundation. Linux is a registered trademark of Linus Torvalds.
Please see our privacy policy and terms of use.