-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·93 lines (85 loc) · 2.02 KB
/
setup.sh
File metadata and controls
executable file
·93 lines (85 loc) · 2.02 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#! /bin/bash
COLOR_RED='\033[0;31m'
COLOR_GREEN='\033[0;32m'
COLOR_YELLOW='\033[0;33m'
COLOR_OFF='\033[0m' # No Color
log() {
echo -e ${COLOR_GREEN} $@ ${COLOR_OFF}
}
err() {
echo -e ${COLOR_RED} $@ ${COLOR_OFF}
}
sudo echo "hello!"
CURDIR=`dirname $0`
CURDIR=`realpath $CURDIR`
DDIR=`realpath $CURDIR/_deps`
mkdir -p $DDIR
if [ ! -d $DDIR ]; then
err "Failed to create directory at $DDIR"
err "Dependancies will be installed in this directory."
exit 1
fi
sudo apt-get update
sudo apt-get install -y build-essential libz-dev libelf-dev pkg-config
printf "\n\n"
# Configure HUGEPAGES
restart_required=0
log "Would you like to update GRUB config to enable HUGE pages (y/[n])?"
read cmd
if [ "x$cmd" = "xy" ]; then
log "Updating GRUB..."
grub='GRUB_CMDLINE_LINUX_DEFAULT="default_hugepagesz=1G hugepagesz=1G hugepages=4"'
echo $grub | sudo tee -a /etc/default/grub
sudo update-grub
log "Warning: The previous kernel parameters will be overwritten!"
restart_required=1
fi
# ubpf
cd $DDIR
git clone https://github.com/fshahinfar1/uBPF.git
cd uBPF/vm
make
if [ $? -ne 0 ]; then
err "Failed to build uBPF"
exit 1
fi
sudo make install
log "- uBPF"
# libbpf
cd $DDIR
git clone https://github.com/libbpf/libbpf
cd libbpf
git checkout f9f6e92458899fee5d3d6c62c645755c25dd502d
cd src
mkdir build
make all OBJDIR=.
make install DESTDIR=build OBJDIR=.
# Check if a recent libbpf is already installed on the system
_current_libbpf_v=$(pkg-config --modversion libbpf)
_major=0
if [ $? -eq 0 ]; then
_major=$(echo $_current_libbpf_v | cut -d '.' -f 1)
else
_current_libbpf_v="no libbpf found"
fi
if [ $_major -lt 1 ]; then
log "current version of libbpf is not appropriate: $_current_libbpf_v"
sudo make install
'/usr/lib64/' | sudo tee /etc/ld.so.conf.d/libbpf.conf
sudo ldconfig
fi
log "- libbpf"
# llvm13
# cd $CURDIR/docs/
# sudo bash ./llvm.sh
# log "- LLVM 13"
# Servant
cd $CURDIR
git submodule update --init
cd $CURDIR/src
make
sudo make install
log "- Done"
if [ $restart_required -gt 0 ]; then
echo "You should reboot the system (for hugepages)"
fi