forked from AltraMayor/gatekeeper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·68 lines (55 loc) · 2.04 KB
/
setup.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Gatekeeper - DoS protection system.
# Copyright (C) 2016 Digirati LTDA.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# All the dependency projects are maintained in this directory.
cd dependencies
# Setup DPDK.
cd dpdk
# Path to the build directory.
export RTE_SDK=`pwd`
# Target of build process.
export RTE_TARGET=x86_64-native-linuxapp-gcc
# Configure and build.
make config T=${RTE_TARGET}
make
# Install kernel modules.
sudo modprobe uio
sudo modprobe uio_pci_generic
sudo insmod ${RTE_SDK}/build/kmod/igb_uio.ko
# Make modules persist across reboots. Since multiple
# users can run this script, don't re-add these modules
# if someone else already made them persistent.
sudo ln -s ${RTE_SDK}/build/kmod/igb_uio.ko /lib/modules/`uname -r`
sudo depmod -a
if ! grep -q "uio" /etc/modules; then
sudo echo "uio" | sudo tee -a /etc/modules
fi
if ! grep -q "uio_pci_generic" /etc/modules; then
sudo echo "uio_pci_generic" | sudo tee -a /etc/modules
fi
if ! grep -q "igb_uio" /etc/modules; then
sudo echo "igb_uio" | sudo tee -a /etc/modules
fi
ln -s ${RTE_SDK}/build ${RTE_SDK}/${RTE_TARGET}
# Setup LuaJIT.
cd ../luajit-2.0
# Build and install.
make
sudo make install
cd ../../
# Build interface name -> PCI address map.
gcc generate_if_map.c -o generate_if_map -Wall
./generate_if_map
echo "Environmental variables RTE_SDK and RTE_TARGET have been set, but not saved for future logins. You should save them to your shell's preferences file or set them after every login."