forked from mtcp-stack/mtcp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_mtcp_onvm_env.sh
executable file
·48 lines (40 loc) · 1.36 KB
/
setup_mtcp_onvm_env.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env bash
GREEN='\033[0;32m'
NC='\033[0m'
if [ -z "$RTE_SDK" ]; then
echo "Please follow onvm install instructions to export \$RTE_SDK"
exit 1
fi
if [ -z "$RTE_TARGET" ]; then
echo "Please follow onvm install instructions to export \$RTE_TARGET"
exit 1
fi
# Get to script directory
cd $(dirname ${BASH_SOURCE[0]})/
printf "${GREEN}Checking ldflags.txt...\n$NC"
if [ ! -f $RTE_SDK/$RTE_TARGET/lib/ldflags.txt ]; then
echo "File $RTE_SDK/$RTE_TARGET/lib/ldflags.txt does not exist, please reinstall dpdk."
sed -i -e 's/O_TO_EXE_STR =/\$(shell if [ \! -d \${RTE_SDK}\/\${RTE_TARGET}\/lib ]\; then mkdir \${RTE_SDK}\/\${RTE_TARGET}\/lib\; fi)\nLINKER_FLAGS = \$(call linkerprefix,\$(LDLIBS))\n\$(shell echo \${LINKER_FLAGS} \> \${RTE_SDK}\/\${RTE_TARGET}\/lib\/ldflags\.txt)\nO_TO_EXE_STR =/g' $RTE_SDK/mk/rte.app.mk
exit 1
fi
printf "${GREEN}RTE_SDK$NC env variable is set to $RTE_SDK\n"
printf "${GREEN}RTE_TARGET$NC env variable is set to $RTE_TARGET\n"
# Check if you are using an Intel NIC
while true; do
read -p "Are you using an Intel NIC (y/n)? " response
case $response in
[Yy]* ) break;;
[Nn]* ) exit;;
esac
done
# Create interfaces
printf "Creating ${GREEN}dpdk$NC interface entries\n"
cd dpdk-iface-kmod
make
if lsmod | grep dpdk_iface &> /dev/null ; then
:
else
sudo insmod ./dpdk_iface.ko
fi
sudo -E make run
cd ..