-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_switch.sh
executable file
·69 lines (56 loc) · 1.54 KB
/
install_switch.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
69
#! /bin/bash
sudo apt-get update -y
if [ "$#" -ne 1 ]; then
echo "usage: ./install.sh <bf-sde-*.tgz>"
exit 1
fi
echo "dollarsign at: $@"
function abs_path() {
echo "$(cd "$(dirname "$1")"; pwd)/$(basename "$1")"
}
SDE_FILE=$(abs_path $1)
SDE_DIR="$(pwd)/$(basename $SDE_FILE .tgz)"
SET_SCRIPT=$SDE_DIR/set_sde.bash
SDE_FILE=$(abs_path $1)
SDE_DIR="$(pwd)/$(basename $SDE_FILE .tgz)"
# SDE_DIR="$(pwd)/$SDE_DIR"
SET_SCRIPT=$SDE_DIR/set_sde.bash
echo "installing sde from: $SDE_FILE --> $SDE_DIR"
tar -xzf $SDE_FILE
cd $SDE_DIR
# create install profile
echo "vm_sde_profile:
global_configure_options: ''
package_dependencies:
- thrift
- grpc
packages:
- bf-syslibs:
- bf_syslibs_configure_options: ''
- bf-utils:
- bf_utils_configure_options: ''
- bf-drivers:
- bf_drivers_configure_options: ''
- bf-runtime
- p4-runtime
- pi
- ptf-modules
tofino_architecture: tofino" > ./p4studio_build/profiles/vm_sde_profile.yaml
# create the set_sde helper
echo "function set_sde() {
export SDE=\$SDE_DIR
export SDE_INSTALL=\$SDE_DIR/install
export PATH=\$SDE_INSTALL/bin:$PATH
}
set_sde" > "$SET_SCRIPT"
# do install
./p4studio_build/p4studio_build.py -up vm_sde_profile
# setup hugepages
echo "----setting up hugepages for p4studio----"
echo 'vm.nr_hugepages=128' | sudo tee /etc/sysctl.d/hugepages.conf
sudo mount -t hugetlbfs none /dev/hugepages
sudo sysctl -w vm.nr_hugepages=128
# setup env variables
echo "----adding SDE env variables to bashrc----"
echo ". $SET_SCRIPT" >> ~/.bashrc
pip install dpkt