Updated P4D2 2017 Fall vm scripts to build and install P4Runtime (#65)
* Updated vm provisioning scripts to build and install P4Runtime Also, hardcoded commit ID for each tool to improve reproducibility of exercises (the P4Runtime API could change in the future). TODO: there is a permission error at line 114 of user-bootstrap.sh that needs to be fixed. * Removed unnecessary compiler flags when bulding PI * Fixed permission error and updated BMv2 and PI commit IDs
This commit is contained in:
parent
7738341012
commit
37d1632865
@ -9,36 +9,60 @@ apt-get update
|
||||
|
||||
DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
|
||||
|
||||
apt-get install -y \
|
||||
lubuntu-desktop \
|
||||
git \
|
||||
vim \
|
||||
emacs24 \
|
||||
xcscope-el \
|
||||
sublime-text-installer \
|
||||
apt-get install -y --no-install-recommends \
|
||||
atom \
|
||||
xterm \
|
||||
mininet \
|
||||
autoconf \
|
||||
automake \
|
||||
libtool \
|
||||
curl \
|
||||
make \
|
||||
g++ \
|
||||
unzip \
|
||||
libgc-dev \
|
||||
bison \
|
||||
build-essential \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
cpp \
|
||||
curl \
|
||||
emacs24 \
|
||||
flex \
|
||||
libfl-dev \
|
||||
libgmp-dev \
|
||||
git \
|
||||
libboost-dev \
|
||||
libboost-iostreams-dev \
|
||||
libboost-filesystem-dev \
|
||||
libboost-iostreams1.58-dev \
|
||||
libboost-program-options-dev \
|
||||
libboost-system-dev \
|
||||
libboost-test-dev \
|
||||
libboost-thread-dev \
|
||||
libc6-dev \
|
||||
libevent-dev \
|
||||
libffi-dev \
|
||||
libfl-dev \
|
||||
libgc-dev \
|
||||
libgc1c2 \
|
||||
libgflags-dev \
|
||||
libgmp-dev \
|
||||
libgmp10 \
|
||||
libgmpxx4ldbl \
|
||||
libjudy-dev \
|
||||
libpcap-dev \
|
||||
libreadline6 \
|
||||
libreadline6-dev \
|
||||
libssl-dev \
|
||||
libtool \
|
||||
lubuntu-desktop \
|
||||
make \
|
||||
mininet \
|
||||
mktemp \
|
||||
pkg-config \
|
||||
python \
|
||||
python-scapy \
|
||||
python-dev \
|
||||
python-ipaddr \
|
||||
python-pip \
|
||||
python-scapy \
|
||||
python-setuptools \
|
||||
sublime-text-installer \
|
||||
tcpdump \
|
||||
cmake
|
||||
unzip \
|
||||
vim \
|
||||
wget \
|
||||
xcscope-el \
|
||||
xterm
|
||||
|
||||
useradd -m -d /home/p4 -s /bin/bash p4
|
||||
echo "p4:p4" | chpasswd
|
||||
|
@ -1,36 +1,102 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Print script commands.
|
||||
set -x
|
||||
# Exit on errors.
|
||||
set -e
|
||||
|
||||
# Bmv2
|
||||
git clone https://github.com/p4lang/behavioral-model
|
||||
cd behavioral-model
|
||||
./install_deps.sh
|
||||
./autogen.sh
|
||||
./configure
|
||||
make
|
||||
sudo make install
|
||||
cd ..
|
||||
BMV2_COMMIT="ae84c2f6d5bc3dd6873a62e351f26c39038804da"
|
||||
PI_COMMIT="f06a4df7d56413849dbe9ab8f9441321ff140bca"
|
||||
P4C_COMMIT="3ad8d93f334a34d181e8d9d83100d797bac3f65a"
|
||||
PROTOBUF_COMMIT="tags/v3.0.2"
|
||||
GRPC_COMMIT="tags/v1.3.0"
|
||||
|
||||
NUM_CORES=`grep -c ^processor /proc/cpuinfo`
|
||||
|
||||
# Protobuf
|
||||
git clone https://github.com/google/protobuf.git
|
||||
cd protobuf
|
||||
git checkout v3.0.2
|
||||
git checkout ${PROTOBUF_COMMIT}
|
||||
export CFLAGS="-Os"
|
||||
export CXXFLAGS="-Os"
|
||||
export LDFLAGS="-Wl,-s"
|
||||
./autogen.sh
|
||||
./configure
|
||||
make
|
||||
./configure --prefix=/usr
|
||||
make -j${NUM_CORES}
|
||||
sudo make install
|
||||
sudo ldconfig
|
||||
unset CFLAGS CXXFLAGS LDFLAGS
|
||||
cd ..
|
||||
|
||||
# gRPC
|
||||
git clone https://github.com/grpc/grpc.git
|
||||
cd grpc
|
||||
git checkout ${GRPC_COMMIT}
|
||||
git submodule update --init
|
||||
export LDFLAGS="-Wl,-s"
|
||||
make -j${NUM_CORES}
|
||||
sudo make install
|
||||
sudo ldconfig
|
||||
unset LDFLAGS
|
||||
cd ..
|
||||
|
||||
# BMv2 deps (needed by PI)
|
||||
git clone https://github.com/p4lang/behavioral-model.git
|
||||
cd behavioral-model
|
||||
git checkout ${BMV2_COMMIT}
|
||||
# From bmv2's install_deps.sh, we can skip apt-get install.
|
||||
# Nanomsg is required by p4runtime, p4runtime is needed by BMv2...
|
||||
tmpdir=`mktemp -d -p .`
|
||||
cd ${tmpdir}
|
||||
bash ../travis/install-thrift.sh
|
||||
bash ../travis/install-nanomsg.sh
|
||||
sudo ldconfig
|
||||
bash ../travis/install-nnpy.sh
|
||||
cd ..
|
||||
sudo rm -rf $tmpdir
|
||||
cd ..
|
||||
|
||||
# PI/P4Runtime
|
||||
git clone https://github.com/p4lang/PI.git
|
||||
cd PI
|
||||
git checkout ${PI_COMMIT}
|
||||
git submodule update --init --recursive
|
||||
./autogen.sh
|
||||
./configure --with-proto
|
||||
make -j${NUM_CORES}
|
||||
sudo make install
|
||||
sudo ldconfig
|
||||
cd ..
|
||||
|
||||
# Bmv2
|
||||
cd behavioral-model
|
||||
./autogen.sh
|
||||
./configure --enable-debugger --with-pi
|
||||
make -j${NUM_CORES}
|
||||
sudo make install
|
||||
sudo ldconfig
|
||||
# Simple_switch_grpc target
|
||||
cd targets/simple_switch_grpc
|
||||
./autogen.sh
|
||||
./configure
|
||||
make -j${NUM_CORES}
|
||||
sudo make install
|
||||
sudo ldconfig
|
||||
cd ..
|
||||
cd ..
|
||||
cd ..
|
||||
|
||||
# P4C
|
||||
git clone --recursive https://github.com/p4lang/p4c
|
||||
git clone https://github.com/p4lang/p4c
|
||||
cd p4c
|
||||
mkdir build
|
||||
git checkout ${P4C_COMMIT}
|
||||
git submodule update --init --recursive
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake ..
|
||||
make -j4
|
||||
make -j${NUM_CORES}
|
||||
sudo make install
|
||||
sudo ldconfig
|
||||
cd ..
|
||||
cd ..
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user